Skip to content

fix(AUTO-288): preserve raw profile paths during token shimming - #5547

Merged
andyMrtnzP merged 2 commits into
mainfrom
fix/AUTO-288-preserve-raw-dot-profile-path
Aug 24, 2026
Merged

andyMrtnzP merged 2 commits into
mainfrom
fix/AUTO-288-preserve-raw-dot-profile-path

Conversation

@xsvfat

@xsvfat xsvfat commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • remove the legacy token query parameter without reconstructing the whole request URL, preserving raw encoded pathname bytes for request hooks
  • cover relative and absolute requests, remaining query parameters, and %2E / %2E%2E profile segments
  • provide the Browserless prerequisite for browserless/enterprise#2245 (AUTO-288)

Assumptions made

  • Browserless request hooks run after moveTokenToHeader and before the general parsed-URL routing step, so a consumer can capture an encoded pathname before WHATWG normalization
  • the general Browserless route parser should remain unchanged; the Enterprise profile route owns the profile-specific capture and restoration behavior
  • the Enterprise dependency must use a published Browserless version, so this PR must merge and release before Enterprise can pin it

Verification

  • npm test -- --grep 'Request Shimming' — 29 passing at the refreshed exact head, including TypeScript compilation
  • npm run build — passed for the product commit before the metadata-only current-main release merge
  • combined Enterprise query-token E2E passed for both . and .. profile names with Browserless commit fcc20e9e6051ef8c579ee753f30a272d9d016b86
  • two literal full-suite attempts stopped on different unrelated browser-integration timing failures; no green full-suite claim is made

Dependency and merge order

  1. Review and merge this Browserless prerequisite, then publish the resulting @browserless.io/browserless version.
  2. Pin that released version in browserless/enterprise#2245 and rerun its final exact-head build, E2E, committed-state review, and fresh-eyes gates.

Linear: AUTO-288


Open in Devin Review

Summary by CodeRabbit

  • Bug Fixes
    • Improved request authentication handling when tokens are supplied in URLs.
    • Tokens are now removed from query strings and securely applied to the Authorization header.
    • Preserved remaining query parameters, including for absolute URLs and encoded path segments.
    • Requests without query parameters continue to work unchanged.

@coderabbitai

coderabbitai Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

Review Change Stack

Walkthrough

moveTokenToHeader now preserves URL paths and non-token query parameters while moving the token to a Bearer authorization header. Parameterized tests cover relative URLs, absolute URLs, encoded dot segments, and query handling.

Changes

Token shimming

Layer / File(s) Summary
Preserve URL and move token to header
src/shim.ts, src/shim.spec.ts
moveTokenToHeader manually separates the query string, removes only token, preserves other parameters and the path, and sets the Bearer authorization header. Tests cover relative and absolute URLs.

Estimated code review effort: 3 (Moderate) | ~15–30 minutes

Merge Risk: 🔵 Low · up to 947d7

The change preserves request paths while removing authentication query parameters, but empty token values can still remain in the request URL. The PR is otherwise mergeable with owner follow-up to remove the parameter whenever it is present.

Suggested reviewers: artiom

Poem

I’m a rabbit with tokens tucked tight,
Now Bearer headers carry them right.
Paths keep their shape, queries stay true,
Dot segments pass cleanly through.
Hop, hop—the shim tests shine!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: preserving raw profile paths during token shimming.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/AUTO-288-preserve-raw-dot-profile-path

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

coderabbitai[bot]

This comment was marked as resolved.

@devin-ai-integration devin-ai-integration 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

xsvfat commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Watcher complete at 947d7f664e6a7e23ece617b3f247378eebb5b533: all CI checks are green, CodeRabbit and Devin are complete, and no reviewer-bot thread remains unresolved. The sole CodeRabbit nit (?token= with an empty value) was verified as pre-existing in the old implementation, documented, and resolved without expanding AUTO-288. The PR is conflict-free and mergeable; only human review/merge remains. Announced once in #pr-reviews.

@andyMrtnzP
andyMrtnzP merged commit 2222d9f into main Aug 24, 2026
17 checks passed
@andyMrtnzP
andyMrtnzP deleted the fix/AUTO-288-preserve-raw-dot-profile-path branch August 24, 2026 15:11
artiom pushed a commit that referenced this pull request Sep 2, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.56.1](v2.56.0...v2.56.1)
(2026-09-01)


### Bug Fixes

* **AUTO-288:** preserve raw profile paths during token shimming
([#5547](#5547))
([2222d9f](2222d9f))
* close function pages when user code fails
([#5554](#5554))
([a36bb85](a36bb85))


### Build System & Runtime

* bump Node to 24.20.0 and npm to 11.19.1
([#5553](#5553))
([f1e5077](f1e5077))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: browserless-actions-bot[bot] <186328842+browserless-actions-bot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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