Security
To report a vulnerability, email the maintainers privately and don't open a public issue.
A review of ant on 2026-10-31 covered how it builds SQL, what it logs and how it handles secrets. It found no open issue of high severity. The project's own tooling and authors did the review, not an outside auditor.
SQL injection
| Path | Protection |
|---|---|
| Values in queries | Always bound as parameters, in every statement ant writes |
| Column and table names | Come from struct metadata, never from input, and are quoted |
OrderBy, Where, joins | Take field pointers, so a request can't name a column |
| Query comments and hints | Every adjacent */ and /* pair is spaced apart, so no delimiter survives to close or nest the comment, and spacing can't recombine characters into a new one. Covered by tests |
JSON paths in postgres.JSONText and JSONSet | Bound as a parameter, and each part is quoted, so a key can't add to the path. Covered by a test |
| Migration scripts | Identifiers are quoted, and text is escaped. A guarded script picks a dollar quote its content doesn't hold |
Calls that take raw SQL
These take raw SQL by design. Never build their SQL from input; pass values as arguments.
ant.Raw,ant.RawFile,ant.FromRaw,ant.FromFuncant.SQL,ant.SQLCondb.Check,.Default,.Generated,.Type, and.Whereon indexes, which developers write into migrationsq.Hint,q.Tag, and the name given toant.Func
antvet doesn't check these, so reviews should. A helper that takes a column or sort order from a request should map it through a fixed list.
var sortable = map[string]*string{
"name": &Users.Name,
"email": &Users.Email,
}
func list(ctx context.Context, db *AppDB, sort string) ([]*User, error) {
field, ok := sortable[sort]
if !ok {
return nil, fmt.Errorf("cannot sort by %q", sort)
}
return db.Users.OrderBy(field).All(ctx)
}
Logs and errors
- Values stay out of logs unless
ant.LogValuesis set. A test proves this. .Sensitive()keeps a column out even then, on inserts, updates,Setand conditions. A test proves this.ant.SQLarguments aren't covered, since ant can't tell which column they belong to.- Query errors hold the SQL with its placeholders, for
ant.FailedSQL.WithDetailedErrorsadds the SQL to the message, so leave it off where errors reach users. - Known limit: a database error's message can quote a value, as in
invalid input syntax for type integer: "abc", andWithLoggerlogs that message. Don't returnerr.Error()to users. The examples map errors to fixed messages. Query.Debugshows values on purpose and is not for production.- Migration failures show the database's detail, such as a duplicated value, to the operator, and store the message in the history table.
Secrets
secure.Valueuses AES-256-GCM with a random nonce. It prints and marshals as[encrypted], and decoding that placeholder leaves the value as it was. It refuses text that isn't valid UTF-8.- Known limit: a ciphertext isn't bound to its row. See encrypted fields.
- ant doesn't log connection strings. Known limit: an error from
Opencomes from the driver, and pgx masks passwords on a best-effort basis, so a badly malformed connection string can still reach the message. Treat that error as sensitive.
Tenancy
A global filter is not a security boundary: ant.Raw and IgnoreFilters bypass it. See multi-tenancy for filters that fail closed.
Migrations
resetneeds the database's name, typed or passed with--confirm, and refuses otherwise.- A checksum stops an applied file changing unnoticed. It detects mistakes, not attackers: someone who can edit the history table can change it.
- Migration files are code. Treat access to them, and to the embedded binary, like access to the database.
Dependencies
The root package uses only the standard library. Drivers, test helpers and OpenTelemetry stay in sub-packages or modules of their own.
govulncheck on 2026-11-01 found nothing that ant's code reaches. One advisory stays open in a required module: GO-2026-5932 in golang.org/x/crypto, which has no fix yet and which no code here calls.