Repository navigation
ref(security): Read signing and encryption secrets in one module - #3141
Merged
Merged
Conversation
Co-Authored-By: David Cramer <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
11 screenshot changes — 11 changed · 0 added · 0 removed Review screenshots in Frameshift |
dcramer
approved these changes
Nov 11, 2026
dcramer
pushed a commit
that referenced
this pull request
Nov 11, 2026
#3141 and #3109 both merged. #3141 confines secret env reads to `chat/secrets.ts`. #3109 adds `JUNIOR_ENCRYPTION_KEYS` and `JUNIOR_ENCRYPTION_KEY_ID`, which the rule does not cover yet. The rule now covers both keys. No code reads them from `process.env` directly. `chat/config.ts` passes the startup env to `readEncryptionKeyring` once, and `chat/encryption/keyring.ts` parses them. The comment in `secrets.ts` names that path, so it stays the one documented exception and does not drift into a second place that reads keys. Moving the keyring read into `secrets.ts` would change the env-injection contract of `readChatConfig`, which tests depend on. This PR does not do that. <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC0B595QDZLL%3A1794357294.209209 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AC0B595QDZLL%3A1794357294.209209) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0B595QDZLL%3A1794357294.209209/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
23 tasks done
This branch was successfully 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.
Moves every read of Junior's signing secrets into
packages/junior/src/chat/secrets.ts, and adds an ast-grep rule (no-secret-env-reads-outside-secrets-module) that rejects reads anywhere else inpackages/junior/src. To find out what code can touch keys, you now only have to read one file. That backs the blast-radius rule in #3137.The rule covers
JUNIOR_SECRET,BETTER_AUTH_SECRET,JUNIOR_SCHEDULER_SECRET,CRON_SECRET, andJUNIOR_WEB_PUSH_PRIVATE_KEY. Each caller keeps its own error message and its own behavior when a secret is missing. The sign-in fallback still uses??on the raw values.Out of scope:
JUNIOR_ENCRYPTION_KEYS/JUNIOR_ENCRYPTION_KEY_IDaren't on main yet. Whichever of this PR and feat(credentials)!: Encrypt stored credentials at rest #3109 merges second should add them to the module and the rule.LINEAR_,SENTRY_,VERCEL_WEBHOOK_SECRET) andGOOGLE_CLIENT_SECRETbelong to plugins or provider OAuth config.cli/env.tsset these variables for local runs. The rule only checks reads ofprocess.envin non-test source.via @dcramer.
--
View Session [Sentry]