Skip to content

Add audit log for policy enforcements #3912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

emcfarlane
Copy link
Contributor

This adds audit log events for policy enforcements. The resource type is either server, owner (user/organization) or module. This aligns with current policy event types like EVENT_TYPE_SERVER_UNIQUENESS_POLICY_ENABLED that apply to the server resource.

@emcfarlane emcfarlane requested a review from bufdev as a code owner July 4, 2025 15:37
Copy link
Contributor

github-actions bot commented Jul 4, 2025

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJul 9, 2025, 8:13 PM

EVENT_TYPE_POLICY_ENFORCEMENT_CREATED = 74;
EVENT_TYPE_POLICY_ENFORCEMENT_DELETED = 75;
EVENT_TYPE_POLICY_ENFORCEMENT_POLICY_CHANGED = 76;
EVENT_TYPE_POLICY_ENFORCEMENT_INCLUDE_TARGETS_CHANGED = 77;
Copy link
Member

Choose a reason for hiding this comment

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

Wondering if we should have just a "targets changed" event, and whenever/if we add "exclude targets", it's just a few more fields we add to the appropriate events.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like it, fixed!

Comment on lines +998 to +999
// policy_id is the id of the policy that is enforced.
string policy_id = 2;
Copy link
Member

Choose a reason for hiding this comment

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

We need policy_ref too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

Comment on lines +1012 to +1015
// old_policy_id is the id of the old policy.
string old_policy_id = 2;
// new_policy_id is the id of the new policy.
string new_policy_id = 3;
Copy link
Member

Choose a reason for hiding this comment

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

Same here, missing the refs. It's possible that the change is only that:

- buf.build/acme/some-policy:foo
+ buf.build/acme/some-policy:bar

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.

3 participants