Skip to content

feat(audit): add the FOG 1.6 Audit Log page and the audit.view permission - #203

Merged
fog-workflows[bot] merged 1 commit into
masterfrom
feat/audit-log-page
Nov 17, 2026
Merged

fog-workflows[bot] merged 1 commit into
masterfrom
feat/audit-log-page

Conversation

@mastacontrola

Copy link
Copy Markdown
Member

Closes #200. Part of the FOG 1.6 parity map (#155).

What

  • GET /audit: a read-only Audit Log page. It has the 1.6 grid (When, Who, Action, Permission, Outcome, Subject, From), outcome badges, and the "Audit entry" detail modal. It sits in a new "Logging" sidebar group.
  • POST /api/v1/audit/datatable: server-side rows, newest first (createdAt DESC, id DESC). The search is a case-insensitive substring match in the query. Each request reads at most 500 rows, and the length menu has no "All".
  • New permission stock.audit.view gates both. Admin roles get it, and other roles only when it is granted explicitly.

Access-control notes

  • The key is audit, not auditlog. So the generic /api/v1/:model routes still refuse the trail, even for an admin, and a test pins this.
  • An allowed datatable read writes no audit row (READ_ACTIONS). A denied read writes a denied row with permission audit.view.
  • Every server value renders as text. A smoke check sends a raw /api/v1/<b>…</b> request, so a real text row holds markup. The check then asserts the grid and the modal show it literally.

Also fixed

  • A JSON body with a toString object or a 1e20 start made this endpoint answer 500. POST /api/v1/host/pending/datatable had the same defect. Both now use the new api/helpers/datatables/parse-request.js, and each has a regression test. DataTables never sends those bodies, so no valid input changes behavior.

Review

Both reviewers ran on opus, because this change adds a permission. Round 1 had findings, and round 2 was clean on both axes. The implementation ran on sonnet.

Test

npm test (504 passing), npm run test:ui, npm run test:ui:prod.

🤖 Generated with Claude Code

…sion

Add the read-only Audit Log page (GET /audit) over the AuditLog rows that
the audit trail core writes, as FOG 1.6 AuditManagement shows them: the
When/Who/Action/Permission/Outcome/Subject/From grid, the outcome badges,
and the "Audit entry" detail modal. A "Logging" sidebar group holds it.

- New permission stock.audit.view gates the page and
  POST /api/v1/audit/datatable. The key is `audit`, not `auditlog`, so the
  generic :model routes stay closed on the trail (ADR 0003 updated).
- The datatable reads at most 500 rows per request and the length menu has
  no "All": the trail grows for the life of the install (1.6 bounds it in
  the query). Search is a case-insensitive substring match in the query;
  order is createdAt DESC, id DESC.
- An allowed datatable read writes no audit row (READ_ACTIONS).
- New shared helper datatables/parse-request parses the DataTables body
  without throwing. A JSON body with a toString object or a 1e20 start made
  both this endpoint and the pending-hosts datatable answer 500; the pending
  hosts endpoint now uses the helper too, and both get a regression test.
- waitFor and sentinel move to test/support/audit-wait.js.

Closes #200

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fog-workflows
fog-workflows Bot enabled auto-merge November 17, 2026 12:33
@fog-workflows
fog-workflows Bot added this pull request to the merge queue Nov 17, 2026
Merged via the queue into master with commit 6da7557 Nov 17, 2026
6 checks passed
@fog-workflows
fog-workflows Bot deleted the feat/audit-log-page branch November 17, 2026 12:50
mastacontrola added a commit that referenced this pull request Nov 17, 2026
#203 (the Audit Log page) added the Logging group at the same menu and
smoke-table positions as this branch's FOG Configuration entry. Keep both,
FOG Configuration (150) before Logging (170).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Add the FOG 1.6 Audit Log page and the audit.view permission

1 participant