Expand description
The control API: the only path that will ever be allowed to write.
No CORS headers are emitted anywhere in this module, and OPTIONS is refused. That
combination is the security boundary, so it is worth spelling out.
A page served under an alias origin is untrusted code. If it tries to reach the control API it has to send the token header; a custom header is not CORS-safelisted, so sending it forces a preflight; and a refused preflight means the request is never made. Without the header the request is a 401 instead. An extension is outside CORS by virtue of its host permissions, so none of this impedes it.
The listener also only routes here for requests whose Host is the loopback address,
which guard::classify already separates from alias requests. A proxied request
cannot arrive here at all.
Structs§
- Handshakes
- Completed and failed TLS handshakes, as the extension sees them.
- Token
- A bearer token for the control API.
Enums§
- Source
- Where the token this run is using came from.
Constants§
- FETCH_
SITE_ HEADER - What a browser says about who started a request.
- PATH_
PREFIX - PROTOCOL_
MAX - PROTOCOL_
MIN - Protocol versions this daemon can speak.
- TOKEN_
HEADER - The header the token must arrive in.
Functions§
- from_
a_ page - Check the two things that must hold before any control route runs, returning the refusal if there is one.
- gate
- hello
- json
- route_
of - The route name within the control namespace, e.g.
hello. - state_
dir - Where this daemon keeps the small things it remembers between runs.
- text
- write_
private - Write a file only this account can read, with the permissions set as it is created.