fix(security): enforce hardened contract for unsafe controls#502
Merged
Conversation
Signed-off-by: Roel de Cort <roel.decort@adfinis.com>
Signed-off-by: Roel de Cort <roel.decort@adfinis.com>
Contributor
|
This PR is large (over 1000 lines). Consider breaking it down into smaller PRs. |
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.
Summary
Enforces the Hardened profile as a reject-by-default security contract for unsafe escape hatches.
This adds a shared Hardened contract validator and applies it consistently across admission, controller status, backup, restore, and upgrade snapshot paths. Hardened specs now reject or mark unsafe use of TLS disablement, insecure TLS verification, wildcard/ambient egress, raw ingress widening, dangerous runtime flags, CR-controlled image trust roots, and ambient backup/restore credentials.
Existing unsafe Hardened specs are not adopted into privileged behavior silently: controller status marks them as
SecurityRisk=TrueandProductionReady=False, while lifecycle paths reject privileged side effects where possible.Related Issues
None.
Type of Change
Risk and Compatibility
This tightens behavior for
spec.profile: Hardened.New or updated Hardened specs are rejected when they use unsafe escape hatches, including disabled TLS, skip-verify settings, wildcard or non-explicit network egress, raw ingress widening, unsafe runtime flags, CR-controlled custom CA/image trust roots, or ambient backup/restore credentials.
Existing unsafe Hardened specs are not deleted, but they are marked not production-ready and may have backup, restore, or upgrade snapshot operations rejected until the spec is made explicit and compliant.
For backup and restore identity, Hardened now requires an explicit credentials secret, workload identity, or S3-only
roleArn. Non-S3 providers must not rely onroleArnas a stand-in for explicit identity.This should be called out in the release line because Hardened users may need to update specs before future reconciles or lifecycle operations succeed.
Verification
GOFLAGS=-mod=vendor go test ./internal/platform/hardenedcontract -count=1GOFLAGS=-mod=vendor go test ./internal/service/workloadidentity -count=1GOFLAGS=-mod=vendor go test ./internal/service/backup -count=1GOFLAGS=-mod=vendor go test ./internal/service/restore -count=1GOFLAGS=-mod=vendor go test ./internal/service/upgrade/snapshot -count=1make verify-generatedmake verify-helmmake docs-buildmake lint-civia pre-push hookReviewer Notes
The main review focus is whether the Hardened contract boundaries are correct and consistently applied between Go validation, admission policies, status reporting, and lifecycle operations.
The intended model is that Hardened remains usable for production OpenBao deployments, but any escape hatch must either be removed from the Hardened spec or represented through an explicit, auditable configuration path.
Checklist