[!] add Secret Store machinery - #821
Merged
Merged
Conversation
Coverage Report for CI Build 32732603747Coverage decreased (-0.3%) to 89.703%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
There was a problem hiding this comment.
Pull request overview
This PR introduces a Postgres-native, pgcrypto-backed secret store (timetable.secret) with ${secret:name} reference resolution in the scheduler, along with masking/redaction changes, updated samples, and extensive specification + documentation.
Changes:
- Adds
timetable.secretschema + migration00820(fresh-install DDL + upgrade migration) and wires migration registration/versioning. - Implements secret reference resolution in Go for JSON parameters and libpq conninfo, integrates it into BUILTIN/SQL/PROGRAM execution paths, and adds pgx tracer arg redaction.
- Updates samples/tests/docs to demonstrate and validate the feature (including “pg_timetable never installs pgcrypto”).
Reviewed changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/tasks/template.md | Adds a general task-list template for feature work. |
| spec/tasks/tasks-design-secret-store.md | Adds the detailed implementation task plan for secret-store work. |
| spec/spec-design-secret-store.md | Adds the full v2.1 secret-store design/specification. |
| samples/RemoteDB.sql | Updates sample to use ${secret:...} and self-install pgcrypto for demo/testability. |
| samples/Mail.sql | Updates sample to use ${secret:...} and self-install pgcrypto for demo/testability. |
| mkdocs.yml | Adds Secret Store doc page to the docs nav. |
| main.go | Bumps dbapi to 00820 and runs CheckSecretConfig at startup. |
| internal/testutils/testcontainers.go | Sets a fixed test SecretEncryptionKey for container-based tests. |
| internal/scheduler/tasks.go | Redacts builtin debug logging + resolves secrets for SendMail params. |
| internal/scheduler/tasks_test.go | Adds tests for secret resolution + builtin debug-log redaction. |
| internal/scheduler/shell.go | Resolves secrets for PROGRAM argv while keeping execution logging masked. |
| internal/pgengine/transaction.go | Resolves secrets for SQL params and remote connstrings; adds tracer redaction context. |
| internal/pgengine/sql/migrations/00820.sql | Adds migration creating timetable.secret and related functions/trigger. |
| internal/pgengine/sql/init.sql | Registers migration 00820 in the init seed. |
| internal/pgengine/sql/ddl.sql | Adds fresh-install DDL for timetable.secret mirroring migration 00820. |
| internal/pgengine/secrets.go | Introduces the resolver implementation, quoting rules, and startup config check. |
| internal/pgengine/secrets_test.go | Adds comprehensive unit/integration tests for schema, resolution, and redaction rules. |
| internal/pgengine/migration.go | Registers migration 00820. |
| internal/pgengine/migration_test.go | Extends migration test coverage to assert the secret store exists post-migrate. |
| internal/log/log.go | Adds WithoutQueryArgs marker and drops args in pgx tracer logs when marked. |
| internal/log/log_test.go | Tests that pgx tracer logging drops args under WithoutQueryArgs. |
| internal/config/config_test.go | Adds tests verifying --secret-key / PGTT_SECRET_KEY binding. |
| internal/config/cmdparser.go | Adds SecretEncryptionKey CLI/env config option. |
| docs/yaml-usage-guide.md | Documents secret-store behavior and YAML limitations. |
| docs/secret_store.md | New concept doc page describing the secret store and trust boundary. |
| docs/samples.md | Documents how samples use ${secret:...} and pgcrypto prerequisites. |
| docs/opentelemetry.md | Reformat-only change (no functional content change). |
| docs/installation.md | Updates installation notes re: extensions and secret-store pgcrypto dependency. |
| docs/database_schema.md | Minor doc cleanup (removes ER diagram caption). |
Suppressed comments (1)
internal/pgengine/secrets.go:84
- This block has indentation that
gofmtwould change (the comment lines aren’t indented under theif). If golangci-lint enforces gofmt, it will fail; please run gofmt or adjust the indentation here.
if plaintext == nil {
// Missing secret (one row containing NULL). Indistinguishable
// across client scopes.
return "", append(names, name), fmt.Errorf(
`secret %q not found for client %q`, name, pge.ClientName)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- transaction.go: use unresolved val in parse-error message to avoid leaking decrypted secret plaintext - log.go: fix gofmt indentation of type block - secrets.go: add extractRefNames() to correctly extract \ identifiers instead of mis-using uniqueRefNames on raw input - tasks_test.go: rewrite TestSendMailResolvesSecret to exercise taskSendMail end-to-end via a mocked dialer, catching regressions where secret resolution is skipped - docs/samples.md, docs/secret_store.md: stop schema-qualifying pgp_sym_encrypt as pgcrypto.pgp_sym_encrypt - go fmt cleanup of unrelated pre-existing formatting issues (cmdparser.go, provider_internal_test.go, secrets_test.go, testcontainers.go)
pashagolub
force-pushed
the
feat/secret-store
branch
from
August 24, 2026 13:25
c33266d to
ed4ceb2
Compare
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a Postgres-native, pgcrypto-backed secret store (
timetable.secret) with${secret:name}reference resolution in the scheduler, along with masking/redaction changes, updated samples, and extensive specification + documentation.