Skip to content

feat(corrections): bind a repository-local findings-buffer adapter only from user scope - #10095

Merged
melodic-automation-lanes[bot] merged 5 commits into
mainfrom
work-resolve-issue/issue-9059-40223252504-1
Oct 25, 2026
Merged

melodic-automation-lanes[bot] merged 5 commits into
mainfrom
work-resolve-issue/issue-9059-40223252504-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #9059

Summary

Opened by the work-resolve-issue lane. The run's own summary:

A repository's own findings-buffer adapter can now be bound only in user scope, through two new corrections userConfig options. findings_buffer_adapter_repository names the git common directory and findings_buffer_adapter_path is relative to the checkout root. The options are read from user and managed settings by a direct settings reader (hook-config-delivery channel F), never from the environment, project settings or the repository's own binding files. The values pass through the existing config cascade's userConfig layer and the existing checkAdapter checks, now generalized to take a base directory. Following the 2026-10-25 recorded decisions, the binding applies only in the repository whose common directory it names (its main checkout and worktrees), and its adapter must resolve inside the checkout and outside any nested repository. To keep one settings reader (DRY/SSOT), source-control's operator-options.mjs became the shared lib/plugin-options.mjs, which now takes its keys as an argument, and both plugins carry generated copies.

Not verified

  • Did not run buffer.test.sh, resolve-promotion-evidence.test.mjs, scripts/promotion-evidence-e2e.test.sh or test_babysit_merge_policy.py: this lane's Bash runs only the named wrappers (no node, bash test scripts or python), so the new and changed tests are verified by reading and by the review subage
  • Hand-rendered the README generated options block instead of running scripts/sync-plugin-options-docs.py (not runnable here); the review subagent compared it with render() and found no drift, but CI's --check is the authority
  • sync-shared-copies --check-bump refused to run from the lane's out-of-tree copy; the carriers' release records are the two .changes fragments, which check-changelog-fragments validated
  • The new user-binding test cases read the host's real managed settings (/etc/claude-code). A runner whose managed settings are unreadable or malformed would fail them. source-control's tests already have this exposure
  • Commits were not made: this lane's instructions leave every change uncommitted for the runner to turn into a patch
  • The working tree shows untracked .bash_profile, .bashrc, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile and .zshrc at the repository root. This run did not create them (they appear to be sandbox placeholders) and left them untouched; they are not part of this change

Fix

  • lib/plugin-options.mjs: new canonical channel-F settings reader (pluginConfigs from install-anchored user settings plus managed settings), generalized from source-control's operator-options.mjs so readOperatorOptions takes the option keys
  • scripts/shared-copies.txt: registers lib/plugin-options.mjs copies in source-control (as skills/babysit-loop/scripts/operator-options.mjs) and corrections (scripts/lib/plugin-options.mjs)
  • scripts/cross-plugin-source-registry.txt: duplication-audit cluster line for the new shared reader
  • plugins/corrections/scripts/lib/plugin-options.mjs: generated copy of lib/plugin-options.mjs
  • plugins/source-control/skills/babysit-loop/scripts/operator-options.mjs: now the generated copy of lib/plugin-options.mjs (OPTION_KEYS moved to the caller)
  • plugins/source-control/skills/babysit-loop/scripts/resolve-promotion-evidence.mjs: defines and exports OPTION_KEYS and passes it to readOperatorOptions; behavior unchanged
  • plugins/source-control/skills/babysit-loop/scripts/resolve-promotion-evidence.test.mjs: passes OPTION_KEYS to readOperatorOptions in the six direct calls
  • plugins/corrections/scripts/findings-buffer.mjs: userBinding() reads the two options through the shared reader and the cascade's userConfig layer (inline schema, scratch home so no file layer can set them), matches the checkout's git common dir, refuses an absolute path, contains the adapter in the
  • plugins/corrections/.claude-plugin/plugin.json: declares userConfig findings_buffer_adapter_repository (directory) and findings_buffer_adapter_path (string)
  • plugins/corrections/README.md: Configuration section describes the user-scope binding and its limits; adds the generated options block, hand-rendered to match scripts/sync-plugin-options-docs.py render()
  • plugins/corrections/tools/findings-buffer/CONTRACT.md: Core section documents the user-scope binding, its sources, repository match, containment and nested-repository refusal
  • plugins/corrections/tools/findings-buffer/buffer.sh: header comment names the user-scope binding
  • plugins/corrections/schemas/findings-buffer.schema.json: adapter description points at the user-scope options
  • plugins/corrections/tools/findings-buffer/buffer.test.sh: plugin copy moved into a plugins/cache/<mkt>/<name>/<version> layout; new case 8 covers the user binding running in repo A, being ignored in repo B with the same layout, applying in a worktree of A, ignoring repository-writt
  • docs/conventions/hook-config-delivery/README.md: adopters table names the shared reader and adds the corrections row
  • docs/conventions/config-cascade/README.md: corrections (findings-buffer) Implementers row declares the user-scope userConfig deviation
  • docs/conventions/config-cascade/CHANGELOG.md: Unreleased entry for that row
  • .changes/corrections/feat-9059-user-scope-findings-buffer-adapter-9059a1c3.md: minor fragment
  • .changes/source-control/feat-9059-user-scope-findings-buffer-adapter-9059b2d4.md: patch fragment

Verification

The runner ran each check from the base copy against 3378109:

  • scripts/check-changelog-fragments.sh --check: passed

The run reports:

  • .lane/checks/bin/check-changelog-fragments: All 14 changelog fragment(s) under .changes/ are valid
  • .lane/checks/bin/check-affected: 10 passed, 6 skipped (validate-plugins sub-steps that run checked-tree code, ruff with no .py, typos not installed, changed-skills) over 19 changed files
  • .lane/verify/bin/sync-shared-copies --check: All 528 registered copies match their canonical sources
  • .lane/verify/bin/cant-fail-scan --file plugins/corrections/tools/findings-buffer/buffer.test.sh --check: PASS, no gating findings
  • .lane/verify/bin/cant-fail-scan --file plugins/source-control/skills/babysit-loop/scripts/resolve-promotion-evidence.test.mjs --check: PASS, no gating findings
  • fresh-context review subagent over the whole diff: found no path for repository input to bind an unconfigured adapter; its two low-severity nested-repository findings (a verb symlinked into a nested repo; a nested clone whose core.worktree points at the outer checkout) were fixed by checking both to
  • read https: //code.claude.com/docs/en/settings-reference (pluginConfigs entry): scope User or managed; Claude Code ignores project and local entries so a cloned repository cannot supply them
  • read https: //code.claude.com/docs/en/plugins/manifest-reference (User configuration, Where each variable resolves): userConfig types include string and directory; non-sensitive values are stored under pluginConfigs in user settings.json; CLAUDE_PLUGIN_OPTION_<KEY> is exported to hook processe
  • read https: //git-scm.com/docs/git-rev-parse: --git-common-dir shows $GIT_COMMON_DIR if defined, else $GIT_DIR; --show-toplevel prints the working tree's top-level directory; --path-format=absolute makes those paths absolute and canonical
  • read https: //git-scm.com/docs/git-worktree: in a linked worktree $GIT_COMMON_DIR points back to the main worktree's $GIT_DIR
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/40223252504

Left out: the items under Not verified.

Related

#9059

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 5d3e745d621cb08117a95b091e0c31ad3af5dba1: 0 finding(s), 0 as inline comments.

Code review: no findings

I read the whole diff (19 files, .claude-lane/pr.diff) and the PR context. I ran no tests or commands. The lane has no shell, and the PR's own "Not verified" section says buffer.test.sh and the other new tests were not run either. I checked findings-buffer.mjs, the new lib/plugin-options.mjs and the new test cases for correctness by reading them. I also read plugins/corrections/scripts/lib/config-cascade.mjs, the existing cascade code that the new binding goes through.

Closing issue #9059: acceptance criteria

  • Criterion: bound only through a new userConfig option, resolved by the existing userConfig layer of resolve(), with no second reader. Met. userBinding passes the values to resolve({ userConfig }). The flattened names findings_buffer_adapter_repository and findings_buffer_adapter_path map to the inline schema's findings_buffer.adapter_repository and adapter_path, as config-cascade.mjs line 47 describes. The scratch home and userHome hold no files, so no file layer can set them. The settings reader is shared (lib/plugin-options.mjs), not duplicated.
  • Criterion: the binding names its repository by git common directory, holds a root-relative path, and applies in that repository's main checkout and worktrees only. Met by the common-dir match, the checkouts() registration check, and the isAbsolute(path) refusal. Tests cover repository A, repository B with the same layout, a worktree of A, and a directory whose .git file claims A's git directory.
  • Criterion: the adapter is realpath-contained in the checkout, using the existing checkAdapter generalized to take a base, with no second validator. Met. checkAdapter(base, candidate, …) is shared with pluginAdapter.
  • Criterion: a path inside a nested repository is refused. Met. userBinding checks the adapter directory and the real location of each verb against owner(). The tests cover a symlink into a nested repository and a verb symlinked into one.
  • Criterion: the team file and overlay still accept only plugin-shipped adapters. Met. fileBinding uses pluginAdapter and the unchanged file schema.
  • Criterion: tests show A's binding is ignored in B, a symlink out of the repository is refused, and the binding applies in a worktree of A. Covered by case 8 in buffer.test.sh. I read it but did not run it.

Manifest

  • manifest userConfig defaults: pass. Both new fields have no default, so no existing default changed and no field was removed.
  • manifest userConfig options: pass. Neither field uses options.
  • manifest userConfig new field read: pass. findings-buffer.mjs reads both keys through USER_KEYS.
  • manifest version bump: pass. The fragments set corrections to minor for the new options and source-control to patch for a behavior-preserving refactor.
  • manifest description/keywords: pass. They are untouched, and the change adds nothing they omit.

Security. A separate security lane covers the trust-boundary questions (the user-scope trust model, TOCTOU between check and run). I made no security findings here.

Residual risks the PR already states

  • The new user-binding test cases read the host's real /etc/claude-code managed settings, so a runner with malformed managed settings would fail them.
  • The new and changed tests and the README options block were not run or regenerated by the author. CI is the authority for both.

No spend beyond prepaid credit or subscription usage, and no hold.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-security-review: 1 inline finding(s) on 41548d90936a471a6fe772b3237a44b34cf8959e; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 5d3e745d621cb08117a95b091e0c31ad3af5dba1: 1 finding(s), 0 as inline comments.

Security review: PR #10095 (corrections user-scope findings-buffer adapter binding)

Trusted-path globs: no changed file matches one. The diff and PR context were read in full.

critical-findings: 0

Manifest

  • manifest userConfig: flag, two keys are added to plugins/corrections/.claude-plugin/plugin.json: findings_buffer_adapter_repository (directory) and findings_buffer_adapter_path (string). Neither has a default. The inline comment names what each runs and where it comes from.
  • version is unchanged. No hooks, mcpServers or commands entries changed.

What I checked

I found no exploit path.

  • Source of the binding. userBinding() reads the two keys only through readOperatorOptions. That reads <config>/settings.json, located from the script's real path under plugins/cache/<mkt>/<name>/<ver>, plus the fixed-path managed settings. It does not read the environment, a project .claude/settings.json, or the team or overlay files. The cascade call uses home: scratch and userHome: scratch, both empty temp directories. config-cascade.mjs:399 and :429-437 show that resolve() then reads no repository file for these keys, and its legacy-file scan (:493-494) only reports paths. The GIT_* variables are stripped before every git call.
  • Applies to one repository only. The binding runs only when physical(repository) equals the checkout's --git-common-dir. It also requires the checkout root to appear in git worktree list for that directory. A directory whose .git file merely names A's git directory is therefore refused. Planting a registered worktree needs write access to A's .git, which is the trust boundary the owner already accepted.
  • Containment. checkAdapter takes the real path of the checkout root and requires the adapter to resolve inside it. It then checks the verbs, the capabilities.json handshake, and that the directory and each verb's real location belong to the same top and common directory. That catches nested repositories and symlinks out of the tree. Absolute paths and .. escapes are refused. A path under .git/ fails because rev-parse --show-toplevel fails there.
  • Fail-safe. Every refusal or read error falls back to fileBinding. That path only accepts plugin-shipped adapter names, through pluginAdapter and the unchanged checks.
  • Shared reader refactor. Passing the keys as an argument leaves source-control's behavior unchanged. The test calls were updated to match.
  • Residual risk the owner accepted (feat(corrections): accept a repository-local findings-buffer adapter only from user scope #9059 Q3). A repository that the user bound by path can later receive a hostile commit that changes the adapter. This is not a finding.

No instruction-surface deletions or softenings are in the diff.

Spend: none.

Findings not posted inline (their path, line or side is malformed):

  • plugins/corrections/.claude-plugin/plugin.json:19: severity: IMPORTANT

manifest userConfig: flag. userConfig keys are not in this repository's inert set, so the added keys are flagged by default.

What it enables. findings_buffer_adapter_repository (directory) and findings_buffer_adapter_path (string) are read by plugins/corrections/scripts/findings-buffer.mjs userBinding(). When both are set and the repository matches, buffer.sh runs the repository's own append.sh and read.sh. That is repository code, bound by the user instead of shipped by the plugin.

Where the values come from. Only user and managed settings under pluginConfigs["corrections@<mkt>"].options are read, through the shared lib/plugin-options.mjs. The environment, project settings and the repository's binding files are never read.

Defaults. Neither key has a default, so users on update get the restrictive state: only plugin-shipped adapters run. Neither key is a permissive guard. I found no exploit path, so this is a flag line, not a defect.

What installed users get on update. An opt-in feature that does nothing until they set both keys.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 1 of max 4 on bf6d74d.

@melodic-automation-lanes melodic-automation-lanes Bot added the needs-human Human-in-the-loop required; autonomous sessions must not resolve items carrying this. label Oct 25, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The pr-unblock lane stopped on this pull request and needs a person: the lane could not fix every failing check; its run log names each one and why.

  • Reason: ci-fix-escalated
  • Resume key: ff5d8ad9bd22ffb7a7f7423361db58f73031a996 (the head the lane stopped on)

To resume, deal with the reason above, remove the needs-human label (and do-not-merge, if set), then dispatch the pr-unblock workflow with pr-number=10095 and activity=fix-ci:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=10095 -f activity=fix-ci

Brings in the corrections 0.6.2 release (#10088) so the PR's fork point
matches main's manifest version; the changelog-parity-bump gate read the
synthetic merge's 0.6.2 against the old fork point's 0.6.1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton kyle-sexton removed the needs-human Human-in-the-loop required; autonomous sessions must not resolve items carrying this. label Oct 25, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 5d3e745d621cb08117a95b091e0c31ad3af5dba1.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 25, 2026
Merged via the queue into main with commit 1fc11ca Oct 25, 2026
67 of 68 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-9059-40223252504-1 branch October 25, 2026 22:16
kyle-sexton added a commit that referenced this pull request Oct 26, 2026
Conflict in plugins/source-control/skills/babysit-loop/scripts/operator-options.mjs:
main (#10095) made the file a generated copy of lib/plugin-options.mjs and
dropped source-control file names from its header; this branch only added
docs/conventions/source-control.yaml to that list. Main's "neither is any
file in the checkout" already covers the YAML, so main's copy is kept and
sync-shared-copies --check passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(corrections): accept a repository-local findings-buffer adapter only from user scope

1 participant