Skip to content

Send attestation tokens on login-server requests - #736

Open
paullinator wants to merge 1 commit into
masterfrom
paul/attestedCaptcha
Open

Send attestation tokens on login-server requests#736
paullinator wants to merge 1 commit into
masterfrom
paul/attestedCaptcha

Conversation

@paullinator

Copy link
Copy Markdown
Member

Summary

  • Add EdgeContext.setAttestationToken and attach x-attestation-token on login-server /api/ requests so attested clients can receive CAPTCHA rate overrides.
  • Treat empty-string tokens as cleared (header omitted).
  • Allow private LAN IPv4 hosts for http/ws server overrides (still reject them for https/wss).

Test plan

  • attestation-header tests: set / clear / empty-string token behavior
  • validateServer tests: LAN http accepted; public IPs and https LAN rejected
  • Login-server requests include x-attestation-token only when a token is set

Add setAttestationToken and attach x-attestation-token so attested
clients can skip CAPTCHA challenges from the login server.

Validate private LAN hosts via real IPv4 octets (not DNS prefix
matches), update the rejection message, and treat empty-string
attestation tokens as cleared.
@cursor

cursor Bot commented Aug 14, 2026

Copy link
Copy Markdown

Current version of PR was reviewed by /review-bugbot with additional instructions on Aug 13, 21:44 PDT. It flagged 0 findings.

Bugbot on commit 095bbe2 is skipped.


if (url.protocol === 'http:' || url.protocol === 'ws:') {
if (url.hostname === 'localhost') return
if (isPrivateHost(url.hostname)) return

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.

Side effect on fake-world routing: makeFakeWorld with allowNetworkAccess: true routes fetches by "passes validateServer -> fakeFetch, throws -> real network" (src/core/fake/fake-world.ts). Private-IP URIs now pass, so a fake-world test pointed at a real LAN dev server (the exact use case this PR enables) silently gets answered by the in-memory fake server instead of the network. If that is not intended, the fake-world path may want to keep the old localhost-only check.

/**
* We only accept *.edge.app or localhost as valid domain names.
* We only accept *.edge.app, localhost, or (for http/ws only) private LAN IPv4.
* https/wss still require localhost or *.edge(test)?.app — private IPs are not

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.

Nit: em-dash in the comment; repo convention is zero em-dashes in committed code (comma or semicolon instead). Full ruleset: https://github.com/EdgeApp/edge-dev-agents/blob/main/.cursor/skills/no-slop/SKILL.md

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants