Skip to content

fix(bruno-electron): interpolate auth headers for GraphQL introspection request - #5560

Merged
sid-bruno merged 1 commit into
usebruno:mainfrom
phoval:bugfix/gql_introspection_interpolation
May 11, 2026
Merged

sid-bruno merged 1 commit into
usebruno:mainfrom
phoval:bugfix/gql_introspection_interpolation

Conversation

@phoval

@phoval phoval commented Sep 14, 2025 •

Copy link
Copy Markdown
Contributor

Description

Fix #4921 : interpolate auth headers for GraphQL introspection request

JIRA

Contribution Checklist:

  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

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

  • New Features
    • GraphQL introspection requests now support variable interpolation, allowing dynamic parameters to be processed during request preparation.

✏️ Tip: You can customize this high-level summary in your review settings.

@phoval
phoval force-pushed the bugfix/gql_introspection_interpolation branch from afcd5c7 to c93c91c Compare October 4, 2025 17:23
Copilot AI review requested due to automatic review settings October 4, 2025 17:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 interpolateVars function 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.

@phoval
phoval force-pushed the bugfix/gql_introspection_interpolation branch from c93c91c to 5b9a280 Compare October 4, 2025 17:23
@pull-request-size pull-request-size Bot added size/S and removed size/XS labels Oct 4, 2025
@phoval
phoval force-pushed the bugfix/gql_introspection_interpolation branch from 5b9a280 to 4d0b29c Compare October 4, 2025 17:32
@pull-request-size pull-request-size Bot added size/XS and removed size/S labels Oct 4, 2025
@joelrfcosta

Copy link
Copy Markdown

This looks good. Any idea when this will be merged?

@phoval
phoval force-pushed the bugfix/gql_introspection_interpolation branch from 4d0b29c to 5af67c0 Compare December 6, 2025 13:35
@coderabbitai

coderabbitai Bot commented Dec 6, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

A single-file bug fix that adds variable interpolation to GraphQL introspection requests. Authentication tokens and variables like {{api_token}} are now properly resolved before the introspection query executes, resolving issues where variables worked in regular queries but failed during schema loading.

Changes

Cohort / File(s) Change
GraphQL Introspection Variable Interpolation
packages/bruno-electron/src/ipc/network/prepare-gql-introspection-request.js
Introduced interpolate-vars dependency and added interpolation step after authentication headers are applied to introspection requests

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Review focuses on verifying that interpolateVars() is correctly chained after setAuthHeaders() and that the return value is properly updated
  • Confirm the new dependency is appropriate and doesn't introduce unintended side effects

Poem

Variables locked behind castle walls,
Now slip through introspection's halls—
{{api_token}} finds its way,
Schema loads bright as day! ✨
A small fix, but auth tokens sing.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding variable interpolation to auth headers in GraphQL introspection requests.
Linked Issues check ✅ Passed The code change directly addresses issue #4921 by interpolating auth header variables in the GraphQL introspection request preparation.
Out of Scope Changes check ✅ Passed The change is focused solely on the introspection request preparation file with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 pipeline

Assigning the result of setAuthHeaders back to axiosRequest and then returning interpolateVars(axiosRequest, resolvedVars) brings GQL introspection in line with the normal request flow, so auth headers like Authorization: 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

📥 Commits

Reviewing files that changed from the base of the PR and between 4ffb447 and 5af67c0.

📒 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() not func ()
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: Importing interpolate-vars here is correct and consistent

Local require matches the file layout and aligns introspection requests with the shared interpolation pipeline.

@Shuna322

Copy link
Copy Markdown

Greetings,
I would like to bump this since that would fix the issue that I'm having. Looks like a small change, and I would be glad to get it with the 3.0.3 update if possible :) 👍

@matt-hartley-brx

Copy link
Copy Markdown

I'd like to see this also in the next release as we're seeing the same issue also.

@phoval
phoval force-pushed the bugfix/gql_introspection_interpolation branch from 5af67c0 to 69b5aae Compare January 31, 2026 17:00
@phoval

phoval commented Jan 31, 2026

Copy link
Copy Markdown
Contributor Author

@helloanoop, Any chance to review and merge this PR?

@phoval

phoval commented Mar 3, 2026

Copy link
Copy Markdown
Contributor Author

@lohit-bruno @anusree-bruno how can we get this merged please?

@rhatlapa

Copy link
Copy Markdown

any updates on this one?

@pooja-bruno

Copy link
Copy Markdown
Collaborator

@phoval, thanks for raising the PR. If possible, could you also add a few tests for this fix?

@phoval
phoval force-pushed the bugfix/gql_introspection_interpolation branch from 8541f9b to d3df866 Compare April 29, 2026 05:52
@phoval
phoval requested a review from sid-bruno as a code owner April 29, 2026 05:52
@phoval

phoval commented Apr 29, 2026

Copy link
Copy Markdown
Contributor Author

@phoval, thanks for raising the PR. If possible, could you also add a few tests for this fix?

done

@dakuzen

dakuzen commented May 7, 2026

Copy link
Copy Markdown

Very excited to see this merged! Thank you Bruno team!

@sid-bruno
sid-bruno merged commit 4ad5118 into usebruno:main May 11, 2026
10 checks passed
sharan-bruno pushed a commit to sharan-bruno/bruno that referenced this pull request Jun 4, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Jun 16, 2026
3 of 6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auth token variable is not correctly interpolated when loading GQL schema from introspection

9 participants