Repository navigation
fix(redact): cover more credential keys and inline sk- API keys (#16) - #165
Open
RupeshMaster wants to merge 1 commit into
Open
RupeshMaster wants to merge 1 commit into
RupeshMaster wants to merge 1 commit into
Conversation
redact_secrets only knew eight exact key names, so common shapes passed through to Hosted SQLite, ingest uploads and test reports unredacted: openai_api_key, client_secret, private_key, x-api-key, apikey, and free-text sk-proj-... keys. - Add apikey, secret_key and private_key, and treat a key as sensitive when it ends in a covered name (openai_api_key, x-api-key, client_secret, github_token, db_password). Lookalikes such as max_tokens, public_key and secret_question are left alone. - Normalize any separator in key names, not only hyphens. - Redact OpenAI-style sk- keys inside strings; the pattern needs 20+ key characters including a digit so prose like sk-learn is kept. Closes CodewithJha#16
|
@RupeshMaster is attempting to deploy a commit to the priyanshu's projects Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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.
Summary
Closes #16.
redact_secretsonly knew eight exact key names, so common credential shapes reached Hosted SQLite, ingest uploads and test reports unredacted.openai_api_key,client_secret,private_keyandx-api-key/x_api_keyare now[REDACTED].apikey,secret_keyandprivate_keyjoin the exact list, and a key is also sensitive when it ends in_+ a covered name. That covers the whole family (anthropic_api_key,stripe_secret_key,github_token,db_password) instead of four names. Lookalikes are left alone and tested:max_tokens,total_tokens,token_count,public_key,secret_question,password_hint,idempotency_key.-("api key",x.api.key), andAPIKey/apikeyare covered.sk-…/sk-proj-…keys inside strings are redacted. The pattern needs a word boundary, 20+ key characters and at least one digit, so prose such assk-learn-compatible-estimatorsortask-1234…is untouched.SECURITY.mdcovered-keys table updated.MUTINY_DISABLE_SECRET_REDACTIONbehavior is unchanged; no new dependency.Decision to review
The suffix rule goes a little beyond the four names in the issue. It can over-redact a harmless key such as
next_page_tokenin displayed evidence (policy evaluation still runs on raw data, so results are unaffected). If you prefer the exact list only, I can drop the suffix rule and keep the named keys.The issue is assigned to @CodewithJha with no activity since September, so I went ahead; if you already have work in progress on it, feel free to close this.
Type of change
Checklist
Fixes #N) or Discussion when applicableuv run pytest tests/unit -q)Test plan
uv run --locked ruff check→ all checks passeduv run pytest tests/unit tests/integration tests/reliability -q→ 884 passed, includingtests/unit/test_secret_redaction.pyandtests/integration/test_secret_redaction_persist.py. Run locally on Python 3.12 only (macOS,OPENAI_API_KEYunset); 3.11 is left for CI.examples/openai_support_agent,mutiny --help,mutiny init,mutiny runwithMUTINY_SAMPLE_OFFLINE=1and emptyOPENAI_API_KEY/FEATHERLESS_API_KEY→ violation found, regression saved.apps/webis not touched.tests/unit/test_package_release.pypassed as part of the unit run;./scripts/verify_release_artifacts.shnot run.Extra: 36 new unit cases (key variants, lookalikes,
sk-keys, prose) and the persist test now carries the new keys and an inlinesk-proj-key through SQLite, the API and the CLI report. 24 of the redaction tests fail onmain(ee7e898). Existing tests are unchanged and pass, including the ordinary-prose case.Notes
docs/SYSTEM_DESIGN.mdalone because feat(policy): support dotted paths for nested tool arguments (#22) #158 edits the adjacent paragraph; I can update it once that settles.