Repository navigation
Conversation
Run curl against hosted apps with a cli_hosted session passed as the hosted-site cookie on stdin. Hosts outside the configured tenant's hosted-app domain are refused, consent and rejected sessions are handled, and bl auth logout removes stored hosted sessions.
damienrj
marked this pull request as ready for review
October 26, 2026 22:28
nathan-thillairajah
left a comment
Contributor
There was a problem hiding this comment.
🤖 left three inline comments on mutation retries, hosted-session logout, and URL globbing.
Resend a request after logging in again only for GET, HEAD and OPTIONS; other methods refresh the session and ask the user to rerun. Revoke stored hosted-app sessions with their hosted cookie on bl auth logout before deleting them. Refuse --no-globoff, --no-disable, --no-get and --no-head, and treat a consent_required JSON body as consent even without X-BB-Consent-Url.
nathan-thillairajah
approved these changes
Oct 27, 2026
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.
Adds
bl curl, a supported way for agents and scripts to call protected BuilderLab hosted apps. Today hosted apps only accept the browser-derived hosted-site session, so there's no supported way tocurlthem, and people copy browser cookies instead.The first call for a tenant runs a
type=cli_hostedbrowser login, which reuses the existing loopback, state and PKCE flow. It stores the resulting hosted-app session in the existing auth storage, separate from the normal CLI session, then runs the systemcurlwith that session as the hosted-site cookie.Security
https://<app>.apps.<org>.<root>URLs for the configured org are accepted. Anything else is refused before any login or request. A session is stored only if the server'scookie_domainis exactly that tenant's hosted-app domain.curlon stdin with--config -, never on the command line.-qignores~/.curlrc, and--globoffkeeps the URL to one request.-v,--trace*,--libcurl,-L,-b,-c,-K,-k,--resolve,-u, extra URLs), as are request bodies read from stdin. Negations that would undo an enforced option or hide the request method (--no-globoff,--no-disable,--no-get,--no-head) are refused too./_compose/server/*getOrigin: https://<host>unless the user sets one.X-BB-Consent-Url, or a{"error":"consent_required"}body, prints the approval URL and exits 3.WWW-Authenticate: BBIdentityon a stored session drops it and logs in again. Only GET, HEAD and OPTIONS are resent automatically; other methods exit 3 and ask the user to rerun, so a mutation is never submitted twice.bl auth logoutrevokes each stored hosted session on the server (best effort), then removes it locally.Depends on
A matching BuilderLab backend change that adds
cli_hostedsessions to hosted-app ingress, and an ingress change that forwards the consent header on denials. Until those ship,bl curlgets the existing 401.Open questions
session_credentialfield of the exchange response. The backend PR does it that way.cookie_domainmust equalapps.<org>.<root>, ignoring a leading dot. A broader domain is refused.builderlab.xyz,builderlabstaging.xyz). Other environments would need adding.