Repository navigation
feat: audit feedback writes from the apiserver - #30
Open
mattdjenkinson wants to merge 1 commit into
Open
mattdjenkinson wants to merge 1 commit into
mattdjenkinson wants to merge 1 commit into
Conversation
Milo proxies requests to the feedback API without their bodies, so the apiserver now runs its own audit backend and is the record for writes to its API. - An audit-logging component adds the policy, a webhook config for activity's Vector in activity-system, and the apiserver flags and mounts. The core-control-plane overlay includes it. - Writes to posts, releases, changelog entries, votes, subscriptions and feedback sources are logged at RequestResponse, which the search indexer needs. Submissions, security reports, uploads and PostQuery are logged at Metadata. Reads are left to Milo. - Side effects are recorded as annotations on the request that caused them: subscribed, votes-moved-to, vote-granted and security-report. - A test evaluates the shipped policy with the apiserver's own evaluator. Part of datum-cloud/enhancements#943. Closes #11.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feedback writes now reach the audit log with their bodies, so activity has a full record and the search indexer can index posts. Private content (submissions, security reports, uploads, draft feedback) is kept to metadata. Closes #11.
Stacked on #29 (authz), which is on #28 down to #16.
Why the apiserver audits itself
Milo proxies requests to
feedback.miloapis.comwithout their bodies, so its events carry only metadata, and the search indexer skips events without aresponseObject. As the design says, the feedback apiserver runs its own audit backend with the generic apiserver's--audit-policy-fileand--audit-webhook-config-fileand sends to the same Vector webhook as Milo.What's recorded
RequestResponseMetadataSide effects are written in the same transaction as the request that caused them (#7 to #9), so they're recorded as annotations on that request's event without exposing content:
feedback.miloapis.com/subscribed: a vote or a review followed a post for the user;feedback.miloapis.com/votes-moved-to: a merged post's votes moved;feedback.miloapis.com/vote-granted: a merge or a linked approval gave the submitter a vote (user/post);feedback.miloapis.com/security-report: the report a submission became, so the submission's metadata event links to it.Config
config/components/audit-loggingadds the policy and the webhook ConfigMaps, plus the flags (--audit-webhook-mode=batch, 10s initial backoff) and mounts. The core-control-plane overlay includes it. The webhook points athttps://vector-sidecar.activity-system.svc.cluster.local:8080/events, matching Milo's.For #13
feedback-audit-webhook-ca(keyca.crt), from the control-plane trust bundle Milo uses.level: Noneforcreate,update,patch,deleteanddeletecollectionongroup: feedback.miloapis.com. Otherwise each write is recorded twice, because activity's dedupe key includes the timestamp. Milo keeps logging reads.Testing
TestAuditPolicyloads the shipped policy into the apiserver's own evaluator and checks the level for 21 requests: every write path, every private kind and subresource, reads, and health endpoints.RequestResponsewith request and response objects;to-security-report, a security report and its status, and PostQuery arrived atMetadatawith no bodies;Audit-Idheader kubectl got back, so Milo's ID carries through;