Repository navigation
feat(tenants): support verified source-only bootstrap #5261
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
62e5d8f
feat(tenants): support verified source-only bootstrap
devantler 6e05681
Merge remote-tracking branch 'origin/main' into codex/tenant-source-5…
devantler 7b794e1
fix(tenants): bind bootstrap authorization approval
devantler 14aee06
Merge remote-tracking branch 'origin/main' into codex/tenant-source-5…
devantler e05c6f2
fix(tenants): preserve executable guard entry points
devantler 953d7d7
fix(ci): follow the Tenant constructor helper in analysis
devantler e0614ca
Merge remote-tracking branch 'origin/main' into codex/tenant-source-5…
devantler fae3855
fix(ci): follow the sourced Tenant constructor in OCI checks
devantler 2c1896f
Merge remote-tracking branch 'origin/main' into codex/tenant-lint-526…
devantler 89f96af
fix(tenants): require exact publication for source-only bootstrap
devantler 49cf588
chore: integrate reviewed publisher recovery from main
devantler 4734bc0
Merge remote-tracking branch 'origin/main' into codex/tenant-source-5…
devantler f3cf269
fix(ci): bind tenant schemas to reviewed External Secrets 2.13
devantler 7125286
test(tenant): use current KRO graph configuration API
devantler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #!/usr/bin/env bash | ||
| # The only dynamic publisher/selector profile admitted by the generic Tenant. | ||
| # This reads both exact constructors and their complete schema input domain; | ||
| # it never evaluates arbitrary CEL or grants a consumer publisher approval. | ||
| tenant_source_default_subject() ( | ||
| set -o pipefail | ||
| local file="$1" observed="${2:-}" ref expected_subject default_subject source_type digest_type publisher_type lifecycle | ||
| # shellcheck disable=SC2016 # Literal CEL, never shell expansion. | ||
| ref='${schema.spec.source.digest == "" ? {"semver": ">=1.0.0"} : {"digest": schema.spec.source.digest}}' | ||
| # shellcheck disable=SC2016 # Literal CEL, never shell expansion. | ||
| expected_subject='${schema.spec.source.publisherRevision == "" ? "^https://github\\.com/devantler-tech/(actions/\\.github/workflows/publish-app\\.yaml@[0-9a-f]{40}|\\.github/\\.github/workflows/publish-app\\.yaml@(0c7b6c3509b73adbc7537e030935bb01987e625b|467f07582436a26b62cf4aa756423512f85ba0c0))$" : "^https://github\\.com/devantler-tech/\\.github/\\.github/workflows/publish-app\\.yaml@" + schema.spec.source.publisherRevision + "$"}' | ||
| default_subject='^https://github\.com/devantler-tech/(actions/\.github/workflows/publish-app\.yaml@[0-9a-f]{40}|\.github/\.github/workflows/publish-app\.yaml@(0c7b6c3509b73adbc7537e030935bb01987e625b|467f07582436a26b62cf4aa756423512f85ba0c0))$' | ||
| source_type="TenantSource | default={} validation=\"((!has(self.digest) || self.digest == '') == (!has(self.publisherRevision) || self.publisherRevision == '')) && (!has(self.reconcileApplication) || self.reconcileApplication || (has(self.digest) && self.digest != ''))\" validation=\"!has(oldSelf.digest) || oldSelf.digest == '' || (has(self.digest) && self.digest != '')\"" | ||
| digest_type='string | default="" maxLength=71 pattern="^$|^sha256:[0-9a-f]{64}$"' | ||
| publisher_type='string | default="" maxLength=40 pattern="^$|^[0-9a-f]{40}$"' | ||
| lifecycle='boolean | default=true validation="self || !oldSelf"' | ||
| if [[ -n "$observed" && "$observed" != "$expected_subject" ]]; then | ||
| printf 'invalid Tenant source constructor: unexpected subject\n' >&2 | ||
| return 1 | ||
| fi | ||
| if ! yq -o=json -I=0 '.' "$file" | jq -se \ | ||
| --arg ref "$ref" --arg subject "$expected_subject" --arg source_type "$source_type" \ | ||
| --arg digest_type "$digest_type" --arg publisher_type "$publisher_type" --arg lifecycle "$lifecycle" ' | ||
| [ .[] | select(.apiVersion == "kro.run/v1alpha1" and .kind == "ResourceGraphDefinition" and .metadata.name == "tenant.kro.run") ] as $graphs | ||
| | ($graphs | length) == 1 | ||
| and ($graphs[0].spec.schema | .apiVersion == "v1alpha1" and .kind == "Tenant" and .scope == "Namespaced" | ||
| and .types.TenantSource == {digest: $digest_type, publisherRevision: $publisher_type, reconcileApplication: $lifecycle} | ||
| and .spec.source == $source_type and (.spec | has("reconcileApplication") | not)) | ||
| and ([$graphs[0].spec.resources[] | select(.id == "ociRepository")] | length) == 1 | ||
| and ([$graphs[0].spec.resources[] | select(.id == "ociRepository")][0].template | | ||
| .apiVersion == "source.toolkit.fluxcd.io/v1" and .kind == "OCIRepository" | ||
| and .metadata.name == "${schema.spec.name}" and .metadata.namespace == "${tenantNamespace.metadata.name}" | ||
| and .spec.url == "oci://ghcr.io/devantler-tech/${schema.spec.name}/manifests" | ||
| and .spec.ref == $ref and .spec.verify == {provider: "cosign", matchOIDCIdentity: [{ | ||
| issuer: "^https://token\\.actions\\.githubusercontent\\.com$", subject: $subject | ||
| }]}) | ||
| and ([.[] | .. | objects | select(has("subject")) | select(.subject == $subject)] | length) == 1 | ||
| ' >/dev/null; then | ||
| printf 'invalid Tenant source constructor: graph context, paired domain or constructor differs\n' >&2 | ||
| return 1 | ||
| fi | ||
| printf '%s\n' "$default_subject" | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.