Skip to content

proofline login opens and prints the server's sign-in address and code without checking them #81

Open

Description

@Ahmar004

In simple words

When you run proofline login, the server sends back a web address (the approval page) and a short code. The CLI opens that address in your browser without checking that it is on the Proofline site, and prints the code without removing hidden control characters.

Why it happens

  1. device::start (src/device.rs:64-86) reads the server's reply and keeps verification_uri, verification_uri_complete and user_code exactly as sent.
  2. login (src/lib.rs:685-707) prints user_code with format!, and passes the address to webbrowser::open after only checking that it parses as some URL. Any scheme and any host pass: https://other-site.example/…, file:///…, or a custom protocol handler.
  3. A control character is an invisible character that tells the terminal to do something, such as ESC[2J (clear the screen). A bidi control such as U+202E makes the terminal show the following text reversed. Both reach the terminal unchanged.

Everywhere else the CLI treats server text as untrusted: problem details go through text::terminal_safe (src/api.rs), and review fields through text::one_line. Proofline's own Chrome extension refuses this exact field when it is off-origin (lib/proofline/auth.ts: new URL(code.verification_uri_complete).origin !== PROOFLINE_ORIGIN). The CLI's sign-in is the one path that skips both.

Who is affected

With the default https://proofline.sh this is defense in depth. It matters when the origin is custom (--base-url / PROOFLINE_BASE_URL, e.g. a local or staging console), mis-routed, or compromised: the reply can then send the person to a look-alike approval page, open a file: or custom-scheme URL, or rewrite the sign-in prompt.

How to see it

A tiny stand-in server whose /auth/device/code answers "user_code": "WDJB-MJHT\u001b[2J‮THJM", then:

proofline login --base-url http://127.0.0.1:8765 --no-browser 2>&1 | cat -v
Your sign-in code is WDJB-MJHT^[[2JM-bM-^@M-.THJM.

The ^[[2J and the U+202E bytes go straight to the terminal. With "verification_uri_complete": "https://proofline-login.example/approve" the reply is accepted, and without --no-browser that page is opened.

Suggested fix

In device::start, refuse a reply whose verification_uri / verification_uri_complete is not on http.origin(), or whose user_code holds a control or bidi character, with a regression test in tests/http.rs. I have a PR ready.

Activity

  1. Ahmar004 commented on Nov 23, 2026

    @Ahmar004
    Author

    I had solved this issue in a PR at #82
    Kindly have a look at that PR,
    Thanks!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions