Skip to content

feat (playground): Allow displaying the inherited headers and auth details in playground (BRU-4005) - #131

Open
vasharma05-bruno wants to merge 3 commits into
usebruno:release/v0.6.0from
vasharma05-bruno:bru-4005/inherited-auth
Open

vasharma05-bruno wants to merge 3 commits into
usebruno:release/v0.6.0from
vasharma05-bruno:bru-4005/inherited-auth

Conversation

@vasharma05-bruno

@vasharma05-bruno vasharma05-bruno commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Ticket

BRU-4005

Description

This PR allows displaying the inherited Headers and Inherited Auth in Folder Settings and Request page inside the playground.

This PR follows the parity with Bruno app, in view of the business logic.

Changes

Screenshot 2026-11-17 at 17 11 13 Screenshot 2026-11-17 at 17 11 17 Screenshot 2026-11-17 at 17 11 22 Screenshot 2026-11-17 at 17 11 42 Screenshot 2026-11-17 at 17 11 46 Screenshot 2026-11-17 at 17 11 56 Screenshot 2026-11-17 at 17 11 58 Screenshot 2026-11-17 at 17 12 05 Screenshot 2026-11-17 at 17 12 10

@changeset-bot

changeset-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 198267e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@usebruno/api-docs Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vasharma05-bruno
vasharma05-bruno changed the base branch from main to release/v0.6.0 November 17, 2026 11:37

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The changes in this file is in parity with the Bruno app's EditableTable

closeSidebarIfInline();
};

const openInheritedSource = (uuid: string) => {

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.

When I click an "Inherited from" link, it takes me to the folder or collection settings, but always on the Overview tab. So I still have to find the Auth or Headers tab myself to see where the value comes from.

Desktop will open auth tab of the source instead of overview tab.

value: "acct_billing_folder"
auth:
type: "bearer"
token: "{{vineet_bearer_auth_token}}"

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.

Can we change this back to auth: inherit and keep the X-Billing-Account header? If we also want a sample folder with its own Bearer auth, that should be a different folder that no test expects to inherit, with a neutral variable name instead of vineet_bearer_auth_token.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the catch!

@@ -109,13 +105,14 @@ export const AuthTab: React.FC<AuthTabProps> = ({
<>
{textField('key', 'Key')}
{textField('value', 'Value')}

@sundram-bruno sundram-bruno Nov 19, 2026 •

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.

When a request inherits API Key auth, the Value field shows the key in plain text. Same for the AWS Sig v4 Session Token at L126. Both use textField, while Password, Token and Secret Access Key use secretField.

Other places hide these:

  • our docs request page masks both (AuthDetails.tsx L170, L176)
  • desktop marks both as secret (ApiKeyAuth and AwsV4Auth), and its inherited view uses the same fields

This isn't a new leak, since the normal auth form and the settings pages already show these in plain text. But with this PR, the value now also shows on every request that inherits, which makes it much easier to spot.

Can we switch both to secretField? That fixes the inherited view and the normal form together. The two tests in AuthTab.spec.tsx that check the plain text ("shows an inherited API key read-only..." and "shows all six inherited AWS Signature v4 fields...") would need updating to expect masked values.

Although this is not directly caused by this pr, but it reuses the same flawed code which we have. if we can handle it here , it would be good.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We can take this as a separate ticket, else this will bring more test cases, and will increase the scope of the ticket.

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.

ok , since its a secret related thing, lets just make a jira as soon as possible, so that they know we are aware of it and its not missed.

const table = <KeyValueTable data={mixedRows} onChange={noop} showDescription rowConfig={rowConfig} />;

it('renders a full-width row spanning every column', () => {
const cell = query(getByTestId(useRenderToDom(table), 'section-row'), 'td');

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.

The new tests here find elements by tag and class: 'td' (L107, L130), input[type="checkbox"] (L120), .delete-button (L122, L213), .value-cell-trailing (L193), .cell-error (L201, L206), tbody tr (L206, L211). Same in HeadersTab.spec.tsx L121, L123, L133 and Input.spec.tsx L44 (.oc-input-wrapper).

These break as soon as the markup or a class name changes, even if the behaviour is the same. Could we give these elements test ids built from the table's testId and use those in the specs instead?

className: (row) => (row.rowType ? `${row.rowType}-header-row` : ''),
testId: (row) => {
if (row.rowType === ROW_TYPE.SECTION) return `${row.section}-headers-section-row`;
if (row.rowType === ROW_TYPE.INHERITED) return `inherited-header-row-${row.name.toLowerCase()}`;

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.

The new test ids here are fixed strings: the row ids (inherited-header-row-*, *-headers-section-row), the section toggles (L145), the source link (L161) and the show/hide button (L193). Our convention is a testId? prop on the component with child ids built from it (${testId}-...).

HeadersTab is used on the request, folder and collection pages, so with fixed ids the tests can't tell which table they are looking at. Could we add a testId prop (default headers-tab) and build all of these from it, for example ${testId}-inherited-row-${name} and ${testId}-show-inherited?

const inheritedAuth = useMemo(() => {
if (folder.request?.auth !== 'inherit') return null;
const resolved = resolveInheritedAuth(collection, ancestry, folder);
return { auth: resolved.auth, source: resolved.source ?? collectionSource(collection) };

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.

This is the same rule as useInheritance.ts L18-24: only when auth is set to inherit, use the resolved source, otherwise fall back to the collection. Right now it lives in two places, so if one changes (say the fallback label or the "is inherit" check) the folder page and the request page would start showing different things.

Could we pull it into one helper in utils/request.ts (something like getInheritedAuth(collection, ancestry, item) returning { auth, source } | null) and use it in both places? The old getInheritedAuthSummary that this PR removed used to be that single place.

<AuthModeSelect
auth={auth}
showInherit
onChange={(mode) => onItemChange({ ...item, http: { ...item.http, auth: authForMode(mode) } })}

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.

The new Auth dropdown in the tab bar writes the auth itself here ({ ...item, http: { ...item.http, auth } }), while field edits inside the tab go through AuthTab's updateItemAuth. So the request's auth now has two separate write paths.

It works today since this pane only shows HTTP requests, but updateItemAuth already handles other protocol keys and folders/collections, and if anything gets added there later (cleanup, defaults), the dropdown won't get it.

Could both go through one function? For example, move the "put this auth on this item" logic into a small util and call it from both places, or let AuthTab own the mode change and have the tab-bar dropdown call into it.


const effectiveHeaders = useMemo<HttpRequestHeader[]>(() => {
const auth = effectiveAuth && effectiveAuth !== 'inherit' ? effectiveAuth : undefined;
const authWritesAuthorization = Boolean(

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.

The rule only knows that Bearer and Basic write a header, but API Key auth placed in a header also writes one, and the runner always overwrites a header with the same name (setAuthHeaders in RequestExecutor.ts). The snippet does the opposite: if a header with that name already exists, it keeps it and skips the auth one (collectHeaders in codeSnippets.ts).

Example: API Key auth with key X-API-Key, value {{apiKey}}, and a collection header X-API-Key: old-key.

  • Runner sends X-API-Key: {{apiKey}}
  • Snippet shows X-API-Key: old-key

Same thing when the API key's header name is Authorization.

This was already the case in the playground before this PR, but now it reaches the docs page too. Could we work out the header name the auth writes (authorization for Bearer with a token or Basic with both fields, the key name for API Key with placement header) and drop own and inherited headers with that name (any case)? A test for the API Key case in useInheritance.spec.tsx would cover it.

export interface InheritedHeaderRow extends HttpRequestHeader {
description?: string;
source: InheritedSource;
source?: InheritedSource;

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.

source became optional here, but the only thing that builds these rows (collectInheritedConfig) always sets it. I tried making it required again and tsc only complains about one test fixture (HeadersTab.spec.tsx L129, the "inherited header without a source" test), which is a case the app never produces.

Keeping it optional adds guards that never trigger:

  • request.ts L72 (source && ...)
  • request.ts L75 (source?.uuid, and the | null in the type)
  • HeadersTab.tsx L74 (header.source?.uuid ?? '')
  • HeadersTab.tsx L155 (!row.source)

Can we keep it required, drop these guards, and remove that test?

collection: OpenCollection | null | undefined,
ancestry: Item[],
item: HttpRequest
): InheritedHeaderRow[] => getInheritedConfig(collection, ancestry, item).headers;

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.

after this PR, nothing in this file calls this function, only its spec file does. can we delete it and point those tests at getInheritedConfig(...).headers ? or use it from 'useInheritance' instead of reading getInheritedConfig directly ?


return (
<Field.Select
testId="auth-mode-select"

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.

testId="auth-mode-select" is fixed and there's no testId prop. With this PR the select can be on the page twice (tab bar and inside the Auth tab on folder/collection settings), and the e2e helper already has to scope one of them by its panel (auth.component.ts:10). Could we add a testId prop and pass a different one from RequestPane and from AuthTab?


return (
<tr key={row.id} className={isLastEmptyRow ? 'empty-row' : ''}>
<tr key={row.id} className={cx(rowClasses)} data-testid={rowTestId?.(row)}>

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.

The row id comes straight from rowConfig.testId(row), so it isn't tied to this table's testId like the other child ids (${testId}-name-input, etc.). Could we prefix it, like ${testId}-${rowTestId(row)}?

Also, the row checkbox (L390) doesn't get a testId, even though Checkbox accepts one. That's why the e2e helper and the unit specs have to find it by role or input[type="checkbox"]. Passing something like ${testId}-enabled-${index} (or the row id) would fix both.

await playground.openTreeItem(['billing', 'customers', 'Get All Customers']);
await playground.selectTab('headers');

await expect(playground.tab('headers')).toHaveText('Headers');

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.

Get All Customers has no own headers, and the tab hides the count at 0, so toHaveText('Headers') would also pass if the count included inherited headers or was missing. Could we use Get All Invoices instead? It has 1 own header and 2 inherited, so expecting a count of 1 proves only own headers are counted.

}

checkbox(name: string): Locator {
return this.row(name).getByRole('checkbox');

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.

getByRole('checkbox') inside the row works, but the other locators in this file use test ids. Once KeyValueTable passes a testId to the row checkbox (see my comment there), could this use that id too?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants