Repository navigation
feat: allow a whole Bitwarden Secrets Manager project in one config section - #185
Merged
Merged
Conversation
…ection (#177) A [project.NAME] section allows every secret of one bws project, asked for as SECTION/KEY. A [secret.*] entry with the same ID wins completely; two entries, or two secrets with one key, deny. Grants are kept per secret ID, so a rename does not hand out another secret. The get answer must match the list. DESIGN.md, THREAT-MODEL.md (T49-T51) and docs/setup.md are updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #177.
A
[project.NAME]section allows every secret of one Bitwarden Secrets Manager project, with one rule. A client asks for a secret asSECTION/KEY, for examplenodkey run --secret GH_TOKEN=ci/GITHUB_TOKEN -- ....What it does
internal/config/project.go):store(typebws),project(UUID),clients, and a rule.ask = "never"is an error. One project in two sections (compared in lower case, in one or two stores) is an error at start and at reload.config-difflists[project.*]changes.SECTION/KEY, each part by the name rule;api.MaxSecretName= 129, each part at most 64. Two or more/are refused. The client checks the form too.internal/broker/projects.go,internal/store/bwsproject.go):bws secret list PROJECT --output json --color no, exact key match. No match: denied. Two secrets with one key: denied, with an audit entry that namesSECTION/KEYand a journal line. After the tap,bws secret get IDmust have the samekeyandprojectIdas the list, else denied. The list parser reads onlyid,keyandprojectId; the answer is cleared. Keys that break the name rule are skipped and never kept.[secret.*]entry with the same ID in anybwsstore wins completely (its clients, rule and grants). Two entries: denied. Checked in the broker and again in the approval core (config.Broker.RuleFor).internal/approval/project.go): a newrefkind keyed by (project section, secret UUID). Window grants, pre-approvals and standing grants work this way. A rename that gives the key to another secret makes the broker ask again.[secret.*]entry for the ID ends it.ci/GITHUB_TOKEN (project rule, ID …1a2b3c4d), or(rule of secret NAME, …)when an entry wins. Telegram and ntfy check this form.project_secretsholds the name and the ID. A key the client made up never reaches the audit log.DESIGN.md (section 14 "Projects", the reload rules, section 16 table), THREAT-MODEL.md (T49–T51) and docs/setup.md ("bws: allow a whole project", with the "Can read" step) are updated.
Done when → evidence
bws secret listrow and the array rule.SECTION/KEY/ refuses a key not in the project:TestProjectSecret,TestProjectSecretRefused.TestProjectEntryWins(stricter, looser, two entries, another bws store);config.TestProjectRuleFor.TestProjectDuplicateKey.getdiffers from the list:TestProjectGetDiffers,store.TestBWSFetchListed.ask = "never"and one project in two sections stop the start:config.TestProjectConfigRefused(loadBrokeris the same code for start, reload andnodkey broker check).TestProjectReloadAddsEntry,config.TestSameProjectSecret; reload with one project in two sections is refused:config.TestProjectConfigRefused(the reload loads the config withloadBroker).TestProjectGrantRename.TestProjectSecretLimits,config.TestParseSecretName,api.TestCaps,api.TestPreapproveCaps,client.TestRunUsage.id,key,projectIdand clears:store.TestBWSListSecrets,store.TestReadListClears,store.TestParseBWSListBad(fakebws)..claude/agents/security-reviewer.md. It found three points (made-up keys in the audit log on some deny paths; no per-client cap whilebws secret listruns; two names for one secret). All three are fixed, with tests (TestProjectMadeUpKeysNotLogged,TestProjectSameSecretTwice).Also:
TestProjectPreapprove,TestProjectReloadKeepsGrant,TestProjectStoreFails,TestDiffProjects,audit.TestProjectSecretsValidate, Telegram/ntfyTestProjectSecretsInMessages.No new dependency.
🤖 Generated with Claude Code