Repository navigation
fix(bruno-electron): interpolate auth headers for GraphQL introspection request - #5560
Conversation
afcd5c7 to
c93c91c
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where authentication headers were not being interpolated for GraphQL introspection requests, addressing issue #4921. The fix ensures that variables in auth headers are properly resolved before making introspection requests.
- Add interpolation of variables in auth headers for GraphQL introspection requests
- Import the
interpolateVarsfunction to handle variable interpolation - Modify the return flow to apply variable interpolation after setting auth headers
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
c93c91c to
5b9a280
Compare
5b9a280 to
4d0b29c
Compare
|
This looks good. Any idea when this will be merged? |
4d0b29c to
5af67c0
Compare
WalkthroughA single-file bug fix that adds variable interpolation to GraphQL introspection requests. Authentication tokens and variables like Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/bruno-electron/src/ipc/network/prepare-gql-introspection-request.js (1)
27-30: Good fix: introspection now goes through the same auth+interpolation pipelineAssigning the result of
setAuthHeadersback toaxiosRequestand then returninginterpolateVars(axiosRequest, resolvedVars)brings GQL introspection in line with the normal request flow, so auth headers likeAuthorization: Bearer {{api_token}}will now be interpolated before the request is sent.The extra interpolation pass over endpoint/headers is effectively idempotent with the current helpers and limited to this small object, so overhead is negligible. If you have a test harness for introspection, it’s worth adding/adjusting a case that covers a variable-based Authorization header to lock this behavior in.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/bruno-electron/src/ipc/network/prepare-gql-introspection-request.js(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (CODING_STANDARDS.md)
**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions.() => {}is good
No space between function name and parentheses.func()notfunc ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly
Files:
packages/bruno-electron/src/ipc/network/prepare-gql-introspection-request.js
🧠 Learnings (1)
📓 Common learnings
Learnt from: bijin-bruno
Repo: usebruno/bruno PR: 6263
File: packages/bruno-requests/src/auth/oauth2-helper.ts:249-249
Timestamp: 2025-12-02T07:24:50.299Z
Learning: In OAuth2 Basic Auth headers for Bruno, clientSecret is optional and can be omitted. When constructing the Authorization header in `packages/bruno-requests/src/auth/oauth2-helper.ts`, use `clientSecret || ''` instead of `clientSecret!` to properly handle cases where only clientId is provided, per community requests.
🧬 Code graph analysis (1)
packages/bruno-electron/src/ipc/network/prepare-gql-introspection-request.js (2)
packages/bruno-electron/src/ipc/network/interpolate-vars.js (1)
interpolateVars(21-365)packages/bruno-electron/src/ipc/network/prepare-request.js (4)
axiosRequest(342-352)setAuthHeaders(11-303)request(306-306)collectionRoot(308-308)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: Playwright E2E Tests
- GitHub Check: SSL Tests - Windows
- GitHub Check: CLI Tests
- GitHub Check: Unit Tests
- GitHub Check: SSL Tests - Linux
- GitHub Check: SSL Tests - macOS
🔇 Additional comments (1)
packages/bruno-electron/src/ipc/network/prepare-gql-introspection-request.js (1)
4-4: Importinginterpolate-varshere is correct and consistentLocal require matches the file layout and aligns introspection requests with the shared interpolation pipeline.
|
Greetings, |
|
I'd like to see this also in the next release as we're seeing the same issue also. |
5af67c0 to
69b5aae
Compare
|
@helloanoop, Any chance to review and merge this PR? |
69b5aae to
8541f9b
Compare
|
@lohit-bruno @anusree-bruno how can we get this merged please? |
|
any updates on this one? |
|
@phoval, thanks for raising the PR. If possible, could you also add a few tests for this fix? |
8541f9b to
d3df866
Compare
done |
|
Very excited to see this merged! Thank you Bruno team! |
Description
Fix #4921 : interpolate auth headers for GraphQL introspection request
JIRA
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.