Skip to content

fix: audit log types, anchor bucket retention check, dead code - #148

Merged
ndbroadbent merged 2 commits into
mainfrom
nathan/audit-cleanup
Oct 13, 2026
Merged

ndbroadbent merged 2 commits into
mainfrom
nathan/audit-cleanup

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Fixes #139, fixes #140, fixes #141.

Audit log types (#139)

An admin action's audit entries took their action type from a guess based on the action name, so the same request could land under different types. Now:

  • Action type: the scope of the route's permission (gateway or security). Requests outside the route table fall back to gateway.
  • Resource type: the action's prefix (user.lock → user).

Elsewhere, literal type strings now use the audit.ActionType* constants.

The audit page filters by convox, gateway, auth and security, and lists the resource types the gateway writes.

Anchor bucket retention (#140)

The anchor writer used to set a retention on each object it wrote. Nothing checked that the bucket itself would keep anchors for as long as AUDIT_ANCHOR_RETENTION_DAYS claims. Now:

  • At startup the gateway reads the anchor bucket's Object Lock configuration. It refuses to start unless the bucket locks objects in COMPLIANCE mode for at least AUDIT_ANCHOR_RETENTION_DAYS. If the configuration can't be read, it also refuses to start.
  • audit verify runs the same check and fails the report on it.
  • The writer no longer sets a per-object retention; the bucket's default rule governs.

Upgrade note: the gateway's IAM role needs s3:GetBucketObjectLockConfiguration on the anchor bucket. Without it the new release won't start. The Terraform docs and the upgrade notes cover this.

Dead code (#141)

  • users.suspended is gone from the code; locking a user is the only way to disable an account. The column stays in the schema for one release because the previous release still selects it during a rollout. Drop the users.suspended column #147 drops it.
  • Removed the plaintext column-encryption sweep. Gateways upgrading from v0.1.7 or earlier must go through v0.1.10 first; the upgrade notes say so.
  • Removed the suspicious-activity alert. Nothing sent it.
  • Removed the dev email outbox, deleteUserAuditLogs, and the proxy's destructive-command switch.
  • Removed RBAC resources and actions with no routes: cert, registry, resource, keyroll, add and remove. Their permission rows are gone from the docs.
  • Removed Convox command catalog entries with no matching command in the CLI. I checked every remaining entry against the built CLI.
  • checkWebAuthnAvailability is used, despite what the issue says. I removed its recover wrapper instead.
  • Removed commented-out code from the rack page.

Testing

  • task go:lint: 0 issues.
  • Go unit tests: 1313 passed.
  • Web lint, typecheck and unit tests: 159 passed.
  • Docs build: no broken links.
  • New tests:
    • auditEntryTypes
    • the bucket retention check (modes, years vs days, missing rule, missing Object Lock, read failure)
    • audit verify failing on a bucket with too short a retention

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Security

    • Audit-anchor storage is checked at startup and during verification. The bucket must use COMPLIANCE-mode default retention of at least the configured number of days (400 by default).
    • Plaintext stored secrets are no longer encrypted automatically; plaintext values cause read errors. Upgrades from before v0.1.7 must pass through v0.1.10 before moving to later releases.
    • Account access checks no longer treat suspension as a rejection condition; locked or deleted accounts remain restricted.
  • Audit Logs

    • Audit entries now use permission-scope categories, including Gateway and Security, with updated labels and filters.
  • CLI

    • Several commands, including service, resource, certificate, and registry commands, are no longer available.

Fixes #139, fixes #140, fixes #141.

Audit log types (#139): an admin action's entries take the action type of
the route's permission scope (gateway or security) and the resource type of
the action's prefix, instead of a guess from the action name. The audit page
filters by convox/gateway/auth/security and lists the resource types the
gateway writes.

Anchor bucket retention (#140): the gateway reads the anchor bucket's Object
Lock configuration at startup and refuses to start unless it locks objects in
COMPLIANCE mode for at least AUDIT_ANCHOR_RETENTION_DAYS. audit verify runs the
same check. The anchor writer no longer sets a per-object retention; the
bucket default governs. The gateway's IAM role needs
s3:GetBucketObjectLockConfiguration on the anchor bucket.

Dead code (#141): removed users.suspended from the code (the column is dropped
in a later release, #147), the plaintext column-encryption sweep (upgrade
through v0.1.10 first), the unused suspicious-activity alert, the dev email
outbox, the proxy's destructive-command switch, unused RBAC resources and
actions, and Convox command catalog entries with no CLI command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@deepsource-io

deepsource-io Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 6e60194...48f1807 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
JavaScript Oct 13, 2026 2:58a.m. Review ↗
Go Oct 13, 2026 2:58a.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

…urce

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 53f32ebb-df03-47e7-aedb-a5c839c3a39a
📥 Commits

Reviewing files that changed from the base of the PR and between 6e60194 and 48f1807.

⛔ Files ignored due to path filters (2)
  • internal/gateway/openapi/generated/swagger.json is excluded by !**/generated/**
  • web/src/api/types.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing (84)
  • cmd/gateway/main.go
  • convox.yml
  • docs/src/content/docs/concepts/mfa-security.mdx
  • docs/src/content/docs/configuration/environment-variables.mdx
  • docs/src/content/docs/deployment/terraform/aws-infrastructure.mdx
  • docs/src/content/docs/deployment/terraform/s3-worm-storage.mdx
  • docs/src/content/docs/operations/upgrades.mdx
  • docs/src/content/docs/security/authentication/api-tokens.mdx
  • docs/src/content/docs/security/authentication/index.mdx
  • docs/src/content/docs/security/authentication/sessions.mdx
  • docs/src/content/docs/security/compliance/audit-trail.mdx
  • docs/src/content/docs/security/rbac/permissions.mdx
  • docs/src/content/docs/security/rbac/roles.mdx
  • docs/src/content/docs/user-guide/web-ui/audit-logs.mdx
  • internal/cli/gateway_test_auth.go
  • internal/cli/mfa_verify.go
  • internal/convox/commands.go
  • internal/gateway/CLAUDE.md
  • internal/gateway/app/column_upgrade.go
  • internal/gateway/app/column_upgrade_test.go
  • internal/gateway/app/setup.go
  • internal/gateway/audit/constants.go
  • internal/gateway/auditverify/anchor_checks.go
  • internal/gateway/auditverify/anchors_test.go
  • internal/gateway/auditverify/bucket_retention.go
  • internal/gateway/auditverify/bucket_retention_test.go
  • internal/gateway/auditverify/verify.go
  • internal/gateway/auth/service.go
  • internal/gateway/auth/session_manager.go
  • internal/gateway/colcrypt/colcrypt.go
  • internal/gateway/colcrypt/colcrypt_test.go
  • internal/gateway/db/column_encryption.go
  • internal/gateway/db/column_encryption_test.go
  • internal/gateway/db/sessions_lookup.go
  • internal/gateway/db/types.go
  • internal/gateway/db/users.go
  • internal/gateway/db/users_scan.go
  • internal/gateway/email/postmark.go
  • internal/gateway/handlers/admin_audit.go
  • internal/gateway/handlers/admin_audit_types_test.go
  • internal/gateway/handlers/admin_users_list.go
  • internal/gateway/handlers/api_handler_env.go
  • internal/gateway/handlers/auth_helpers.go
  • internal/gateway/handlers/auth_mfa_audit.go
  • internal/gateway/handlers/deploy_approval_helpers.go
  • internal/gateway/jobs/audit/anchor_latest_test.go
  • internal/gateway/jobs/audit/anchor_window_test.go
  • internal/gateway/jobs/audit/anchor_writer.go
  • internal/gateway/jobs/audit/anchor_writer_test.go
  • internal/gateway/jobs/audit_jobs.go
  • internal/gateway/jobs/client.go
  • internal/gateway/jobs/email/suspicious_activity.go
  • internal/gateway/jobs/email/suspicious_activity_test.go
  • internal/gateway/jobs/verifyaudit/anchor_cache.go
  • internal/gateway/jobs/verifyaudit/helpers_test.go
  • internal/gateway/middleware/authorize.go
  • internal/gateway/proxy/audit.go
  • internal/gateway/proxy/env.go
  • internal/gateway/proxy/handler.go
  • internal/gateway/proxy/rack_params.go
  • internal/gateway/proxy/websocket.go
  • internal/gateway/rbac/action_string.go
  • internal/gateway/rbac/constants.go
  • internal/gateway/rbac/mfa_coverage_test.go
  • internal/gateway/rbac/mfa_requirements.go
  • internal/gateway/rbac/mfa_requirements_test.go
  • internal/gateway/rbac/rbac.go
  • internal/gateway/rbac/rbac_test.go
  • internal/gateway/rbac/resource_string.go
  • internal/gateway/security/notifier.go
  • internal/gateway/security/notifier_test.go
  • internal/gateway/testutil/fakes3/fakes3.go
  • web/e2e/manage.spec.ts
  • web/src/api/openapi.json
  • web/src/api/schemas/dbAuditLog.ts
  • web/src/api/schemas/dbUser.ts
  • web/src/components/audit-logs/badges.tsx
  • web/src/components/audit-logs/utils.ts
  • web/src/pages/audit-page.test.tsx
  • web/src/pages/audit/utils.ts
  • web/src/pages/rack-page.tsx
  • web/src/pages/users-page.test.tsx
  • web/src/pages/users-page.tsx
  • web/src/pages/users/user-utils.ts
 _________________
< Shell we dance? >
 -----------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@ndbroadbent
ndbroadbent merged commit 0497e53 into main Oct 13, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant