Skip to content

usage-limits: machine-wide ps -ax lifts a CSRF token from whatever Antigravity process matches first #132

Description

@pitimon

What

src/lib/usage-limits.js:1354 runs /bin/ps with ["-ax", "-o", "pid=,command="]. -a widens the
scan to every account on the machine. detectAntigravityProcess then reads the matched process's
command line and extracts --csrf_token (usage-limits.js:1365) and --extension_server_port,
returning them together with the pid.

On a shared host, the process it matches need not belong to the user running TokenTracker.

What is and is not established

  • Established: the scan is machine-wide, and a CSRF token is lifted out of whatever process
    matches first. Verified on the reporting machine: /bin/ps -axo user= | sort -u lists 40 distinct
    users including a second human account.
  • Established: the token is used to make an internal request
    (usage-limits.js:1593-1616 passes it as the X-Codeium-Csrf-Token header).
  • NOT established: whether the token or pid reaches the GET /functions/tokentracker-usage-limits
    response. The served shape at usage-limits.js:1434 / :1486 is quota data, but not every
    getUsageLimits branch was traced. This should be settled before deciding severity.

Why it is filed separately

#129 narrowed the other ps call site — src/lib/process-list.js PS_ARGS is now -x — because
that one feeds an unauthenticated HTTP endpoint. This call site was deliberately left alone there:
nothing in that PR exercises this path, so changing it would have been an untested edit to an
unrelated feature.

Suggested work

  1. Trace every getUsageLimits return branch and confirm whether csrfToken/pid can reach the
    HTTP response. That answer sets the severity.
  2. Scope the scan to the current user (-x, or an explicit euid filter), or if a machine-wide scan
    is genuinely needed here, add user= to the -o spec and filter by owner in code before
    matching.
  3. Add a regression test on the literal argv, as test/process-list.test.js:23 does — a real ps
    run on a single-user machine looks identical either way, so observed output cannot catch this.

Context

Found during the QA gate on #129: #129 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions