Repository navigation
[fix]: require token for local dev server - #3400
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 18fd73e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Contributor
There was a problem hiding this comment.
No issues found across 6 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant User as End User
participant CLI as CLI Dev Server
participant Runtime as Worker Runtime
participant SDK as Functions SDK
participant Browser as Browserbase API
participant File as Handler Code
Note over User,File: Function Invocation Flow
User->>CLI: POST /v1/functions/test-function/invoke (public URL)
CLI->>CLI: Generate 32-byte token, store in runtime API path
CLI->>File: Invoke handler within worker process
File->>Runtime: Execute business logic
Runtime->>SDK: Poll for invocation (token-prefixed path)
SDK->>CLI: GET /{token}/2018-06-01/runtime/invocation/next
CLI->>Runtime: Return invocation payload
Runtime->>SDK: Execute handler with payload
SDK->>SDK: Process result
alt Successful execution
SDK->>CLI: POST /{token}/2018-06-01/runtime/invocation/{id}/response
CLI->>Runtime: Completion acknowledged
Runtime->>Browser: Release session (POST /v1/sessions/{id})
Browser-->>Runtime: Session released
Runtime-->>User: 200 + invocation result
else Handler error
SDK->>CLI: POST /{token}/2018-06-01/runtime/invocation/{id}/error
CLI->>Runtime: Error received
Runtime->>Browser: Release session (POST /v1/sessions/{id})
Browser-->>Runtime: Session released
Runtime-->>User: 500 + error details
end
Note over CLI,Runtime: Token Authentication
alt Valid token in runtime path
CLI->>Runtime: Accept poll/response/error request
else Invalid or missing token
CLI->>CLI: Return 404 (Not Found)
Note over CLI: Rejects malicious/unintended callers<br/>Public invoke URL stays unchanged
end
Note over CLI,File: Hot Reload Flow
File->>CLI: Detect file change in watched project
CLI->>Runtime: Restart worker with new token
Runtime->>SDK: Reconnect with fresh token
SDK->>CLI: GET /{new-token}/2018-06-01/runtime/invocation/next
CLI->>Runtime: Invalidate old token, accept new one
shrey150
approved these changes
Nov 5, 2026
This was referenced Nov 5, 2026
shrey150
pushed a commit
that referenced
this pull request
Nov 13, 2026
Release Browse independently of the Stagehand SDKs. Merging this PR publishes the CLI from the merged commit. ## 0.11.4 ### Patch Changes - [#3426](#3426) [`f93e6d1`](f93e6d1) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - Report an error when an active browser session disconnects during command startup instead of automatically starting a replacement. - [#3379](#3379) [`73fdba0`](73fdba0) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - remove unused deepmerge dependency - [#3330](#3330) [`dc8eb40`](dc8eb40) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - bump zod to 4.6.6 - [#3289](#3289) [`aa67fee`](aa67fee) Thanks [@shrey150](https://github.com/shrey150)! - Add `--stagehand` flag to `browse cloud extensions upload`. - [#3439](#3439) [`2fe947c`](2fe947c) Thanks [@github-actions](https://github.com/apps/github-actions)! - Make `browse doctor` fail and show the cause when the session's last browser start failed - [#3400](#3400) [`ce298c6`](ce298c6) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - Add token validation to internal local Functions runtime requests - [#3408](#3408) [`6a56cbb`](6a56cbb) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - Fix Windows package-manager command launching for Functions and templates, and terminate child processes when skill installation times out. - [#3391](#3391) [`3fbda6b`](3fbda6b) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - Validate daemon directory locations before connecting to a session. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
why
browse functions devshould only accept runtime requests from the worker it starts.what changed
Summary by cubic
Requires a random per-run token for
browse functions devruntime requests so only the worker the command starts can poll for invocations or post results, instead of any caller on the same port.@browserbasehq/sdk-functionsas a dev dependency to verify the dev server works with the real SDK.Written for commit 18fd73e. Summary will update on new commits.