Skip to content

chore(claude): widen the security-review trigger paths #117

Closed

Description

@Ardnived

Summary

/finalize-pr runs its security review only when the branch diff matches a path regex
(.claude/skills/finalize-pr/SKILL.md:78-79). That regex did not fire for #100 — a branch
whose entire point was hardening the Link atom's href guard. The agent ran a
security-reviewer pass anyway, on judgement, and that pass is the only reason the
protocol-relative-URL gap (//evil.com walking through href.startsWith('/')) was found before
merge. A gate that depends on someone overriding it is not a gate.

Widen the list to cover the client-side surfaces that have since become security-relevant.

Current behavior

src/config/api/|src/Widget\.tsx|src/lib/shape/lexical|src/components/organisms/EventPanel/|src/types/event|package\.json|(^|/)\.env|vite\.config\.ts

(.claude/skills/finalize-pr/SKILL.md:79. There is a second, content-based grep on line 82 for
newly-introduced HTML sinks — dangerouslySetInnerHTML|dompurify|DOMPurify|\.innerHTML — which
catches XSS sinks wherever they land, but nothing else.)

Gaps, each with a concrete reason:

Missing path Why it belongs
src/lib/shape/path.ts Home of safePath itself — the repo's single definition of "same-origin route", the guard every untrusted webPath passes through (.claude/rules/data-layer.md:93-113). src/lib/shape/lexical is covered; the URL guard next to it is not.
src/components/atoms/Link/ The atom that turns a data-driven string into an <a href>. Named explicitly in .claude/reports/100-refresh-internal-docs.md §5 as the path worth adding.
src/styles/globals.css, scripts/postcss-scope-widget.mjs, scripts/assert-css-scoped.mjs, postcss.config.js That stylesheet is injected into the host document (vite-plugin-css-injected-by-js), so an unscoped selector restyles a site we don't control — the whole subject of #91/#113, which built a PostCSS scoping plugin and a CI assertion for exactly this. The files that enforce host isolation are unguarded.
src/App.tsx The provider/boundary root — the error boundary, the report-modal host mounted outside it, and the client bootstrap that applies the locale.

Worth noting the regex is also missing pnpm-lock.yaml (package.json alone misses a transitive
bump); include it if the implementer agrees it isn't noise.

The three-repo constraint

CLAUDE.md:278 states the pipeline spec .claude/docs/workflow-parity.md is kept
byte-identical across SahajAtlasWeb, SahajCloud and WeMeditateWeb (~/Documents/Projects/),
and the file's own header repeats it: "a plain diff across the three copies must show no
differences."

But the trigger paths themselves are an intentional per-repo delta, not shared text —
verify this before planning the port. workflow-parity.md:51 says the step is "Conditional
security review — only when the diff matches the repo's risky-path list"
, and the
"Intentional per-repo deltas" table (:80) carries one row per repo:

Concern SahajCloud SahajAtlasWeb WeMeditateWeb
Security-review trigger paths access plugins, Clients/Managers, endpoints, storage, webhooks, payload.config api config, Widget entry, lexical/HTML sinks, deps, env, vite config server/, pages/preview/, wrangler/vite/sentry configs, scripts/, env files

So the change decomposes into two parts with different porting obligations:

  1. The regex in .claude/skills/finalize-pr/SKILL.md — SahajAtlasWeb-only. The siblings do
    not get these paths (they have no src/lib/shape/, no injected widget stylesheet).
  2. The deltas-table row in .claude/docs/workflow-parity.md — its SahajAtlasWeb cell
    summarises the list being widened, so it must be updated and the identical edit applied to
    the SahajCloud and WeMeditateWeb copies of that file
    , or the byte-identical invariant breaks
    and /sync-workflow reports drift on the next audit.

If the implementer concludes the summary cell is general enough not to need touching, that is an
acceptable outcome — but it must be stated explicitly in the report with the diff that proves the
three copies are still identical, not assumed.

Proposed changes

Acceptance criteria

  • The regex in .claude/skills/finalize-pr/SKILL.md matches src/lib/shape/path.ts,
    src/components/atoms/Link/, src/styles/globals.css, postcss.config.js, the two
    scripts/*-css-*.mjs / postcss-scope-widget.mjs files, and src/App.tsx
  • Demonstrated against real diffs: it fires for the docs(claude): refresh stale internal docs and small hygiene batch #100 branch and the fix(ui): scope widget css so it cannot restyle the host page #91 CSS-scoping
    branch, and does not fire for a locale-JSON-only or stories-only diff (paste the
    commands and their output in the report)
  • .claude/docs/workflow-parity.md:80's SahajAtlasWeb cell is accurate, or the report
    states why it needed no change
  • diff of .claude/docs/workflow-parity.md against both sibling copies shows no
    differences
    — output pasted in the report
  • If that file changed: a companion PR exists in SahajCloud and in WeMeditateWeb
    carrying the identical edit (link both in the report). These are acceptance criteria, not
    follow-ups — an un-ported edit leaves the invariant broken.
  • /sync-workflow's read-only audit reports no drift after the ports land
  • Lint + typecheck + pnpm test:run pass (no source change expected)
  • Implementation report written to
    .claude/reports/<this-issue-number>-widen-security-review-paths.md in the main checkout
    at /Users/devindra/Documents/Projects/SahajAtlasWeb (.claude/reports/.gitignore is *,
    so a worktree copy would be discarded)

Parallel implementation

This ticket owns these files; no other ticket in this batch touches them:

  • .claude/skills/finalize-pr/SKILL.md
  • .claude/docs/workflow-parity.md (here and the two sibling repos' copies)

Do not edit .claude/skills/finalize-pr/pr-template.md, .claude/skills/draft-ticket/,
.claude/docs/{architecture,environment}.md or .claude/rules/* — those are owned by the
accent/doc-sweep ticket in this batch. Nothing under src/ changes.

Files affected

  • .claude/skills/finalize-pr/SKILL.md (:78-79)
  • .claude/docs/workflow-parity.md (:80) — plus the SahajCloud and WeMeditateWeb copies

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Hold Until

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions