Skip to content

chore(security): add agent verification skill and input dispatch CI guard - #794

Closed
devswha wants to merge 2 commits into
mainfrom
cursor/agent-trustworthy-a616
Closed

devswha wants to merge 2 commits into
mainfrom
cursor/agent-trustworthy-a616

Conversation

@devswha

@devswha devswha commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Change

Make this repo more agent-trustworthy following Lauren Tan's approach: agents must prove work by running the app; give them a feature map; seal bad shortcuts with mechanical CI checks rather than prose rules.

1. Verification skill (.cursor/skills/verify-herdr-web-ui/)

Teaches agents how to:

  • Build and run herdr-web-ui in test mode
  • Drive it in a real browser via Playwright/Chrome DevTools Protocol
  • Capture evidence (screenshots, console errors, network failures, optionally performance traces)

Reuses the repo's existing browser regression scripts and harness (scripts/ci-browser.sh, scripts/ui-regression.ts, the *-regression.ts scripts) instead of inventing new infra.

Verification of the skill (ran locally):

$ bun run build
$ bun scripts/demo-build.ts "$HERDR_DEMO_BUILD"
$ HERDR_DEMO_BUILD="$HERDR_DEMO_BUILD" bun scripts/settings-pages-demo-regression.ts
PASS fuzzy commands and offscreen keyboard selection (390px)
PASS every Settings page and key bar fit a 390px phone (en); 2189ms
PASS every Settings page and key bar fit a 320px phone (en); 2107ms
PASS every Settings page and key bar fit a 320px phone (ko); 1906ms
PASS every Settings page and key bar fit a 320px phone (ja); 1979ms
PASS every Settings page and key bar fit a 320px phone (zh); 2078ms
PASS Back on a phone leaves the key bar editor...
PASS the Back control in the dialog and the system Back button share one history
PASS the X from the key bar editor and a reload leave no Settings entry
PASS on a desktop Back closes Settings in one step...
PASS a window that changes width with Settings open keeps Back

2. Feature map (.cursor/skills/verify-herdr-web-ui/feature-map.md)

Documents how to reach each major feature with stable selectors/data attributes actually present in the code:

  • Routes (/?pane={id}, /?settings, /?new, etc.)
  • Keyboard shortcuts (Mod+Shift+K for palette, etc.)
  • Data attributes (data-workspace, data-pane, data-status, etc.)
  • ARIA labels for getByRole queries
  • CSS classes for state
  • Viewport breakpoints and phone test viewports
  • Wait patterns for WebSocket frames

3. CI guard against input dispatch bypass (scripts/input-guard-check.ts)

Static analysis that fails CI when a new paneSendText or paneSendKeys call bypasses the authorization guard. This pattern appeared in:

How the guard works:

  1. Scans all server/**/*.ts for paneSendText/paneSendKeys calls
  2. Checks if each call passes a guard parameter (4th argument)
  3. Allows exceptions for:
  4. Fails with clear error message and fix instructions

Wired into bun run check fast lane.

Tests (scripts/input-guard-check.test.ts):

  • Passes when all calls have guards
  • Fails when paneSendText is called without a guard
  • Fails when paneSendKeys is called without a guard
  • Allows unguarded calls in test files
  • Reports file and line number of violations

Validation

  • bun run typecheck: pass
  • bun run build: pass
  • bun run test:unit: 2554 pass, 8 skip, 0 fail
  • bun scripts/input-guard-check.ts: pass (30 call sites, 10 with guards, 20 in allowed exceptions)
  • Demo browser script (settings-pages-demo-regression.ts): all PASS
Open in Web Open in Cursor 

cursoragent and others added 2 commits October 11, 2026 07:47
Teaches agents how to build and run herdr-web-ui in test mode, drive it
in a real browser via Playwright, and capture evidence (screenshots,
console errors, performance traces). Includes a feature map documenting
stable selectors, data attributes, routes, and keyboard shortcuts for
browser testing.

Reuses existing browser regression scripts and test harness instead of
inventing new infra. Part of making the repo more agent-trustworthy.

Co-authored-by: Hako <devswha@gmail.com>
Static analysis to ensure all paneSendText and paneSendKeys calls in
agent pane input paths pass an authorization guard. The guard is called
right before herdr receives the write, preventing race conditions where
a sender's permission could lapse during Bun.connect() (#624, #666, #760).

The check runs in the fast lane (bun run check fast) and fails if any
call site bypasses the guard without being in an allowed exception list.
Allowed exceptions include:
- Test files (run against owned panes)
- HTTP POST handlers (synchronous request context)
- prompt.ts (uses its own authorization model)
- Secret input Enter (#589: must follow paste immediately)
- submitText (authorize() called synchronously before each send)

Includes tests for the guard: passing and violating fixtures.

Co-authored-by: Hako <devswha@gmail.com>
@coderabbitai

coderabbitai Bot commented Oct 11, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 11, 2026

Copy link
Copy Markdown
Owner Author

Closing. The skill doc repeats commands already kept in docs/development.md and AGENTS.md (which ask not to copy them) and assumes a Cursor workspace. The input guard problem is real (#624, #666, #760), but a regex scan with a pattern allowlist is brittle and already allowlists a known unguarded path (submitText). A sturdier fix is to make the guard a required parameter of paneSendText/paneSendKeys so the type checker finds every call, with explicit, explained opt-outs for the HTTP handlers and tests; that can come as its own PR.

@devswha devswha closed this Oct 11, 2026
@devswha
devswha deleted the cursor/agent-trustworthy-a616 branch October 17, 2026 14:08
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.

2 participants