Skip to content

fix(checks): build the postgres check connection from an explicit pq.Config - #584

Merged
fclairamb merged 7 commits into
mainfrom
security/scan-specs-2026-10-17
Oct 17, 2026
Merged

fclairamb merged 7 commits into
mainfrom
security/scan-specs-2026-10-17

Conversation

@fclairamb

@fclairamb fclairamb commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Fixes findings G1 and G2 of the security scan of 2026-10-17 (severity low).

Change

  • The PostgreSQL check no longer builds a lib/pq conninfo string. buildPQConfig fills a pq.Config directly and openDB opens it with pq.NewConnectorConfig. A backslash or quote in a field can no longer add driver options (G1).
  • The check no longer falls back to the worker's own PG* environment, ~/.pgpass or ~/.postgresql client certificate (G2). Passfile, SSLCert and SSLKey point to a path that cannot exist.
  • BuildConnStr and escapePQParam are removed.
  • Credentials containing a backslash or a quote now work.
  • PGCONNECT_TIMEOUT on the worker no longer affects the check; the check timeout is used.

Tests

connector_test.go: hostile values arrive byte for byte in each field; a fake cleartext-auth server receives no ambient password with .pgpass, PGPASSFILE, PGPASSWORD and others set, and does receive the check's own password (positive control).

Spec archived: specs/done/2026/10/2026-10-17-01-postgres-check-connection-config.md.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.22222% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.23%. Comparing base (9d5fb1d) to head (4666bc4).

Files with missing lines Patch % Lines
...erver/internal/checkers/checkpostgres/connector.go 96.77% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #584      +/-   ##
==========================================
- Coverage   83.23%   83.23%   -0.01%     
==========================================
  Files        1207     1208       +1     
  Lines      124151   124147       -4     
==========================================
- Hits       103340   103335       -5     
- Misses      20802    20803       +1     
  Partials        9        9              
Files with missing lines Coverage Δ
server/internal/checkers/checkpostgres/checker.go 40.44% <100.00%> (-3.89%) ⬇️
...r/internal/checkers/checkpostgres/config/config.go 65.78% <100.00%> (-1.21%) ⬇️
...internal/checkers/checkpostgres/config/validate.go 93.75% <100.00%> (ø)
...erver/internal/checkers/checkpostgres/connector.go 96.77% <96.77%> (ø)

... and 12 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

fclairamb and others added 4 commits October 17, 2026 16:08
…Config

The PostgreSQL check no longer builds a lib/pq conninfo string. Its fields
map one to one onto a pq.Config opened with pq.NewConnectorConfig, which
parses no string and reads no environment:

- a host, username, database or password made of backslashes, quotes,
  spaces or `=` can no longer add driver options (sslmode, sslcert,
  passfile, service...);
- a check without a password no longer inherits the worker's PGPASSWORD,
  PGPASSFILE / ~/.pgpass, PGSSLCERT / PGSSLKEY / ~/.postgresql client
  certificate or PGSERVICE.

PostgreSQL check credentials containing a backslash or a quote now work
(they were mangled by the old escaper).

BuildConnStr and escapePQParam are removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…xplicitly

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…plicitly

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@fclairamb fclairamb changed the title chore(specs): security scan findings fix(checks): build the postgres check connection from an explicit pq.Config Oct 17, 2026
@fclairamb
fclairamb enabled auto-merge (squash) October 17, 2026 14:54
@fclairamb
fclairamb merged commit a4b394a into main Oct 17, 2026
26 checks passed
@fclairamb
fclairamb deleted the security/scan-specs-2026-10-17 branch October 17, 2026 15:45
fclairamb added a commit that referenced this pull request Oct 18, 2026
Specs for the open findings of the daily security scan. Specs only, no
code change.

## Specs

| Spec | Severity | Finding | Summary |
|---|---|---|---|
| `specs/todos/2026-10-18-01-plugin-schema-file-ref.md` | low | I1
(2026-10-18) | Plugin schemas are compiled with the JSON-schema
library's default loader, which opens `file://` references. An
agent-reported schema can therefore make the API node open local files,
and whether the type gets listed reveals whether a path or JSON key
exists. Fix: `compiler.UseLoader` with a loader that refuses every URL.
|

Autopilot implemented the spec (`fix(plugins): refuse external $ref
targets in plugin schemas`) and archived it in `specs/done/2026/10/`.
Batch gate green: `make build-backend lint-back test` (258 packages ok).

## Decided by autopilot
None: the spec had no open questions.

Scan of 2026-10-18: the new plugin system, public tools endpoint,
vendor-status check, SMS/voice quotas and MCP handshake change were
reviewed. The postgres fix of #584 (G1/G2) was verified. No other new
finding.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
fclairamb added a commit that referenced this pull request Oct 18, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.39.0](v0.38.6...v0.39.0)
(2026-10-18)


### Features

* A2A notification channel for AI agents
([#596](#596))
([2f55dc3](2f55dc3))
* **dash0:** calmer, flatter and phone-friendly dashboard UI
([#582](#582))
([ce933cc](ce933cc))
* vendor status check, SMS/voice quotas, upgrade-path CI and flaky test
fixes ([#591](#591))
([1a392ec](1a392ec))


### Bug Fixes

* **checks:** build the postgres check connection from an explicit
pq.Config ([#584](#584))
([a4b394a](a4b394a))
* **deps:** update github.com/dop251/goja digest to 313b6b6
([#578](#578))
([d068c02](d068c02))
* **deps:** update github.com/dop251/goja digest to d42f16b
([#597](#597))
([3f501a1](3f501a1))
* **deps:** update github.com/dop251/goja digest to e686264
([#590](#590))
([380ed48](380ed48))
* **deps:** update module github.com/knadh/koanf/v2 to v2.4.0
([#586](#586))
([c02a042](c02a042))
* **deps:** update module github.com/knadh/koanf/v2 to v2.4.1
([#594](#594))
([95e8ec3](95e8ec3))
* **deps:** update module github.com/posthog/posthog-go to v1.35.1
([#583](#583))
([efb4819](efb4819))
* **deps:** update module golang.org/x/mod to v0.42.0
([#598](#598))
([62e913d](62e913d))
* **showcase:** film a single region, as a plain docker run shows
([#595](#595))
([a443442](a443442))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant