Fix/secret handling hardening - #991
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #991 +/- ##
==========================================
+ Coverage 82.68% 82.70% +0.02%
==========================================
Files 313 313
Lines 15809 15814 +5
Branches 3382 3208 -174
==========================================
+ Hits 13071 13079 +8
+ Misses 2544 2541 -3
Partials 194 194
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
andy-esch
force-pushed
the
fix/secret-handling-hardening
branch
from
September 1, 2026 11:08
064d6b8 to
8f777ea
Compare
Two ops scripts passed secrets as command-line arguments, where any co-tenant
can read them from `ps aux` / /proc/<pid>/cmdline for the life of the call.
Both violate docs/guides/secure-scripting.md §1 ("No Secrets in Args").
- webhook-management.sh `delete`: fed the request line over `curl --config -`
(stdin) instead of argv, and switched the bare `curl -s ... | jq .` to a
captured response with `--fail-with-body`, so a Strava 4xx/5xx now propagates
a non-zero exit instead of being masked by jq's exit 0 under `set -o pipefail`.
Partial by necessity: Strava's v3 API documents client_id/client_secret as
REQUIRED query parameters for DELETE, with no request-body form, so the secret
still reaches Strava's access logs. Only the local argv leak is closed; the
residual is documented at the call site with a rotate-if-exposed note.
- connect.sh: parse the connection string and pass the password via PGPASSWORD
rather than as a psql argument, reusing migrate.sh's existing sed shapes rather
than a second parser. Added a guard that rejects a URI it cannot parse instead
of silently connecting with empty credentials.
shellcheck clean on both.
…nil)
LoadFromMount treated a present-but-empty (or whitespace-only) mount file as a
successful load of "". That let a caller receive an empty string with a nil
error, indistinguishable from a real secret — and, worse, an empty mount
shadowed the documented env fallback, because it returned success before the
fallback could run. The apigateway would then go on to sign OAuth state tokens
with an empty HMAC key.
Treat an empty/whitespace mount as an absent secret: fall through to the env
fallback, and error if that is also empty — restoring the symmetry the env path
already had. Checked all six call sites first; every one loads a real credential
(Strava id/secret, auth state secret, Postgres conn, callback capability) and
none benefits from an empty value, so the stricter contract is safe everywhere.
The existing TestLoadFromMount_FileExistsEmpty asserted the old ("", nil)
behaviour — that assertion was the defect, so it is inverted (now expects an
error) rather than worked around, and a case is added proving an empty mount
falls back to a populated env var. Covers all five cases the finding named.
go test ./packages/shared/secrets/ green.
govulncheck (the gate added in the previous commit) flags 7 Go standard-library
vulnerabilities, every one fixed in go1.26.6: GO-2026-6089 (net/http H2C
ReadHeaderTimeout), GO-2026-6088 (encoding/xml recursion depth, reached via
pgx Scan), GO-2026-5972 (encoding/asn1 recursion), GO-2026-5026 (x/net/idna
punycode via net/http), and the others in that patch.
Because these are stdlib, no `require` bump fixes them — only the toolchain
does. Bumped in lockstep so CI, the workspace, and every module agree:
- .github/workflows/ci.yml GO_VERSION 1.26.5 -> 1.26.6
- go.work + packages/{apigateway,dispatcher,shared}/go.mod go 1.26.5 -> 1.26.6
Verified per-module from each module dir (as CI runs govulncheck):
apigateway / dispatcher / shared all report 0 vulnerabilities. go-test 0
failures, go-lint 0 issues, build clean.
andy-esch
force-pushed
the
fix/secret-handling-hardening
branch
from
September 1, 2026 11:30
8f777ea to
fa3114e
Compare
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.
No description provided.