Skip to content

Model secrets as baseline plus per-mechanism additions - #238

Merged
ptr727 merged 8 commits into
developfrom
feature/secrets-baseline-and-mechanisms
Jul 5, 2026
Merged

Model secrets as baseline plus per-mechanism additions#238
ptr727 merged 8 commits into
developfrom
feature/secrets-baseline-and-mechanisms

Conversation

@ptr727

@ptr727 ptr727 commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Restructures spec/secrets.json into generic baseline + domain-specific per-mechanism additions (directive 4), fixing the secret-model gaps the audits surfaced.

  • baseline - the App-token secrets (CODEGEN_APP_*) the fleet-wide App-signed merge-bot needs on every repo; implicit, no longer repeated per-repo or tied only to codegen. Forbids CODEGEN_APP_ID.
  • nuget-oidc now requires NUGET_USERNAME (the NuGet/login profile name); codecov mechanism added (CODECOV_TOKEN); featureMechanisms map for non-publish features.
  • validate.py premise fix: an OIDC mechanism may require a non-secret stored value (a username); the forbids list - not an empty requires - is what enforces "no static key". (The old check hard-failed any OIDC mechanism with a non-empty requires.)
  • Normalized registry requiredSecrets (Utilities/LanguageTags -> NUGET_USERNAME; dropped the now-baseline App secrets) + the codegen type; schema updated (baseline required, featureMechanisms, shared secretSet def).

Validated locally: jq empty + python3 spec/validate.py -> 8 cataloged / 14 backlog classify cleanly.

🤖 Generated with Claude Code

Add a baseline set - the App-token secrets the fleet-wide App-signed merge-bot needs on every repo (forbids CODEGEN_APP_ID) - so they are implicit, not repeated per-repo or tied only to codegen. nuget-oidc now requires NUGET_USERNAME (the NuGet/login profile name); add a codecov mechanism (CODECOV_TOKEN) and a featureMechanisms map.

Relax validate.py: an OIDC mechanism may require a non-secret stored value (username); the forbids list, not an empty requires, enforces "no static key". Normalize registry requiredSecrets (Utilities/LanguageTags -> NUGET_USERNAME; drop the now-baseline App secrets) and the codegen type's requiredSecrets. Update the schema (baseline required, featureMechanisms, shared secretSet def). Validated with jq + spec/validate.py.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Pieter Viljoen <ptr727@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 5, 2026 13:59

Copilot AI 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.

Pull request overview

Updates the secrets specification to separate fleet-wide baseline secrets from per-target/per-feature additions, aligning the registry and validation logic with the audit findings about OIDC mechanisms and non-secret stored values.

Changes:

  • Introduces a required baseline secret set in spec/secrets.json and updates the schema to support shared secretSet definitions plus featureMechanisms.
  • Updates nuget-oidc to require NUGET_USERNAME, adds a codecov mechanism, and normalizes how registries list only domain-specific additions.
  • Adjusts spec/validate.py to stop rejecting OIDC mechanisms solely because they have non-empty requires.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
spec/validate.py Relaxes OIDC validation around requires to allow non-secret stored values.
spec/secrets.schema.json Adds baseline and $defs.secretSet, plus optional featureMechanisms.
spec/secrets.json Restructures secrets into baseline + per-mechanism sets; adds Codecov and NuGet username requirement.
spec/project-types.json Removes codegen’s per-type required secrets now that baseline applies fleet-wide.
registry/repos.json Updates NuGet repos to list NUGET_USERNAME as the required domain-specific addition.

Comment thread spec/validate.py Outdated
Comment thread spec/secrets.json
Add the correct OIDC guarantee to validate.py: an oidc-labeled publish entry must have a non-empty forbids (it must block its static-credential counterpart), replacing the removed empty-requires proxy. Use the action slug actions/create-github-app-token in baseline.workflowNeeds (consistent with the other mechanisms' slugs); move the client-id-not-app-id detail to the note.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Pieter Viljoen <ptr727@users.noreply.github.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread spec/validate.py Outdated
Add a  (oidc | static-secret) to each publish mechanism and check the repo's publish  label against it directly, instead of inferring from requires-emptiness (which broke once OIDC mechanisms could require NUGET_USERNAME) - so a nuget target mislabeled static-secret is now caught. Keep the spec-integrity check that an oidc-kind mechanism forbids a static credential.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Pieter Viljoen <ptr727@users.noreply.github.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Comment thread spec/validate.py Outdated
Comment thread spec/validate.py Outdated
Comment thread spec/secrets.json
Comment thread spec/secrets.schema.json
validate.py now treats baseline as a required top-level key and reads forbids via get() so a malformed mechanism reports an error instead of crashing. codecov gains an explicit static-secret kind, and the schema requires kind for every entry under mechanisms (a new mechanism def = secretSet plus required kind) while keeping it optional for baseline.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Pieter Viljoen <ptr727@users.noreply.github.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread spec/validate.py Outdated
Comment thread spec/validate.py
…bids

The validator asserts every mechanism has a recognized kind (oidc or static-secret) before the kind-based label check relies on it, and reads requires/forbids via get() so a malformed secrets.json reports a clear error instead of raising KeyError (CI runs jq empty plus this script, no JSON-schema validation).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Pieter Viljoen <ptr727@users.noreply.github.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread spec/validate.py Outdated
Comment thread spec/validate.py
One structural check verifies baseline and each mechanism are objects with list requires/forbids, a recognized kind, and the oidc-forbids integrity, returning a clear error before the cross-reference loops. Since CI runs no JSON-schema validation, a malformed secrets.json now reports a message instead of raising AttributeError/TypeError.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Pieter Viljoen <ptr727@users.noreply.github.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread spec/validate.py Outdated
…anisms

A shared helper now validates baseline and every mechanism have array requires/forbids (and mechanisms a valid kind), and targetMechanisms is an object mapping to a string or null, so any malformed secrets.json reports a clear error before the cross-reference loops.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Pieter Viljoen <ptr727@users.noreply.github.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread spec/validate.py
Comment thread spec/validate.py
Comment thread spec/validate.py Outdated
…n comment

check_secret_set now requires requires/forbids to be arrays of strings (a non-string element would break set membership downstream), and the shape check validates the optional featureMechanisms map like targetMechanisms. Shorten the block comment to the load-bearing why (CI runs no JSON-schema validation).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Pieter Viljoen <ptr727@users.noreply.github.com>
@ptr727
ptr727 requested a review from Copilot July 5, 2026 14:36

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@ptr727
ptr727 merged commit c61804f into develop Jul 5, 2026
7 checks passed
@ptr727
ptr727 deleted the feature/secrets-baseline-and-mechanisms branch July 5, 2026 14:39
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