Reject empty segments in JWT validators#18082
Conversation
|
Googlers: For automatic test runs see go/terraform-auto-test-runs. @BBBmau, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 048038f: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 6 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the replaying VCR build log Step 2: Recording Mode
Caution Issues requiring attention before PR completion 🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the recording VCR build log or the debug logs folder for detailed results. @naruto-lgtm, @BBBmau VCR tests complete for 048038f! |
Repro: set the
external_credentials.identity_tokenprovider field to.., or to any token with an empty segment such asab..cd; both the plugin-framework and SDK JWT validators accept it as a valid JWT.Cause: after the 3-part split, each segment is checked with
base64.RawURLEncoding.DecodeString, and that returns no error for the empty string, so an empty header/payload/signature passes the check.Fix: reject any empty segment before the base64 decode in
jwtValidator.ValidateString(plugin-framework) andValidateJWT(SDK). Both back the sameexternal_credentials.identity_tokenfield, so the guard belongs in the validators rather than the call sites.Release Note Template for Downstream PRs (will be copied)