Feature/crd validation 366 - #416
Merged
OtowoSamuel merged 4 commits intoMar 31, 2026
Merged
Conversation
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.
Description
This PR enhances the security and stability of the StellarNetwork resource by implementing strict OpenAPI v3 validation. By enforcing naming constraints at the CRD level, we eliminate the risk of empty strings or malicious injection attacks (e.g., shell characters or SQL-style fragments) from entering the cluster state.
Key Changes
Schema Validation: Added regex pattern matching to enforce DNS-1123 compliance for network names.
Boundary Checks: Implemented minLength and maxLength constraints to ensure data integrity.
Code Generation: Regenerated the CRD manifests using controller-gen to sync the Go annotations with the YAML definitions.
Security Hardening: Provided a "fail-fast" mechanism that rejects malformed manifests at the API server level.
Validation Results
[x] Positive Test: Successfully applied a network with name testnet-v2.
[x] Negative Test (Regex): Verified rejection of network@name and network_name.
[x] Negative Test (Empty): Verified rejection of empty strings.
[x] CI Verified: All make manifests and linting checks passed locally.
PR Checklist
[x] Branch feature/crd-validation-366 created and pushed.
[x] Validation logic implemented in the CRD module.
[x] No breaking changes to existing valid network configurations.
Closes #366