fix: resolve the diff base from origin/HEAD instead of assuming main - #217
fix: resolve the diff base from origin/HEAD instead of assuming main#217withinfocus wants to merge 1 commit into
Conversation
Claude Code validationResult: Issues found Validated PR #217 ( The changeset is a real fix: the previous The verdict is CriticalNone. Major
Minor
NotesOne reviewer disagreement, adjudicated. The skill-reviewer rated the YAML-sequence rewrite of Noted, not counted (pre-existing, no edit worsened it). Verified clean. Version bumps are consistent and correctly sized: Checks run
|
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE This replaces two hardcoded Not covered: Skill review did not run — this review path cannot launch Code Review Details
|
3165253 to
0dc172d
Compare
70acfc2 to
2c29796
Compare
2c29796 to
6332774
Compare
4244054 to
8ef7114
Compare
30cb4ee to
bfc1a4a
Compare
96ec72f to
ef55ed0
Compare
Local-mode code review and branch-comparison security review both diffed against a literal `main`, which is the wrong base in any repo whose default branch is named something else. Both now resolve `origin/HEAD` and ask when it cannot be resolved, and both gained the `git symbolic-ref` grant needed to run that resolution.
ef55ed0 to
fc73bdd
Compare
| - Bash(gh pr diff:*) | ||
| - Bash(gh pr view:*) | ||
| - Bash(git branch --show-current:*) | ||
| - Bash(git check-ref-format:*) |
There was a problem hiding this comment.
🎨 SUGGESTED: Finding 1: Bash(git check-ref-format:*) grants a command the procedure no longer runs.
Details and fix
The only two mentions of git check-ref-format in the skill (SKILL.md:58 and references/base-ref-resolution.md:67) both say it is not the control — the allowlist regex is. No step invokes it, and the changelog's Added section lists only git rev-parse, git merge-base, and printenv GITHUB_ACTIONS, so this line looks like a leftover from the earlier iteration where the check was the validation.
Dropping the line keeps allowed-tools a faithful description of what the skill runs:
- Bash(git branch --show-current:*)
- Bash(git diff:*)Low risk either way — git check-ref-format is read-only — but an unused grant in a security skill's allowlist invites the next reader to assume the check happens.
🎟️ Tracking
Layer 2 of 4 in stack #221, bottom to top: #220, #217, #219, #218. Based on #220.
No Jira ticket. This came out of an audit of how the plugins resolve a diff base.
📔 Objective
Two review paths compared against a literal
main:bitwarden-code-reviewerlocal mode (git diff main...HEAD)perform-security-reviewbranch comparison mode (git diff main...HEAD)In a repo whose default branch is named anything else, both produce the wrong range and the review silently covers the wrong commits. Most other plugins already resolve this properly, so these two were the outliers.
Both now resolve the base with
git rev-parse --abbrev-ref origin/HEAD, which yieldsorigin/mainand is the formperforming-multi-agent-code-reviewalready uses under aBash(git rev-parse:*)grant.git rev-parseis read-only across its whole argument space, which matters because these agents read contributor-authored diffs unattended:git symbolic-refwould have done the same job, but its two-argument and--deleteforms write, and a prefix grant reaches them.Three things follow from making the base variable:
perform-security-reviewStep 5 emittedCode Review: {branch} vs main. Left alone it would have published a security report naming a base it was not reviewed against. It now readsvs {base-ref}.origin/HEAD.actions/checkoutand--single-branchclones do not create the ref, so the resolution exits 128 there. Branch comparison mode falls back to the repository'sdefault_branchovergh api, already covered by an existing grant, and prompts only on interactive runs. Under$GITHUB_ACTIONSit stops with a clear error rather than waiting for an answer nobody can give.Task, so "ask the user" is not available to it. It returns the request for a base branch to the invoking command instead of guessing.Both grants are added alongside the instructions that need them.
Versions:
bitwarden-code-review1.14.1 to 1.14.2,bitwarden-security-engineer1.3.0 to 1.3.1.