Skip to content

fix: harden sign-in classification + align take-over messaging - #3527

Merged
tofikwest merged 3 commits into
mainfrom
fix/browser-login-classifier-review
Jul 28, 2026
Merged

fix: harden sign-in classification + align take-over messaging#3527
tofikwest merged 3 commits into
mainfrom
fix/browser-login-classifier-review

Conversation

@tofikwest

@tofikwest tofikwest commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What

Addresses the review findings on our browser sign-in code surfaced in the production-deploy PR (#3521). These touch code merged via #3520; fixes go to main (not the deploy PR).

  • URL as untrusted data (browser-login-classifier): the browser's current URL is now passed to the classification prompt labeled + delimited as untrusted, so page-path text can't steer the outcome. (Query/fragment were already stripped by safeOriginAndPath.)
  • Tighter 2FA-method classification: a device approval, push notification, or email/SMS link is classified as other instead of over-matching a passkey — so take-over guidance matches the page.
  • Consistent take-over messaging (ConnectVendorLoginFlow): the toast and the panel now derive from the same decision, so they can't contradict (e.g. an "enter your code" toast over a "finish sign-in" panel).
  • Tests for classifyLoginOutcome: each outcome, throw → unknown, URL passed as untrusted with secrets stripped, and content-only when no URL is available.

Not included (deliberately)

Two other findings on #3521 are the training team's (portal/complete-training), not this feature — left for them.

Notes

The two classifier changes are prompt/LLM hardening (behavior isn't 100% guaranteed), but they're low-risk and improve correctness; the take-over flow stays interactive, so it degrades gracefully.

Tests

210 API tests (29 suites) + 96 app browser-automations tests green; both apps typecheck clean.


Summary by cubic

Hardens browser sign-in classification and makes take-over messaging consistent. Blocks URL-steered misclassification, delimiter injection, and conflicting toast/panel guidance.

  • Bug Fixes
    • Treat the current URL as untrusted, delimited data in the prompt; strip query/fragment via safeOriginAndPath, ignore non-http(s) schemes, and XML-escape the value.
    • Tighten 2FA detection: device approval, push, or email/SMS link → other; only explicit passkey prompts → passkey/passkey_only.
    • Align ConnectVendorLoginFlow toast and panel to the same decision (2FA vs finish) to avoid contradictions.
    • Add tests for classifyLoginOutcome: each outcome, errors → unknown, content-only with no URL, sanitized URL stays inside <current_url>, and non-http(s) URLs are dropped.

Written for commit d9e1c56. Summary will update on new commits.

Review in cubic

Addresses review findings on the browser sign-in path:
- Treat the browser's current URL as untrusted data in the classification prompt
  (labeled, delimited) so page-path text can't steer the outcome; the query and
  fragment were already stripped.
- Tighten the 2FA-method classifier so a device approval, push notification, or
  email/SMS link is classified as 'other' rather than over-matching a passkey.
- Align the take-over toast and panel to one decision, so they can't contradict
  (e.g. an 'enter your code' toast over a 'finish sign-in' panel).
- Add direct unit tests for classifyLoginOutcome (each outcome, throw -> unknown,
  URL passed as untrusted with secrets stripped, content-only when no URL).
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Jul 28, 2026 8:57pm
comp-framework-editor Ready Ready Preview, Comment Jul 28, 2026 8:57pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
portal Skipped Skipped Jul 28, 2026 8:57pm

Request Review

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/api/src/browserbase/browser-login-classifier.ts Outdated
@vercel
vercel Bot temporarily deployed to Preview – portal July 28, 2026 20:53 Inactive
…scape

A non-http(s) page URL (data:, about:, javascript:, …) isn't percent-encoded and
could carry characters that break out of the <current_url> delimiter. Restrict the
URL hint to http(s) origins and XML-escape the value before interpolation, so it
always stays inside its tag as data. Adds tests for both.
@vercel
vercel Bot temporarily deployed to Preview – app July 28, 2026 20:55 Inactive
@vercel
vercel Bot temporarily deployed to Preview – portal July 28, 2026 20:55 Inactive
@tofikwest
tofikwest merged commit 914cb1e into main Jul 28, 2026
11 checks passed
@tofikwest
tofikwest deleted the fix/browser-login-classifier-review branch July 28, 2026 20:59
claudfuen pushed a commit that referenced this pull request Jul 29, 2026
# [3.111.0](v3.110.1...v3.111.0) (2026-07-29)

### Bug Fixes

* **api:** classify the take-over method on an unclear outcome too ([539fdba](539fdba))
* **api:** only classify a switchable passkey when a code method exists ([#3528](#3528)) ([0d79093](0d79093))
* **app:** make a half-finished connect resumable, not a forced full-screen step ([#3525](#3525)) ([b1afcae](b1afcae))
* **cloud-security:** add missing logGroupName to CreateLogGroup remediation ([#3515](#3515)) ([76ae56c](76ae56c))
* harden sign-in classification + align take-over messaging ([#3527](#3527)) ([914cb1e](914cb1e))
* **integrations:** wrap aws add account form in dialog and scroll into view ([#3526](#3526)) ([07e91ae](07e91ae)), closes [#418](#418)
* make the 2FA take-over universal — tailor guidance to what the page asks for ([#3520](#3520)) ([b12f3fe](b12f3fe))
* **policies:** remove archived policies from framework controls after unlinking ([#3513](#3513)) ([d639df2](d639df2))
* **training:** defer completion email and share canonical training IDs ([#3529](#3529)) ([fecb556](fecb556))
* **training:** remove rbac gate from mark-complete endpoint ([#3501](#3501)) ([8c5e98f](8c5e98f)), closes [#3455](#3455)

### Features

* connection longevity + one-click 'Make permanent' 2FA ([#3524](#3524)) ([7345e3c](7345e3c))
* **policies:** add bulk upload for policy migration ([#3514](#3514)) ([1940f06](1940f06))
* **security-questionnaire:** add browser extension ([#3064](#3064)) ([e678421](e678421))
@claudfuen

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.111.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants