Skip to content

feat(prototype): fence a real-stack route to the notes bridge origin - #17806

Merged
melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-17750-44867873777-1
Nov 21, 2026
Merged

melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-17750-44867873777-1

Conversation

@melodic-automation-lanes

@melodic-automation-lanes melodic-automation-lanes Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Closes #17750

Summary

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

Adds lib/ui-feedback/harness-fence.mjs, a connect-style middleware (plus a CLI that prints the header) that the real-stack harness fence mounts on the app's dev server so it sends Content-Security-Policy: frame-ancestors &lt;bridge origin&gt; as a response header, never as a <meta> tag (MDN: frame-ancestors is not supported in <meta>). The bridge origin is validated with the existing dev-origin.mjs canonicalOrigin, so no second origin rule exists and no ; or space can reach the header. For one host spelling, notes_bridge.py now refuses a --dev-origin whose host is not one the session bridge answers on (localhost or 127.0.0.1), and ensure-running prints the bridge url/origin on the dev origin's host (new bridge_origin()); the no-dev-origin path still prints 127.0.0.1. Basis for the choice: CSP 3 host-part matching compares host spellings (ignoring case), so a localhost frame-ancestors source would refuse a host page opened on 127.0.0.1. The harness fence is a middleware module rather than per-framework config because Vite, webpack-dev-server and Express all take connect-style middleware; mounting it in a fenced block of a scaffold app is left to part 4 (#17751). session_bridge.py and the session-bridge suites are untouched.

Not verified

  • Did not run test_notes_bridge.py, harness-fence.test.mjs, test_session_bridge or test_view_bridge: this lane's Bash runs only the named wrappers, so the suites are left to the PR's CI. The session-bridge suites' files and session_bridge.py are unchanged.
  • harness-fence.test.sh is created without an executable bit (no chmod in this lane); if the test runner executes .test.sh files directly, set its mode in the PR.
  • Tidy skipped: the change spans 4 areas (lib, plugins/prototype, scripts, docs/contracts) and touches the shared path scripts/, over the tidy cutoffs.
  • verify step (build and tests) skipped for the same reason as the test runs above.
  • The CSP 3 host-part text says a non-domain host does not match while its section 2.3.1 note says 127.0.0.1 does; a 127.0.0.1 dev origin relies on browsers matching a 127.0.0.1 frame-ancestors source, which this run did not check in a browser.

Fix

  • lib/ui-feedback/harness-fence.mjs: new; fenceHeaders(bridgeOrigin), harnessFence(bridgeOrigin) connect middleware, and node harness-fence.mjs &lt;bridge origin&gt; printing the header line
  • lib/ui-feedback/harness-fence.test.mjs: new node:test suite; reads the CSP response header from a live node:http server using the middleware, checks the served page is byte-identical with no meta CSP, refuses non-canonical or directive-injecting origins, and checks the CLI
  • lib/ui-feedback/harness-fence.test.sh: new test wrapper with its test-scope line
  • lib/ui-feedback/notes_bridge.py: BRIDGE_HOSTS, bridge_origin(port, dev_origin) used by ensure-running's printed url/origin, dev_origin() refuses a host outside BRIDGE_HOSTS, docstring updated
  • lib/ui-feedback/test_notes_bridge.py: token route refuses dev-origin requests (with and without Origin); TestOneHostSpelling compares the host page's origin check value, its frame URL and the fence's frame-ancestors source (from the real CLI) and checks the bridge answers on that Host; a TestLoop end-to-end case runs ensure-running --dev-origin http://localhost:5173 through the installed notes-bridge.sh, asserts the printed origin is http://localhost:&lt;port>, passes that printed origin through harness-fence.mjs and compares its frame-ancestors source with the served page's dev origin and frame URL (TestLoop now copies dev-origin.mjs beside the scripts); start-up refusals of bad dev origins
  • plugins/prototype/notes-bridge/notes_bridge.py: regenerated copy
  • plugins/prototype/notes-bridge/harness-fence.mjs: new generated copy
  • scripts/shared-copies.txt: registers the harness-fence.mjs copy
  • docs/contracts/ui-feedback/README.md: canonical-files row for harness-fence.mjs and two trust rules (dev server sends frame-ancestors as a header; one host spelling)
  • .changes/prototype/work-resolve-issue-issue-17750-44867873777-1-77c111a5.md: minor fragment for the prototype plugin

Verification

The runner ran each check from the base copy against 48ef3a6:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • sync-shared-copies: exit 0, generated plugins/prototype/notes-bridge/notes_bridge.py and harness-fence.mjs
  • check-changelog-fragments: all 5 fragments valid
  • check-changed-skills: no changed skills, nothing to gate
  • check-affected: 16 passed, 7 skipped (typos not installed, comment-hygiene fetch blocked, size-check script missing, three validate-plugins sub-checks that run checked-tree code, changed-skills none)
  • fresh-context review subagent over the whole diff: no correctness bugs; one weak-test finding (token test never reached the Sec-Fetch-Site branch) fixed by adding a same-site request with no Origin
  • read https: //developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy/frame-ancestors: frame-ancestors is not supported in the <meta> element
  • read https: //w3c.github.io/webappsec-csp/: section 6.7.2.10 host-part matching returns Does Not Match unless the pattern is an ASCII case-insensitive match for the host (or a wildcard); section 2.3.1 notes only 127.0.0.1 among IP addresses matches
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/44867873777

Left out: the items under Not verified.

Related

#17750

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

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 44869890543

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 6cd3afd8549dc1169193df86f96b38dd5f0bdb50: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #17806, incremental since 48ef3a6

This was a blocking-only review: the lane already reviewed an earlier head, so only CRITICAL and IMPORTANT findings would be reported. I found no security issues in this change.

Scope: I read the whole incremental diff. It touches one file, lib/ui-feedback/test_notes_bridge.py.

What changed

  • TestLoop.setUp now copies dev-origin.mjs into the temporary bin directory along with the other scripts. That file is part of the repository, and it is copied into a test-only temp directory.

  • A new end-to-end test, test_ensure_running_with_a_dev_origin_prints_the_origin_the_fence_names. It:

    • runs ensure-running --dev-origin through the installed wrapper;
    • runs node harness-fence.mjs <printed origin> as an argv list, with no shell, a timeout and check=True;
    • fetches the host page on 127.0.0.1 with the matching Host header;
    • checks that the origin check, the frame URL and the frame-ancestors source all use the same host.

    All of its inputs are test constants or values the bridge printed itself. It runs no untrusted input and widens nothing.

Trust controls, manifests and instructions: The changed file matches no trusted-path glob. It touches no trust control (trusted-trigger check, lane token, kill switch, broker or merge holds), no plugin manifest and no standing instruction.

Settled threads: This commit addresses the settled thread at lib/ui-feedback/notes_bridge.py line 506, which asked for end-to-end coverage. I raised nothing from it again.

Spend: none beyond the PR's normal CI runs.

critical-findings: 0

@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-review: 1 inline finding(s) on 48ef3a6c5946164f56a065ea4878d2d95c9def96; the summary is in this lane's pull request comment.

claude-lane: claude-review

Comment thread lib/ui-feedback/notes_bridge.py Resolved
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 6cd3afd8549dc1169193df86f96b38dd5f0bdb50: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Code review (incremental, blocking only): PR #17806

This lane already reviewed an earlier head, so this pass reports blocking findings only. The scope is the one file changed since 48ef3a6c: lib/ui-feedback/test_notes_bridge.py. I read all of its change.

Result: no blocking findings.

Prior finding is fixed in the tests. The earlier finding was on notes_bridge.py:506: no test ran ensure-running --dev-origin. The new test, test_ensure_running_with_a_dev_origin_prints_the_origin_the_fence_names, closes that gap. It:

  • runs ensure-running --dev-origin http://localhost:5173;
  • checks that the printed origin is http://localhost:<port> and that url is that origin plus /;
  • passes the printed origin through harness-fence.mjs and checks that the frame-ancestors source is that origin;
  • fetches the frame with that Host and checks that data-dev-origin, the frame URL and the fence source all share one hostname.

If line 506 went back to 127.0.0.1, the first origin assertion would fail. So the issue #17750 criterion "One host spelling is used for the origin check, the frame URL and the frame-ancestors source, shown by a test that compares the three" now has a test that fails if the wiring breaks.

Test setup. setUp now copies dev-origin.mjs into the temporary bin. notes_bridge.dev_origin() needs that file, since it calls HERE / "dev-origin.mjs". The test is skipped when node is not on PATH, which matches how the other node-dependent checks are handled.

I ran nothing. Whether the suite passes is the author's claim and is unverified.

Loosened checks would be marked: fail (lane default: the prompt had no loosened_check_verdict: or loosened_check_patterns: line); patterns: 0. The prompt had no loosened_check_decision_record: line, so I did not check the citation requirement. The prompt named no settled-threads file. No plugin manifest changed.

Verifier dropped 0 of 0 candidates.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path is about to arm native auto-merge at head 48ef3a6c5946164f56a065ea4878d2d95c9def96, the head its arming checks judged. The arm fails if the head moves first.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Merge-Risk: max=MEDIUM demote=false head=48ef3a6c5946164f56a065ea4878d2d95c9def96 rubric=10.4.3 rater=claude-opus-5-5 checker=claude-opus-5-5

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/address-feedback
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 44870830207

Failed GitHub API calls

No failed call recorded by the run job's scripts.

Lane-Activity: pr-unblock/address-feedback
Lane-Thread: PRRT_kwDOTCGFQM66SN40
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/apply-feedback-patch
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed 6cd3afd
Run 44870830207

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/publish-feedback
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none recorded
Run 44870830207

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 21, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path is about to arm native auto-merge at head 6cd3afd8549dc1169193df86f96b38dd5f0bdb50, the head its arming checks judged. The arm fails if the head moves first.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Merge-Risk: max=MEDIUM demote=false head=6cd3afd8549dc1169193df86f96b38dd5f0bdb50 rubric=10.4.3 rater=claude-opus-5-5 checker=claude-opus-5-5

Merged via the queue into main with commit 33b3ae8 Nov 21, 2026
75 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-17750-44867873777-1 branch November 21, 2026 05:55
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.

prototype: notes on a real-stack prototype (feedback picker slice S7) - part 3 of 4

0 participants