Skip to content

feat: set owners and reviewers in admission, register feedback with Milo IAM - #33

Merged
mattdjenkinson merged 1 commit into
mainfrom
feat/identity
Nov 18, 2026
Merged

mattdjenkinson merged 1 commit into
mainfrom
feat/identity

Conversation

@mattdjenkinson

Copy link
Copy Markdown
Contributor

Part of #10. Stacked on #32; merge that first and this PR will retarget to main.

Makes sure a user can only create feedback as themselves, and registers the feedback CRDs with Milo IAM.

Admission webhooks

The operator serves them; Milo calls them through config/milo/webhook. Milo already trusts certificates from the datum-control-plane issuer, so the config has no CA bundle.

  • owner runs on creates of votes, subscriptions, submissions, security reports and feedback profiles.
    • In a user's own context, it sets spec.userRef to that user, whatever the client sent.
    • In the platform context, only the operator may create these, and it must name the owner.
    • The Security Team may log a security report with no owner, for an external reporter.
    • Everything else is refused.
  • reviewer runs on SubmissionReview creates and updates. When a request sets spec.decision, it records spec.reviewer and spec.reviewedAt from the request. Before a decision is set, it clears them, so a client can't name someone else.

Milo's mutating admission runs before the CRD's CEL rules. So when a user names another user's vote, the owner is replaced and the <post>.<user> name rule then rejects it. The envtest confirms this.

Milo config

  • ProtectedResources for every CRD. User-context kinds have a User parent, and posts declares the hidden subresource that the Milo filter checks.
  • Roles.
    • user loses the old attachment and PostQuery permissions and gains feedback profiles.
    • reviewer decides through submissionreviews instead of subresources.
    • security-team gains securityreporttriages.
    • viewer gains profiles and digests.
  • Kubernetes RBAC in Milo for the service's client-certificate identities:
    • system:feedback-operator@… can read everything. It writes only what it owns: post, vote and submission status; the votes, follows and reports it creates for users; reviews, acknowledgements and digests.
    • system:feedback-sync@… is unchanged apart from reading reviews instead of writing submission status.
    • system:feedback-uploads@… can read submissions and reports, and create TokenReviews and SubjectAccessReviews.
  • Bindings (optional): staff reviewer on each non-security kind, and Security Team on reports, triage and acknowledgements.
  • The discovery policy and search policies are gone from this branch. CRD annotations now declare discovery contexts, and search comes back with Search integration #12.

Tests

  • Unit tests for both webhooks and for reading identity from user info. Extras are matched case-insensitively.
  • An envtest that serves the webhooks in front of an API server with the CRDs and the generated webhook config, then makes requests as a user in their own context and as staff.
  • test/config: every CRD has a ProtectedResource, with its status subresource, hidden subresource and User parent matching the CRD.
    • Role permissions and ClusterRole grants are declared, and inherited and bound roles exist.
    • Every service identity has a binding, and security reports and triage appear only in the Security Team and user roles.
    • The owner webhook covers exactly the CRDs with an owner field. I removed one resource from the webhook config to confirm the test fails.
  • task test, go vet ./..., and task generate with no diff

…ilo IAM

The owner webhook sets spec.userRef on votes, follows, submissions,
security reports and profiles from the request, so a user can only
create their own; only the operator creates them for others, and the
Security Team logs external reports with no owner. The reviewer webhook
records who decided on a SubmissionReview.

Milo config: ProtectedResources and roles for every CRD, Kubernetes RBAC
for the operator, sync and uploads identities, and the webhook config.
A test checks the config against the CRDs.
scotwells
scotwells previously approved these changes Nov 17, 2026

Copy link
Copy Markdown

The ownership and access-control design looks sound. Before enabling this for users, please ensure the Metadata-only audit policy for submissions, reviews, security reports and triage is deployed, along with the user/public-reader bindings. Otherwise private report content could enter audit logs, or intended users will have no access. These are rollout prerequisites, not blockers in this PR; the later PRs cover the email and attachment checks.

@scotwells scotwells mentioned this pull request Nov 17, 2026
2 of 3 tasks
@mattdjenkinson

Copy link
Copy Markdown
Contributor Author

Agreed. They're now listed in the README's "Before enabling for users" section (#32):

  • the Metadata-only audit policy, datum-cloud/infra#9437;
  • owner filtering in Milo;
  • the user and public-reader bindings;
  • operator readiness before the webhooks are registered.

None of them are blockers in this PR, so no change here.

Base automatically changed from feat/crds to main November 18, 2026 03:47
@mattdjenkinson
mattdjenkinson dismissed scotwells’s stale review November 18, 2026 03:47

The base branch was changed.

@mattdjenkinson
mattdjenkinson requested a review from a team as a code owner November 18, 2026 03:47
@mattdjenkinson
mattdjenkinson merged commit 705d912 into main Nov 18, 2026
6 checks passed
@mattdjenkinson
mattdjenkinson deleted the feat/identity branch November 18, 2026 04:16
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