Skip to content

feat(security): a Detections page for audit log detections - #2534

Open
Makisuo wants to merge 3 commits into
audit-trail/detectionsfrom
audit-trail/detections-page
Open

Makisuo wants to merge 3 commits into
audit-trail/detectionsfrom
audit-trail/detections-page

Conversation

@Makisuo

@Makisuo Makisuo commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Fifth layer of the unified audit log, on top of #2532: the Detections page. An org admin can now create the alerts the previous layer made possible.

What it adds

  • Detections in the Security hub rail, under Audit log (/security/detections). Admins only, with the same three access states as the audit log: asking, allowed, and an admins-only notice.
  • The list. Each row says what the detection matches in words, when it fires ("5 or more in 10 minutes"), its severity and who it notifies. A detection that notifies no one is marked, because it opens incidents nobody is told about. The switch, edit and delete act on the API's answer; nothing is flipped optimistically. Delete says that the detection's incidents go with it.
  • The empty state is the on-ramp. Five ready-made detections (member added or removed, permission or role changed, credential changed, a burst of refused requests, repeated sign-in failures). Choosing one opens the editor filled in; nothing is created until it is saved. The same starting points are in the editor's "Start from" select.
  • The editor is a form page like the SLO and uptime monitor editors, with the same destination picker. It checks the request against the API's own schema before sending and shows the server's message for a duplicate name, an unknown destination or the cap.
  • From the audit log. With filters applied, "Alert on these events" opens the editor with the platform, category and outcome carried over. The actor filter is not carried, and the label says so ("from any actor"): a detection cannot name a person.
  • Docs: a section on the alert rules page saying what a detection is, who can create one and what members see.

The page states once what the backend guarantees: every member can see a detection's name and that it fired; only org admins see the events it counted.

Screenshots

The list list
No detections yet empty
New detection editor
The server refuses a duplicate name error
A member member
Light theme light
Phone width

Audit log with filters applied. The "before" is this build with the control switched off, so its rail already shows the new entry.

Before After
before after

Verified

  • Web: the lab, the Security pages, the routes and the sample-URL list, 36 files and 456 tests. The two new suites have 19 tests (list) and 17 (editor): the access states, what each row says, the on-ramp opening a prefilled editor, create and edit against a stubbed API, the toggle, delete with confirmation, the server's invalid message, and the audit log control carrying the filters.
  • bun run --cwd apps/web typecheck, ui:index:check and ui:patterns:check pass. oxlint -c .oxlintrc.effect.json is clean on the changed files.

Not verified: the page has only run against lab fixtures, not a signed-in app with a real API. The delete dialog and the open destination menu are covered by scene tests but have no screenshot.

Known rough edges, left as they are: on a phone the severity badge wraps under the condition, so rows are tall; a failed load still shows the "New detection" button.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

The Security hub lists the org's detections under Activity, with a switch that saves on toggle, edit and a confirmed delete. With none set up the page offers five ready-made ones. The editor is a form page in the shape of the SLO editor, with the same destination picker, and the audit log opens it prefilled from its platform, category and outcome filters. The audit log's label maps and access check move to the hub's kit so both pages share them.
Lab states for the list, the empty on-ramp, the member view, a failed load, and the editor new, from a template, on an existing detection and with a server error, plus a filtered audit log. Scene tests cover the three access states, what each row says, the on-ramp, create and edit against the API's answers, the toggle, the confirmed delete, the invalid error's message and the audit log's prefill link.
@coderabbitai

coderabbitai Bot commented Nov 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d6a8b13a-3c89-4c0c-a8c4-7966db7fc566

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

@maple-review-bot

maple-review-bot Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Warning

The review of 3fac3b1 could not finish. Maple was restarted while it ran, more than once. Ask again with @maple review. Comment @maple-review-bot review to try again.

@Makisuo Makisuo added the preview:web Deploy a Workers-only PR preview (no ingest/Electric); see docs/pr-previews.md label Nov 12, 2026
@Makisuo
Makisuo deployed to pr-preview November 12, 2026 16:38 — with GitHub Actions Active
@Makisuo
Makisuo deployed to preview-tinybird November 12, 2026 16:38 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown
Contributor

🍁 Maple PR preview

The preview is ready:

Service Preview URL
Web app-pr-2534.maple.dev
API api-pr-2534.maple.dev

Web-only preview (preview:web): seeded demo data, no ingest gateway or Electric sync. Add preview for the full stack.

Smoke test: passed

Sign in with the PR preview form on the sign-in page and the preview access key (PREVIEW_SIGNIN_KEY in Infisical), or run bun run preview:signin 2534 for a signed-in link.

Deployed from 3fac3b1 · View workflow run

@Makisuo
Makisuo deployed to pr-preview November 12, 2026 16:44 — with GitHub Actions Active

This branch was successfully deployed

2 active deployments
pr-preview — 3fac3b18 Deployed Nov 12, 2026 by Makisuo via End-to-end tests against the preview #11665
preview-tinybird — 3fac3b18 Deployed Nov 12, 2026 by Makisuo via branch #1234
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview:web Deploy a Workers-only PR preview (no ingest/Electric); see docs/pr-previews.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant