Skip to content

refactor!: Replace getBearerToken constructor parameter with direct AuthenticationController:getBearerToken call#578

Merged
Mrtenz merged 2 commits intomainfrom
mrtenz/bearer-token
Apr 2, 2026
Merged

refactor!: Replace getBearerToken constructor parameter with direct AuthenticationController:getBearerToken call#578
Mrtenz merged 2 commits intomainfrom
mrtenz/bearer-token

Conversation

@Mrtenz
Copy link
Copy Markdown
Member

@Mrtenz Mrtenz commented Apr 2, 2026

Rather than providing a getBearerToken parameter to the constructor, the controller now directly calls AuthenticationController:getBearerToken.


Note

Medium Risk
Breaking API change: authentication token retrieval moves from a constructor callback to a required messenger action, which can break consumers if allowlists aren’t updated. It also changes how Authorization headers are attached to outbound API calls, so misconfiguration could impact authenticated requests.

Overview
Removes the getBearerToken constructor option and instead fetches bearer tokens by calling AuthenticationController:getBearerToken via the controller messenger for Transaction API and Sentinel requests.

Updates the controller’s allowed action types/messenger delegation and adjusts tests to mock the new messenger action and assert Authorization header behavior. Dependency updates include bumping @metamask/messenger to ^1.1.0 and adding @metamask/profile-sync-controller (plus lockfile/lavamoat adjustments), and the changelog documents the breaking migration steps.

Written by Cursor Bugbot for commit 2195fdd. This will update automatically on new commits. Configure here.

@Mrtenz Mrtenz requested a review from a team as a code owner April 2, 2026 10:58
@socket-security
Copy link
Copy Markdown

socket-security bot commented Apr 2, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​metamask/​base-controller@​9.0.0 ⏵ 9.0.1100 +11007393 +6100
Added@​metamask/​messenger@​1.1.0991007893100
Updated@​metamask/​profile-sync-controller@​28.0.0 ⏵ 28.0.2971008798 +2100
Updated@​metamask/​json-rpc-engine@​10.2.3 ⏵ 10.2.499 +110010094 +3100

View full report

@socket-security
Copy link
Copy Markdown

socket-security bot commented Apr 2, 2026

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring alerts on:

  • @metamask/snaps-controllers@19.0.0

View full report

@Mrtenz
Copy link
Copy Markdown
Member Author

Mrtenz commented Apr 2, 2026

@SocketSecurity ignore npm/@metamask/snaps-controllers@19.0.0

This is ours, and seems to be a false positive.

@Mrtenz Mrtenz merged commit d323601 into main Apr 2, 2026
18 checks passed
@Mrtenz Mrtenz deleted the mrtenz/bearer-token branch April 2, 2026 13:21
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