Skip to main content

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​

PathProtection
Values in queriesAlways bound as parameters, in every statement ant writes
Column and table namesCome from struct metadata, never from input, and are quoted
OrderBy, Where, joinsTake field pointers, so a request can't name a column
Query comments and hintsEvery 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 JSONSetBound as a parameter, and each part is quoted, so a key can't add to the path. Covered by a test
Migration scriptsIdentifiers 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.

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​

Secrets​

  • secure.Value uses 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 Open comes 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​

  • reset needs 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.