Security: Sicherheitslücke in Zahnarztpraxen-System
Bei einem von tausenden Zahnarztpraxen eingesetzten Praxisverwaltungssystem hätten durch eine Schwachstelle Patientendaten gelesen und verändert werden können. Ein Bericht von Günter Born ( Sicherheitslücke, SQL)
@kat@yarn.girlonthemoon.xyz @kat@yarn.girlonthemoon.xyz Pretty sure I have many more mentions in the database than the one and only one I see hmmm 🤔 – I’ll have a look at the code when I can and the SQL query it’s using
提示詞注入攻擊的檢測和數據集介紹
提示詞注入攻擊介紹提示詞注入是一種攻擊技術,攻擊者通過精心設計的輸入來操縱 AI 系統,使其偏離原定行爲或繞過設定的安全措施。這類似於軟件開發中的 SQL 注入攻擊,但針對的是 AI 系統的提示詞處理機制。OWASP 把提示詞注入攻擊作爲 2025 年大模型應用風險的第一位,可見其重要程度。相對於原來直接針對大模型的攻擊,在基於大模型的應用中,增加了數據:數據裏也可以加入對大模型的攻擊,舉個例子: ⌘ Read more
MySQL 大事務提交優化
在使用和運維 MySQL 的過程中你一定碰到過下面這種奇怪的慢 SQL。 • 平時執行很快的 INSERT 語句,竟然執行了1.3s,並且慢 SQL 記錄裏也沒有看到長時間的鎖等待。 • 多語句事務的所有語句都已經執行完了,但是 COMMIT 語句竟然執行了1.3s。 當這種情況出現時,最有可能的就是有大事務在提交。以下是一個模擬測試的結果,我們用 Sysbench 來模擬正常的業務 ⌘ Read more
printf
?!)
@prologic@twtxt.net There have always been and there will always be people who have absolutely no clue what they’re doing. I’ve been 100% one of them when I started. Guaranteed, heaps of new SQL injections are born every single day, numbers rising.
That doesn’t justify all the WAF crap in the first place, though. In my opinion it’s just a filthy plaster applied to an injected wound. The software itself must be secure. Otherwise, don’t put that shit on the internet. Probably not even operate it at all. Nowhere. Fix it or throw it in the bin.
One thing about my design here is that it would no longer incorporate “regex”-based rules like OWASP, mostly because my experience thus far has taught me that these rules are kind of overly sensitive, produce false positives and I’m not sure they are really very effective. For example, why is the point of performing SQL injection detection at the Edge using a WAF if you already handle SQL properly in the first place? (seriously does anyone still construct SQL queries by hand with effectively printf
?!)
Today is the day where everything is falling apart. Suddenly, I get: SQL logic error: cannot start a transaction within a transaction
I was trying to optimize the SQL query used for the Compact FrontPage (anonymous view for Discovery when the Admin/Operator chooses “one twt per feed”).
搞懂常見 Go ORM 系列 - Ent 框架詳解
在 Go ORM 開篇中我們將 Go ORM 框架分成了三類🌲 反射型主要通過反射機制將結構體映射到數據庫表上,代表作爲 go-gorm/gorm🌲 代碼生成型通過代碼生成工具預先生成數據模型及查詢構建器,代表作有 ent/ent 和日益流行的 go-gorm/gen🌲 SQL 增強型基於原生 SQL 庫進行封裝和擴展,既保留 SQL 的靈活性,又提供了一系列便捷函數,代表作爲 jmoiron/s ⌘ Read more
SQL scares me i tweaked a bash script that pulled from a DB and the bash part was easy even if i was just going off of the code in there that i didn’t write (like i understood it at least) but the SQL parts had me suffering
The other day, after a discussion online, we came to the conclusion that using awk+sed+tr could replace much of the development that requires a database. However, using SQLite to have a SQL syntax isn’t a bad idea either. What do you think?
@lyse@lyse.isobeef.org OK. So how I have worked things like this out is to have the interface in the root package from the implementations. The interface doesn’t need to be tested since it’s just a contract. The implementations don’t need to import storage.Storage
- storage/ defines the
Storage
interface (no tests!)
- storage/sqlite for the sqlite implementation tests for sqlite directly
- storage/ram for the ram implementation and tests for RAM directly
- storage/sqlite for the sqlite implementation tests for sqlite directly
- controller/ can now import both storage and the implementation as needed.
So now I am guessing you wanted the RAM test for testing queries against sqlite and have it return some query response?
For that I usually would register a driver for SQL that emulates sqlite. Then it’s just a matter of passing the connection string to open the registered driver on setup.
https://github.com/glebarez/go-sqlite?tab=readme-ov-file#connection-string-examples
Learn SQL by solving crimes. I want to highlight it as a teacher and a developer, it’s extremely well done.
https://www.sqlnoir.com/
#sql
Golang 使用反射實現漏洞插件管理
在安全檢測領域,我們經常需要實現一個插件體系,以支持和管理不同類型的漏洞檢測插件。例如,SQL 注入掃描、XSS 檢測等插件應該可以動態加載、統一管理,並按需執行。本文將會介紹如何使用 Golang 反射(reflection) 構建一個可擴展的漏洞檢測插件系統,包括 插件註冊、管理、調用,我會提供完整的 demo 代碼和項目結構來幫助你理清思路。下面就開始我們今天的內容吧!!!🚀🚀🚀項目目錄結構 ⌘ Read more
5 分鐘搞懂 Golang 數據庫連接管理
本文介紹瞭如何在 Golang 中優化數據庫連接,通過有效管理連接來提高應用程序吞吐量。原文: Optimizing Database Connections in Go: Improving Throughput by Managing Open Connections Efficiently[1]Go 的 database/sql 軟件包提供了自動化數據庫連接池,能夠幫助開發人員有效管理連 ⌘ Read more
golang 是如何防範 SQL 注入、CSRF、XSS 攻擊 的
在 Go 語言的 Web 開發中,常見的安全問題包括 SQL 注入、CSRF(跨站請求僞造)、和 XSS(跨站腳本攻擊)。Go 提供了多種機制與工具庫來防範這些攻擊。以下是針對每種攻擊的防範措施:防範 SQL 注入————SQL 注入 是一種通過修改 SQL 查詢的輸入,使攻擊者能夠執行未授權 SQL 語句的攻擊手段。防範 SQL 注入的關鍵是避免直接拼接 SQL 字符串,而是使用 ⌘ Read more
I share I did write up an algorithm for it at some point I think it is lost in a git comment someplace. I’ll put together a pseudo/go code this week.
Super simple:
Making a reply:
- If yarn has one use that. (Maybe do collision check?)
- Make hash of twt raw no truncation.
- Check local cache for shortest without collision
- in SQL:
select len(subject) where head_full_hash like subject || '%'
- in SQL:
Threading:
- Get full hash of head twt
- Search for twts
- in SQL:
head_full_hash like subject || '%' and created_on > head_timestamp
- in SQL:
The assumption being replies will be for the most recent head. If replying to an older one it will use a longer hash.
@prologic@twtxt.net, are you running Gitea with an SQL backend, or using sqlite? Any reason have haven’t moved to Forgejo?
Go 語言與 SQL 數據庫的交互方式
Go 語言作爲一門簡潔高效的語言,在與關係型數據庫交互方面也擁有着豐富的選擇。本文將深入探討 Go 語言中幾種常見的與 SQL 數據庫交互方式,並通過示例代碼、優缺點分析和擴展知識點,幫助你更好地理解和選擇適合你的方案。Go 語言與 SQL 數據庫交互的常見方式———————Go 語言標準庫提供了database/sql包,它是一個基礎的 SQL 數據庫驅動接口,爲各種 ⌘ Read more
你是如何用 Go 語言 配置高性能 sql-DB 的?
配置高性能的 sql.DB 是 Go 應用程序開發中一個重要的環節,特別是在需要處理大量數據庫查詢的情況下。以下是一些最佳實踐和配置建議:1. 數據庫連接池的配置Go 的 database/sql 包提供了連接池的功能,您可以通過設置最大空閒連接、最大打開連接數和連接的最大生命週期來優化連接池。db, err := sql.Open(“mysql”, ”user:password@tcp(127. ⌘ Read more
Golang - range 迭代器揭祕
簡介我們正在使用 Go 語言編寫 Dolt[1] ,這是世界上第一個版本控制的 SQL 數據庫。像大多數大型 Go 代碼庫一樣,我們有很多需要迭代的集合類型。 Go 1.23 的新特性 [2] 中,你現在可以使用 range 關鍵字來迭代自定義集合類型。這是如何工作的? 這是個好主意嗎? 讓我們深入探討一下。如果你想運行本教程中的任何代碼,你需要 安裝 Go 1.23 發佈候選版 [3] ,或者在 ⌘ Read more
Golang 編寫範型集合,官方文檔未提及的訣竅
引言–Go 的泛型功能在 Go 1.18 版本中發佈, 至今已有兩年多了。我們正在使用 Go 開發 Dolt[1] , 這是世界上第一個支持版本控制的 SQL 數據庫。儘管我們有數十萬行 Go 代碼, 但我們並沒有大量使用泛型。我們在一些地方使用泛型 來加速代碼中的高流量部分 [2] , 但總的來說, 除了 slices[3] 和 maps[4] 包中的一些有用的庫方法外, 我們還沒有找到使用泛 ⌘ Read more
Go 語言主流 ORM 框架對比:GORM vs- Ent
GORM 和 Ent 是 Go 語言中使用廣泛的兩種 ORM(對象關係映射)框架。它們都有助於將數據庫操作從底層 SQL 抽象出來,簡化數據庫交互,但它們的設計理念和使用方式有顯著的不同。本文將詳細介紹 GORM 和 Ent 的不同特點、使用示例,並比較它們在不同場景下的優劣。GORM 簡介——-GORM 是一個易於使用的 ORM 庫,旨在提供簡單、乾淨的 API。它通過反射機制動態處理數 ⌘ Read more
Gorm 源碼解析
我們先通過一張圖來看 Gorm 核心主流程。gorm 主流程1. 初始化 DB 連接—————-使用 database.sql 初始化連接。我們平時所說的數據庫驅動其實就是每個數據庫對 DSN 不同的解析方式,最終底層都是使用的 TCP 建立起數據庫連接。type Connector interface { Connect(context.Context) (Conn, err ⌘ Read more
sqlx: 功能強大的數據庫訪問庫
sqlx[1] 是一個用於擴展標準庫 database/sql 的庫,它提供了一些額外的功能,使得在 Go 中使用 sql 更加方便。sqlx 的目標是保持 database/sql 的簡單性,同時提供更多的功能。sqlx 爲 Go 的標準 database/sql 庫提供了一組擴展。sqlx 中的 sql.Conn、sql.DB、sql.TX、sql.Stmt、sql.Rows、sql.Row ⌘ Read more
Golang 如何實現自定義 CDC 工具?
CDC變更數據捕獲(CDC)是一種跟蹤數據庫更改的技術,允許開發人員捕獲應用於行的插入、更新和刪除。它是數據集成和實時處理任務的重要組成部分。在本文中,我們將討論如何在 Golang 中爲 PostgreSQL、Oracle、MySQL、MongoDB 和 SQL Server 等多個數據庫開發自定義 CDC 工具。通常在 CDC 領域或者說大數據領域都是 java 的生態比較繁榮,比如 Flin ⌘ Read more
Goose:Go 語言漸進式的數據庫遷移工具
數據庫遷移是軟件開發過程中重要的一部分,隨着業務的發展和需求的變化,數據庫結構經常需要做出調整。Goose 是一個出色的數據庫遷移工具,它通過 SQL 腳本和 Go 函數支持漸進式的數據庫變化。下面是一篇詳細的文章,它將深入介紹 Goose 的用法,並提供豐富的示例幫助你開始使用 Goose。Goose 簡介——–Goose 是一款能夠管理數據庫架構變更的工具,提供了一系列命令來幫助開發 ⌘ Read more
Golang: 打造一個交互式命令行
Go 非常適合於構建命令行應用程序。我們構建了一個名爲 Dolt 的應用, 它是世界上第一個支持版本控制的 SQL 數據庫。我們爲處理 Dolt 的所有子命令和參數編寫了自己的命令行解析器, 但也許我們不應該這樣做。現在有很多很棒的工具可以替代我們自己編寫的解析器, 如果我們今天開始這個項目, 我們可能會選擇使用它們:spf13/cobra 提供了從簡單的文本命令格式生成代碼的強大支持, 並且可以 ⌘ Read more
收到請求數據的常用安全驗證方案,go 語言,gin 框架
在使用 Gin 框架處理前端請求數據時,必須關注安全性問題,以防範常見的攻擊。本文將探討 Gin 框架中常見的安全問題,並提供相應的處理方法,以確保應用程序的穩健性和安全性。第一章:概述———-1.1 安全性的重要性處理前端請求數據時,確保應用程序的安全性是至關重要的。常見的攻擊方式包括 SQL 注入、跨站腳本攻擊(XSS)、跨站請求僞造(CSRF)等。下面我們將逐一探討這些問題及其處 ⌘ Read more
On the topic of Programming Languages and Telemetry. I’m kind of curious… Do any of these programming language and their toolchains collect telemetry on their usage and effectively “spy” on your development?
- Python
- C
- C++
- Java
- C#
- Visual Basic
- Javascript
- SQL
- Assembly Language
- PHP
@abucci@anthony.buc.ci Where did I hate on SQL databases? 🤔
@eldersnake@we.loveprivacy.club Several reasons:
- It’s another language to learn (SQL)
- It adds another dependency to your system
- It’s another failure mode (database blows up, scheme changes, indexs, etc)
- It increases security problems (now you have to worry about being SQL-safe)
And most of all, in my experience, it doesn’t actually solve any problems that a good key/value store can solve with good indexes and good data structures. I’m just no longer a fan, I used to use MySQL, SQLite, etc back in the day, these days, nope I wouldn’t even go anywhere near a database (for my own projects) if I can help it – It’s just another thing that can fail, another operational overhead.
I’ve never liked the idea of having everything displayed all of the time for all of history.
And I still don’t: Search and Bookmarks are better tools for this IMO.
From a technical perspective however, we will not introduce any CGO dependencies into yarnd
– It makes portability harder.
Also I hate SQL 😆
it uses the queries you define for add/del/set/keys. which corrispond to something like INSERT INTO <table> (key, value) VALUES ($key, $value)
, DELETE ...
, or UPDATE ...
the commands are issued by using the maddycli but not the running maddy daemon.
see https://maddy.email/reference/table/sql_query/
the best way to locate in source is anything that implements the MutableTable interface… https://github.com/foxcpp/maddy/blob/master/framework/module/table.go#L38
Trying to figure out what sql query maddy does to change user passwords, but first, i’m looking for the subcommand that actually does that… on the source code
content="width=device-width"
to your viewport meta tag will help massively with scaling on different device widths.
Thanks for the feedback! This site was designed to look perfect on good old 800x600 monitors (I even left a comment next to the meta tag). Maybe I’ll add a mobile-friendly version someday :-) P.S. Nice try with SQL injection, haha. Do you have any plans for XSS attacks? :D
** My programming language odyssey **
While I wouldn’t say I’m wicked adept at any one language, I’ve dipped my toes into many different languages. Here, I try to roughly recreate my programming language journey.
The web. A marvel, a terror. I started here, more out of ease of access than necessity, but was able to get far enough to make a career out of web dev. I should also add SQL to this list.
[Elm](https://elm-lang … ⌘ Read more
Thinking beyond SQL injection: OWASP tips for secure database access
When it comes to secure database access, there’s more to consider than SQL injections. OWASP Top 10 Proactive Control C3 offers guidance. ⌘ Read more
开源走向世界(下):从数据库技术演进看开源力量丨 BDTC 2021
本文内容根据 PingCAP 高级副总裁范若晗在 BDTC 2021 的主题演讲:“开源走向世界” 整理而成,从协作方式和技术演进两个角度,分享了 “开源” 和 “全球化” 之间相互关联,密不可分的关系,分为上下两篇,上篇介绍了开源如何构建全球化的舞台,本篇主题为:从数据库技术演进看开源力量
我们认为,数据技术演进的驱动力总结起来,主要包括三个方面:理论基础推动软件创新、基础设施保障软件能力的实现、业务需求真正打磨了技术的不断工程化、产品化,是产品真正的 “用武之地”。
数据库演进历史——基础理论驱动
按照时间和功能维度,我们将数据生态做了划分,大致包括 SQL 生态,大数据生态,NoSQL 生态,NewSQL 生态,以及 SQL 的云化生态。每个生态的演进,离不开基础理论的发展。
1970 年 IBM 的关系型数据库理论 Relational Model 包括 System R 原型产品的问世,为 Oracle、DB2、MicroSoft SQL Server 这些商业数据库的诞生奠定了基础。而后 MySQL、PostgreSQL 以开源这一形态获得快速发展和全球最广泛的应用。
200 … ⌘ Read more
备份的 “算子下推”:BR 简介丨 TiDB 工具分享
BR 选择了在 Transaction KV 层面进行扫描来实现备份。这样,备份的核心便是分布在多个 TiKV 节点上的 MVCC Scan:简单,粗暴,但是有效,它生来就继承了 TiKV 的诸多优势:分布式、利于横向拓展、灵活(可以备份任意范围、未 GC 的任意版本的数据)等等优点。
相较于从前只能使用 mydumper 进行 SQL 层的备份,BR 能够更加高效地备份和恢复:它取消了 SQL 层的开销 … ⌘ Read more
SQL(ite) and zettelkastens as a medium for non-linear story telling. #halfbaked
user-defined order in SQL [[https://begriffs.com/posts/2018-03-20-user-defined-order.html]] #sql #links maybe something that can be adapted to !sqlite?
Testing @!(ref “weewiki_sql” “page markers” “iterate_over_values”)!@.
While certainly not a solution to everything, I find I’m using temporary SQLITE database a bunch to solve problems with a few lines of sql and less then 50 lines of code (to insert data into the SQLITE DB) instead of several hundred of lines of code and a bunch of arrays.
Fun with data! The complete roster twtxt database can be downloaded at https://roster.twtxt.org/twtxt_20160405.sql.gz
Fun with data! The complete roster twtxt database can be downloaded at https://roster.twtxt.org/twtxt_20160405.sql.gz
rtdb.py: Extension for dtuple.py
This is specific to sqlite but could easily be adopted to work with other databases. # # rtdb.py: Extension for dtuple.py # # Written by Dennis T Kaplan . Public Domain. # No Copyright, no Rights Reserved, and no Warranties. class rtdb: def __init__(self, dbname, sql, one = True): self.one = one connection = sqlite3.connect(dbname) […] ⌘ Read more