Skip to content

feat: security reports, acknowledgements and moving submissions - #39

Open
mattdjenkinson wants to merge 4 commits into
mainfrom
feat/crd-security
Open

mattdjenkinson wants to merge 4 commits into
mainfrom
feat/crd-security

Conversation

@mattdjenkinson

@mattdjenkinson mattdjenkinson commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Closes #9. Closes #8, after #37 and #38. Stacked on #38.

Security reports as CRDs: what the Postgres version did in its storage strategy and its to-security-report subresource, now done by admission webhooks and reconcilers.

Admission

  • securityreport (validating; creates and status updates):
    • Creates: credit links must be http(s), and public credit needs a name. A report with no owner (logged by the Security Team for an external reporter) needs spec.reporter with an email or GitHub username, and the email must look like one.
    • Status updates: the timeline is the reporter's record, so entries can be added but not changed or removed. A phase change needs an entry for the new phase. NotApplicable and Duplicate need a reason, credit rewards need an amount, advisories need an https link, and CVSS vectors must be well-formed.
  • securitytimeline (mutating; status updates): adds the entry when the Security Team changes the phase without one, as the old status strategy did.

The schema already covers text limits, enums and an immutable spec.

Reconcilers

  • security-report:
    • A new report gets phase Received and its first timeline entry.
    • It creates the report's SecurityReportTriage, owned by the report, for private notes. This replaces status.internal. Duplicate no longer requires duplicateOf, because that field lives on the triage object now.
    • It copies attachments under security-reports/<name>/, with the attachments finalizer, as for submissions.
    • Once the report is Fixed or Disclosed and the reporter chose public credit, it keeps a SecurityAcknowledgement with the name, link, the month of the first fixed or disclosed entry, and the severity. It's deleted if that stops being true.
  • move-to-security carries out MoveToSecurity review decisions:
    • It creates a report owned by the submitter, named after the submission so a retry finds it, with spec.affected from the review.
    • It copies the submission's files into the report first, so the new report already has its finalizer.
    • It then deletes the submission. Milo's garbage collector removes its review, and the attachments finalizer removes its files.

Milo RBAC

The operator can now create securityreporttriages.

Not in this PR

  • The emails to security@datum.net and to the reporter on every phase change. Those come with the notifications work.

Tests

  • Spec checks: a user's report and an external report with an email pass. External with no contact, a bad email, public credit without a name, and a javascript: credit link are refused.
  • Status checks: triaging with an entry passes. A phase change without an entry, rewritten history, not-applicable without a reason, credits without an amount, and an http advisory are refused.
  • The timeline webhook adds an entry for a phase change.
  • Envtest:
    • a new report is Received and gets its triage object;
    • Fixed with public credit creates the acknowledgement with month 2026-10 and severity;
    • an external report disclosed without public credit gets none;
    • a submission with an attachment moved to security becomes a report owned by the submitter, with its file, and the submission and its copy are gone.
  • task test, go test -race -count=2 on the reconciler and webhook tests, go vet ./..., and task generate with no diff

New reports start in Received with a timeline entry and get a private
SecurityReportTriage; attachments are copied under the report and
deleted with it. Fixed or disclosed reports with public credit get a
SecurityAcknowledgement. MoveToSecurity decisions create a report owned
by the submitter from the submission, copy its files and delete it.

Admission checks credit links and external reporters' contact details,
keeps the timeline append-only, and adds a timeline entry for a phase
change that lacks one.

Copy link
Copy Markdown

Please fix before merging: moving a submission to security deletes the original whenever any security report already has the same name (MoveReconciler), without checking that it is the report created by this move. A name collision can therefore permanently lose the submission and its files.

Only delete after verifying the destination belongs to this exact source submission and owner, including the AlreadyExists path. On a mismatch, preserve the submission and report an error. Please add a collision test.

The move-to-security reconciler deleted the submission whenever any
security report had the target name, so a name collision could lose the
submission and its files.

The moved report is now named <submission>-<submission UID> and annotated
with the submission's name and UID. The reconciler reads the report back
on both the create and AlreadyExists paths and checks name, UID and owner
before it copies the attachments and deletes the submission (with a UID
precondition). On a mismatch it keeps the submission and its files, sets
Applied=False/ReportNameTaken on the review, and retries when a report is
deleted. It also waits for the submission's files to be copied under it
before moving. The security report webhook lets only the operator set the
moved-from annotations and refuses changes to them.
@mattdjenkinson

Copy link
Copy Markdown
Contributor Author

Fixed in 347cd3a.

  • Report name: a moved report is now named <submission>-<submission UID>, and carries moved-from-submission and moved-from-submission-uid annotations. The webhook stops anyone else from setting those annotations.
  • Delete check: the submission is deleted only if the report's annotations match this submission's name and UID and its owner matches, including on the AlreadyExists path.
  • On a mismatch: the submission and its files are kept. The review gets Applied=False with reason ReportNameTaken, and the move is retried when a report is deleted.
  • Tests: a collision test in envtest, plus the security test in test: end-to-end tests in kind against a real Milo #42 in kind.

scotwells
scotwells previously approved these changes Nov 18, 2026
This was referenced Nov 18, 2026
Base automatically changed from feat/crd-uploads to main November 18, 2026 21:05
@mattdjenkinson
mattdjenkinson dismissed scotwells’s stale review November 18, 2026 21:05

The base branch was changed.

@mattdjenkinson
mattdjenkinson requested a review from a team as a code owner November 18, 2026 21:05
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.

SecurityReport and SecurityAcknowledgement Submission

2 participants