Skip to content

feat(audit): name deleted resources and record no-op deletes - #5609

Merged
krishicks merged 1 commit into
mainfrom
feat/2911-name-deleted-resources/krishicks
Nov 16, 2026
Merged

krishicks merged 1 commit into
mainfrom
feat/2911-name-deleted-resources/krishicks

Conversation

@krishicks

Copy link
Copy Markdown
Contributor

Summary

Gateway mutation records name the method and outcome of a delete, but not what it deleted, and a delete of a resource that was already gone looks the same as one that removed it. Delete records now name the workspace and the requested resource, and say when a delete found nothing to remove or is still in progress.

Stacked on #5606; review only the last commit until that merges.

Related Issue

Part of #2911

Changes

  • grpc/mutation_audit.rs adds deletion(), which records the selected workspace and the requested resource by name before the handler runs, so rejected and cancelled deletes still name their target.
  • DeletionOutcome::AlreadyAbsent records status_detail: no_op:already_absent, and Accepted records accepted. An accepted sandbox delete also records the sandbox ID as uid.
  • Hooks cover DeleteSandbox, DeleteSandboxTemplate, DeleteService, DeleteProvider, DeleteProviderProfile, DeleteProviderRefresh, DeleteWorkspace, and RemoveWorkspaceMember.
  • auth/audit/test_support.rs adds audited_mutation and cancelled_mutation, which run a real handler inside the audit scope.
  • Docs: status_detail covers no_op:, and resources names what the call acted on.

Before / after

Real OCSF output from the gateway's delete handlers, called by the test user in workspace default:

Call → result Before (#5606) After
DeleteSandbox agent-01, allow_missing, absent Delete, Success, no status_detail, no resources Delete, Success, no_op:already_absent; workspace:default, sandbox:agent-01
DeleteSandbox agent-02, deletion runs asynchronously Delete, Success, no status_detail, no resources Delete, Success, accepted; workspace:default, sandbox:agent-02 with its ID as uid
DeleteProvider github, absent Delete, Failure, rejected:not_found, no resources Same outcome; workspace:default, provider:github

Testing

  • Checks appropriate to the affected code and behavior pass
  • Unit tests added: each delete hook names its target and records no_op:already_absent for an absent resource; rejected, cancelled, accepted, and completed deletes
  • E2E tests added/updated (not applicable)

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)

@copy-pr-bot

copy-pr-bot Bot commented Nov 16, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions

Copy link
Copy Markdown

@krishicks
krishicks added this pull request to stack #5610 November 16, 2026 17:19
@krishicks
krishicks force-pushed the feat/2911-name-deleted-resources/krishicks branch from dc9f24c to 859548d Compare November 16, 2026 18:51
Base automatically changed from feat/2911-record-gateway-mutations/krishicks to main November 16, 2026 19:40
@krishicks
krishicks force-pushed the feat/2911-name-deleted-resources/krishicks branch from 859548d to fb5b6f1 Compare November 16, 2026 19:41
@krishicks
krishicks marked this pull request as ready for review November 16, 2026 19:43
TaylorMutch
TaylorMutch previously approved these changes Nov 16, 2026

@TaylorMutch TaylorMutch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. The earlier feedback about including requested deletion targets in authorization-denial events is optional and non-blocking; this approval stands even if that suggestion is not adopted.

A gateway mutation record named the method and outcome of a delete but not
what it deleted, and a delete of a resource that was already gone looked the
same as one that removed it.

Delete records now list the selected workspace and the requested resource
by name, with the sandbox ID once a sandbox delete is accepted. A delete
that found nothing to remove records status_detail no_op:already_absent, and
an asynchronous sandbox delete records accepted. Rejected, cancelled, and
handler-denied deletes still name the requested resource.

Refs #2911

Signed-off-by: Kris Hicks <khicks@nvidia.com>
@krishicks
krishicks force-pushed the feat/2911-name-deleted-resources/krishicks branch from fb5b6f1 to b32c304 Compare November 16, 2026 22:20
@krishicks
krishicks added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit cb85c09 Nov 16, 2026
93 of 95 checks passed
@krishicks
krishicks deleted the feat/2911-name-deleted-resources/krishicks branch November 16, 2026 23:00
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.

2 participants