Repository navigation
fix(security): apply New options so the secret scrub actually runs - #146
Merged
Merged
Conversation
New accepted opts ...Option but never called them, so scrubSecrets stayed false in the binary and ScrubSecretEnv was unreachable: the protection merged in #136 never engaged. The unit test passed because it called the scrub function directly instead of going through New. Apply the options in the constructor and add a test that builds a Server through New with WithSecretScrub and asserts the secrets are gone. Verified to fail without the loop.
Merged
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.
Problem
Newtakesopts ...Optionbut never calls them.scrubSecretstherefore stays false in the binary andScrubSecretEnv()is unreachable, so the protection merged in #136 never engaged: agent shells, MCP stdio servers and custom tools still inheritARTEX_PG_DSN,ANTHROPIC_API_KEYandOPENAI_API_KEY.The unit test added in #136 passed because it called
ScrubSecretEnvdirectly and never went throughNew.Fix
Serveris built and beforeinitSetupToken.TestNewAppliesSecretScrubOption, which builds a server throughNew(ctx, m, ..., WithSecretScrub())and asserts the two API keys are gone. Verified it fails when the loop is removed.Verification
go build ./...,go vet ./server: cleango test ./server -run 'Scrub|Auth'against a scratch Postgres: 6 tests pass, including the new one./serversuite: only the knownTestCoreTaskLifecyclePGtiming failure in this environment