Repository navigation
Conversation
LoadCredentials decoded every YAML document straight into a corev1.Secret, so a ConfigMap with plain-text data failed with a confusing base64 error and documents without data were silently loaded as empty Secrets. Check each document's apiVersion and kind first and return an error naming it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 58 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
4 of 5 tasks
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 of your changes
render.LoadCredentialsreads every document in--function-credentialsstraight into acorev1.Secretwithout checking its kind. A document that isn't a Secret causes one of two problems:data: the whole load fails withcannot parse YAML secret manifest: illegal base64 data .... The error names a Secret, even though the bad document isn't one.data(for example a Deployment): it's loaded as an empty Secret with that name and passed to functions as a credential. Nothing warns about it.Function credentials are always Secrets (a step's
credentials[].source: Secret). So this change reads each document'sapiVersion/kindfirst, and rejects anything that isn'tv1/Secretwith an error that names it, such asConfigMap/foo is not a v1 Secret. That also means a document with noapiVersion/kindat all is now rejected.This affects
render xrandrender op. #436 switchesproject simulateto the same loader.TestLoadCredentialsis new, with three cases: Secrets only, a Secret plus a ConfigMap, and a Deployment.Related: #436, #452.
I have:
./nix.sh flake checkto ensure this PR is ready for review. (./nix.sh run .#testand./nix.sh run .#lintpass.)Linked a PR or a docs tracking issue to document this change.(bug fix, no docs change)Addedbackport release-x.ylabels to auto-backport this PR.🤖 Generated with Claude Code