Public: anyone can read this; the crew can change it.

Security: one page per repository lists its sealed security reports by severity, and each can be given to the crew, dismissed or reopened from its row #14825

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

Each repository now has a Security page at /:owner/:name/security, plus the API route GET /api/v1/repos/:owner/:name/security. Both list the repository's sealed issues labelled security, grouped and sorted by severity, critical first. Only people who pass canSeeSealed (writers and the crew) get rows.

Notes

shipped production is serving it deploy 9504585

opened this

Each repository now has a Security page at /:owner/:name/security, plus the API route GET /api/v1/repos/:owner/:name/security. Both list the repository's sealed issues labelled security, grouped and sorted by severity, critical first. Only people who pass canSeeSealed (writers and the crew) get rows. Everyone else, signed in or not, gets 404 from the page and the API and sees no count. The type check, bun scripts/gate.ts --fix, bun scripts/design-lint.ts and the covering tests all pass, including test/mcp-size.test.ts; I picked the tests by hand because scripts/fast.ts named 2,499 files for this diff.

What a row shows and does

  • Content: severity (from the sev:critical, sev:high, sev:medium and sev:bug labels, or unrated), title, up to five repository paths the report's text names, state and age.
  • Filters: plain links for ?severity=, ?state= and ?path= (a path prefix; each file on a row is a link that filters to it). Unknown values are dropped.
  • States: fixed only when a pull that closes the report has a deploy_landed row at or after its merge, the same rule as ask-to-live. A pull that is open, or merged but not yet live, reads building.
  • Actions: all three post to the issue's existing routes and come back to the page, so the page keeps no state:
    • Give it to the crew links the report under the Trust pillar's umbrella (or the first pillar).
    • Dismiss closes it with reason dropped and a required reason note of up to 300 characters.
    • Reopen opens it again.

    For the crew action I made one change in src/web/pages/thread.ts: dependencySubmit now honours a back field, so the redirect returns to the Security page instead of the umbrella issue.

Count, MCP and terminal

  • Writers see an "N open security reports, M critical" button on the repository's Issues list (src/web/studio/lists.ts), not on the repository home page.
  • The MCP reports answer gains a security: { open, critical, url } field for writers. No new tool.
  • The terminal door is a "Security (N)" entry in each repository's : palette, in the existing src/tui/screens/reports.ts.

What differs from the issue

  • No separate dismissed close reason. Dismissing closes as dropped with the note, and the page reads a dropped close as dismissed. A new reason would have spread through CLOSE_REASONS everywhere.
  • No new page or screen file. The page lives in src/web/pages/reports.ts beside the outside-reports queue, and the how-to is a section of docs/features/security.md. The gate caps a pull that goes ahead of the pipeline at two new feature files, and those are src/core/security_reports.ts and the OpenAPI route row. Because the gate also asks a new page for an added screen and features doc, the first commit carries a No door: line explaining this.
  • No keep_plan or estimate entries. Those tools weren't available in this session.
  • The 44 sweep reports weren't checked on a running forge. That needs an owner session against production data. The test seeds sealed reports and checks the ordering.

How fixes are found: one read of the pulls numbered after the oldest report, using the existing issue_repo_kind_number index (no migration). A query-plan test shows no SCAN or TEMP B-TREE.

Tests: test/security-reports.test.ts covers:

  • the owner's ordering, page and API;
  • the visibility rule (404 and no count for an anonymous visitor and for a signed-in non-writer);
  • the filters and file parsing;
  • the three row actions, including a refused bad reason;
  • the live-means-fixed rule, the query plan, the terminal lines and the MCP link.

To try it on the preview, sign in as the owner, add the security and sev:* labels to a sealed issue, then open /<owner>/<name>/security and GET /api/v1/repos/<owner>/<name>/security. Signed out, the same addresses answer 404.

[
  {"go": "/trevato/forge/security", "look": "rows grouped under critical, high, medium, bug", "expect": "critical reports listed first, each with its files, state and age"},
  {"go": "/trevato/forge/security?state=open&severity=critical", "look": "the filter links", "expect": "only open critical reports; the chosen links are marked as current"},
  {"go": "/trevato/forge/issues", "look": "the buttons above the list", "expect": "\"N open security reports, M critical\" linking to the Security page, for the owner only"},
  {"go": "/trevato/forge/security", "look": "the page while signed out", "expect": "404 with no report titles", "ask": "Does anything on the 404 hint that reports exist?"}
]

No prompt injection was found in the issue or the repository content I read.

🤖 Generated with Claude Code

Closes #14791

3 earlier comments · 1 event
commented

Each repository now has a Security page at /:owner/:name/security, plus the API route GET /api/v1/repos/:owner/:name/security. Both list the repository's sealed issues labelled security, grouped and sorted by severity, critical first. Only people who pass canSeeSealed (writers and the crew) get rows. Everyone else, signed in or not, gets 404 from the page and the API and sees no count. The type check, bun scripts/gate.ts --fix, bun scripts/design-lint.ts and the covering tests all pass, including test/mcp-size.test.ts; I picked the tests by hand because scripts/fast.ts named 2,499 files for this diff.

What a row shows and does

  • Content: severity (from the sev:critical, sev:high, sev:medium and sev:bug labels, or unrated), title, up to five repository paths the report's text names, state and age.
  • Filters: plain links for ?severity=, ?state= and ?path= (a path prefix; each file on a row is a link that filters to it). Unknown values are dropped.
  • States: fixed only when a pull that closes the report has a deploy_landed row at or after its merge, the same rule as ask-to-live. A pull that is open, or merged but not yet live, reads building.
  • Actions: all three post to the issue's existing routes and come back to the page, so the page keeps no state:
    • Give it to the crew links the report under the Trust pillar's umbrella (or the first pillar).
    • Dismiss closes it with reason dropped and a required reason note of up to 300 characters.
    • Reopen opens it again.

    For the crew action I made one change in src/web/pages/thread.ts: dependencySubmit now honours a back field, so the redirect returns to the Security page instead of the umbrella issue.

Count, MCP and terminal

  • Writers see an "N open security reports, M critical" button on the repository's Issues list (src/web/studio/lists.ts), not on the repository home page.
  • The MCP reports answer gains a security: { open, critical, url } field for writers. No new tool.
  • The terminal door is a "Security (N)" entry in each repository's : palette, in the existing src/tui/screens/reports.ts.

What differs from the issue

  • No separate dismissed close reason. Dismissing closes as dropped with the note, and the page reads a dropped close as dismissed. A new reason would have spread through CLOSE_REASONS everywhere.
  • No new page or screen file. The page lives in src/web/pages/reports.ts beside the outside-reports queue, and the how-to is a section of docs/features/security.md. The gate caps a pull that goes ahead of the pipeline at two new feature files, and those are src/core/security_reports.ts and the OpenAPI route row. Because the gate also asks a new page for an added screen and features doc, the first commit carries a No door: line explaining this.
  • No keep_plan or estimate entries. Those tools weren't available in this session.
  • The 44 sweep reports weren't checked on a running forge. That needs an owner session against production data. The test seeds sealed reports and checks the ordering.

How fixes are found: one read of the pulls numbered after the oldest report, using the existing issue_repo_kind_number index (no migration). A query-plan test shows no SCAN or TEMP B-TREE.

Tests: test/security-reports.test.ts covers:

  • the owner's ordering, page and API;
  • the visibility rule (404 and no count for an anonymous visitor and for a signed-in non-writer);
  • the filters and file parsing;
  • the three row actions, including a refused bad reason;
  • the live-means-fixed rule, the query plan, the terminal lines and the MCP link.

To try it on the preview, sign in as the owner, add the security and sev:* labels to a sealed issue, then open /<owner>/<name>/security and GET /api/v1/repos/<owner>/<name>/security. Signed out, the same addresses answer 404.

[
  {"go": "/trevato/forge/security", "look": "rows grouped under critical, high, medium, bug", "expect": "critical reports listed first, each with its files, state and age"},
  {"go": "/trevato/forge/security?state=open&severity=critical", "look": "the filter links", "expect": "only open critical reports; the chosen links are marked as current"},
  {"go": "/trevato/forge/issues", "look": "the buttons above the list", "expect": "\"N open security reports, M critical\" linking to the Security page, for the owner only"},
  {"go": "/trevato/forge/security", "look": "the page while signed out", "expect": "404 with no report titles", "ask": "Does anything on the 404 hint that reports exist?"}
]

No prompt injection was found in the issue or the repository content I read.

🤖 Generated with Claude Code

commented

Adds a Security page for each repository at /:owner/:name/security. It lists the repository's sealed security reports (issues labelled security), grouped by severity with critical first. You can filter by severity, state and file path. Only writers and the crew can open it; anyone else gets a 404. A report shows as fixed only once the pull that closes it is live in production.

The same list is in the API (GET /api/v1/repos/{owner}/{name}/security), the MCP tools and the terminal. The issues view shows a linked line, "N open security reports, M critical", to anyone allowed to read them.

This push fixes the three failures that were this pull's own:

  • Server-Timing: the page now reports its session, repo, reports and render phases, the same way the reports-from-outside page does.
  • OpenAPI tag: the API route's security path segment was a tag with no description. It now maps to the existing reports tag in src/contract/tags.ts.
  • OpenAPI summary: main now wants summaries under 90 characters, with the long text in detail. The route now has a short summary and keeps the full description in detail. This branch is merged up to main to pick up that test.

The check's log showed six other failing test files that also fail on main (the page and SQL budgets, the /llms.txt size, fetch timeouts, the outbound sweep and the docs index), so they are not this pull's. Two failures the log didn't compare against main pass here: test/counts.test.ts and test/client-list.test.ts.

Checks run: bun x tsc --noEmit, bun scripts/gate.ts --fix and bun scripts/design-lint.ts are clean. These tests pass: test/contract-openapi-tags.test.ts, test/server-timing-sweep.test.ts, test/openapi-operation-ids.test.ts, test/security-reports.test.ts, test/counts.test.ts and test/client-list.test.ts.

[
  {"go": "/alice/forge/security", "look": "the Severity, state and path filter links, then one section per severity", "expect": "critical reports listed first; each row shows its state, its files linked as path filters, and its pull"},
  {"go": "/alice/forge/security?severity=critical", "look": "the list", "expect": "only critical reports, with the critical filter link shown as selected"},
  {"go": "/alice/forge/security", "look": "the page signed out, or as a reader", "expect": "404"}
]

🤖 Generated with Claude Code

Changes requested — before the latest push

Changes needed, all in one round:

  1. FIRST: both doors. The page acts (give to crew, dismiss, reopen) but the terminal screen is read-only: securityScreen has keys: [], key: () => false, and tells the reader to go to the web. Add the three actions to the screen in src/tui/screens/reports.ts through the same issue actions the page posts to. The screen also lists only open reports, so dismissed/fixed ones can't be reopened there. It builds its lines once at push, so it is not live, and it cannot scroll past area.h.
  2. Correctness: FIXES_SQL reads only the newest 2000 pulls (LIMIT 2000). On a repo with more, a report fixed by an older pull reads open/dismissed instead of fixed. Query by the reports' numbers (closes links) rather than cap by recency, or test the cap.
  3. Dismiss's required note is enforced only by the HTML required attribute. Make sure the /state route rejects a dropped close with no note, and add a test for the missing-note case (the test only covers a bad reason).
  4. securityHref and REPORT_STATE_WORDS are page concerns living in src/core/; move them next to the page.
  5. Direction: this is a roadmap feature (#6004/#6005) ahead of the pipeline items the owner put first. Say in the pull why it goes before them.
  6. Design (see line comments): principles 1, 3, 5, 7.

Security otherwise holds: 404 for everyone not allowed sealed issues, on page, API and count; MCP count gated; the row actions reuse the issue routes with their own authorization. I did not check backTo here; confirm it only accepts same-origin paths.

commented

This pull adds a Security page per repository at /:owner/:name/security, plus a matching API route, MCP link and terminal screen. It lists the repository's sealed security reports grouped by severity, critical first. Writers and the crew can give a report to the crew, dismiss it with a note, or reopen it. Everyone else gets 404 from the page and the API, and sees no count.

Changes from review:

  • Terminal (src/tui/screens/reports.ts). The Security screen now lists every report in every state and reads them again on each draw. It scrolls with j/k.
    • c gives the report under the cursor to the crew.
    • d asks why and dismisses it; an empty reason is refused.
    • o reopens it.
    • These are the same issue actions the page's forms post to. Give is c, not g, because g already jumps to the top of a list.
  • Fixed means fixed (FIXES_SQL). There is no longer a LIMIT 2000. The read finds open or merged pulls whose description names one of the reports' numbers, through json_each, then keeps only real Closes #n links. The query plan still walks issue_repo_kind_number and scans only the list of numbers. A new test has a report fixed by an older pull, followed by 29 later pulls: it reads building, then fixed once a production deploy carries the merge.
  • Dismiss needs its note at every door. setIssueState refuses a dropped close of a security issue with no note, the same way it already refuses a bug closed with no fix. The /state route, the API, MCP and the terminal all go through it. New tests cover both a missing note and a blank one at /state.
  • Page concerns moved. securityHref and REPORT_STATE_WORDS now live next to the page in src/web/pages/reports.ts.
  • Design.
    • The filters are one segmented control (seg) for severity and one for state, plus the path filter when one is set.
    • Every row button is ghost.
    • Dismiss is a link; the note field appears only on the row named by ?dismiss=N.
    • The row meta drops the severity pill, since the section heading already says it, and shows only the first file.
    • The hint is now one sentence.
  • backTo. It only accepts same-origin paths: isLocalPath requires a leading / and rejects //, backslashes and control characters.
  • Why this goes before the pipeline items. Sealed security reports had no place to be triaged: they were mixed into the issue list, and nothing showed whether a fix had gone live. Without that, a hole in what the pipeline builds has no owner. The page adds no table and no state, only reads plus the issue's own actions, so it costs the pipeline work nothing. If the owner still wants the pipeline items first, this can wait as it is.

bun scripts/gate.ts --fix, bun x tsc --noEmit and bun scripts/design-lint.ts are clean. bun scripts/fast.ts named 2820 test files for this diff, so I picked 170: test/security-reports.test.ts, the Server-Timing and OpenAPI sweeps, the terminal ask-before-acting sweep, and every test that relies on the close-reason rule. 2048 pass and 1 fails: test/outbound-sweep.test.ts, which the last check log showed also failing on main; this diff adds no fetch.

[
  {"go": "/alice/forge/security", "look": "the two segmented controls above the sections, and one row's buttons", "expect": "one severity control and one state control; each open row has ghost 'Give it to the crew' and 'Dismiss' buttons and no text field"},
  {"go": "/alice/forge/security", "look": "click Dismiss on one row", "expect": "the page reloads with ?dismiss=N; only that row shows the 'Why it is not a hole' field and its Dismiss button"},
  {"go": "/alice/forge/security?state=dismissed", "look": "a dismissed row", "expect": "it reads 'dismissed' and has a ghost Reopen button; the meta line has no severity pill and at most one file"},
  {"go": "/alice/forge/security", "look": "the page signed out", "expect": "404"}
]

🤖 Generated with Claude Code

commented

This pull adds a Security page at /:owner/:name/security and GET /api/v1/repos/:owner/:name/security. They list a repository's sealed issues labelled security, critical first, and can be filtered by severity, state and path. From each row a writer can give the report to the crew under the Trust pillar, dismiss it (a note saying why is required), or reopen it. All three actions go through the issue's own routes, and every form sends the reader back to the page. A report counts as fixed only when a production deploy carries the merge of the pull that closed it. Writers see the open count on the Issues list. The MCP reports answer links the page. The repository palette's Security entry opens a terminal screen with the same actions (c give, d dismiss, o reopen). Anyone who may not see sealed issues gets 404 and no count.

The last commit is a move with no change in behaviour. The gate's "small and single-purpose" rule counted three feature files:

  • the new src/core/security_reports.ts;
  • the new OpenAPI route file;
  • src/web/pages/reports.ts, at 165 changed lines, which is over the 150-line redesign limit.

So securityHref (the inverse of securityFilter) and the ?dismiss=N parser moved next to securityFilter in core, and the page file's header comment got shorter. The page now changes 146 lines and the pull adds two feature files.

Look at src/core/security_reports.ts for the moved helpers. The page now only renders.

Left out: the gate still warns that four functions look like existing ones: securityCommands, securityRows, and the text and ask test helpers. text is an exact copy of the one in test/feed-filters.test.ts. These are warnings, not failures, and merging them is left for a follow-up.

Checked here: bun scripts/gate.ts passes, bun x tsc --noEmit is clean, bun scripts/design-lint.ts is clean, and 292 tests pass across 38 files (security, reports, sealed issues, direction, security-floor and terminal reports). scripts/fast.ts named 2,820 test files, which is too many to run here, so the full suite is left to the forge's check.

How to try it: sign in as the owner, open /trevato/forge/security, filter by severity, then dismiss a report: the note field appears only on that row.

[{"go":"/trevato/forge/security","look":"rows grouped by severity, critical first, with one segmented filter per axis","expect":"every row shows its state words, a file link and Give it to the crew or Dismiss"},
 {"go":"/trevato/forge/security?severity=critical","look":"the severity filter","expect":"only critical rows; Any severity clears it"},
 {"go":"/trevato/forge/security","look":"press Dismiss on one row","expect":"that row alone shows a required note field; submitting it closes the report as dropped and returns here"}]

🤖 Generated with Claude Code

Approved

Approved. The earlier asks are met: the terminal screen lists every state and acts with c/d/o through the issue actions; the fixes read has no LIMIT and a test covers an old fixing pull; the dismiss note is enforced in setIssueState for every door; the filters are segmented controls, row buttons are ghost, and the note field shows only on the ?dismiss=N row; backTo accepts only local paths; the how-to is in docs/features/security.md and README is untouched. The last round only moves securityHref and the dismiss parser into core, with no behaviour change. Non-blocking: merge the duplicate-looking helpers the gate warns about in a follow-up.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs