fix(http/raw): persist QueryAuthStrategy params in ApplyAuthStrategy - #7410
Conversation
The QueryAuthStrategy case in raw.Request.ApplyAuthStrategy parses r.FullURL into a local 'parsed', appends auth params to parsed.Params, then returns without writing back to r.FullURL. Every other branch in the same switch mutates r.Headers, and the standalone QueryAuthStrategy .Apply / .ApplyOnRR in pkg/authprovider/authx/query_auth.go both write back to req.URL.RawQuery. Only the raw-request branch was missing the write-back, so raw templates matching a 'query' auth secret silently drop the auth params. Adds r.FullURL = parsed.String() after the loop. New unit test fails on dev and passes with the fix.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughApplyAuthStrategy's QueryAuthStrategy branch now writes the updated URL (with appended query auth params) back into Request.FullURL. A set of unit tests was added to verify query param persistence, preservation of existing params, invalid-URL behavior, nil-strategy no-op, cookies, headers, bearer token, and basic auth handling. ChangesQuery Auth Parameter Persistence + Tests
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Proposed changes
Closes #7409
Request.ApplyAuthStrategyinpkg/protocols/http/raw/raw.goparsesr.FullURLinto a localparsed, appends theQueryAuthStrategyparams toparsed.Params, then returns without writing the result back. Every other branch of the switch (CookiesAuthStrategy,HeadersAuthStrategy,BearerTokenAuthStrategy,BasicAuthStrategy) mutatesr.Headers. The standaloneQueryAuthStrategy.ApplyandApplyOnRRinpkg/authprovider/authx/query_auth.goboth write back toreq.URL.RawQuery. Only the raw-request path was missing the write-back, so raw templates that match aqueryauth secret silently drop the params and the request goes out unauthenticated.Adding
r.FullURL = parsed.String()after the params loop fixes it. New unit test inraw_test.gofails ondevand passes with the fix.Checklist
Summary by CodeRabbit
Bug Fixes
Tests