feat: add DA_OPS_IMS_BOT_EMAIL escape hatch for bot write access#280
Open
auniverseaway wants to merge 2 commits into
Open
feat: add DA_OPS_IMS_BOT_EMAIL escape hatch for bot write access#280auniverseaway wants to merge 2 commits into
auniverseaway wants to merge 2 commits into
Conversation
Mirror the DA_OPS_IMS_ORG injection but key on user email rather than IMS org identifier. Lets ops grant full write access to a single bot identity instead of every member of an IMS org. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
Adds
DA_OPS_IMS_BOT_EMAIL, a Worker env variable that grants its bearer the same full-write ops escape hatch as the existingDA_OPS_IMS_ORG(introduced in #233), but matched against the user's IMS profile email instead of an IMS org identifier. Use case: scoping ops write access to one bot identity rather than every member of an IMS org.Changes
src/utils/auth.js— insidegetAclCtx, mirror the existingif (env.DA_OPS_IMS_ORG)block with a structurally identical block keyed onenv.DA_OPS_IMS_BOT_EMAIL. Injects two ACL rows (writeonCONFIG,writeon/ + **).src/index.d.ts— addDA_OPS_IMS_BOT_EMAIL: string;to theEnvinterface.test/utils/auth.test.js— add'test DA_OPS_IMS_BOT_EMAIL permissions'mirroring the existingDA_OPS_IMS_ORGtest, plus a negative assertion that a non-matching email is denied.Behavior
Both env vars are independent and additive. Either, both, or neither may be set.
DA_OPS_IMS_ORGDA_OPS_IMS_BOT_EMAILMatching is case-insensitive:
getIdentslowercasesuser.emailand the rule-build loop lowercases eachgroupstoken, so no normalization is needed at injection.Notes for operators
The value must be a single email address. Comma-separated multi-value is not validated and would silently grant access to multiple identities through the downstream
groups.split(',')parser — out of scope for this change; if multi-bot is needed later, add it explicitly.Test Plan
npm test— 391 passing, 0 failingnpm run lint— cleanDA_OPS_IMS_ORGtest still passes (no regression on the precedent)🤖 Generated with Claude Code