Report a problem
Please do not open a public issue for a security problem. Use GitHub’s private report: the “Security” tab of this repository, then “Report a vulnerability”. Say what you did, what you saw and what you expected. A small set of commands that shows the problem helps most. We answer as soon as we can. Magpie is a small project with no paid support, so there is no promised time.What counts
- Data of one tenant that another tenant can read or change (
magpie-server --tenants-dir). - A request that runs without a valid API key when keys are on, or that does more than the rights of its key.
- A request, a span or a file that makes the server or the library crash, hang or use memory without limit.
- Accepted writes that are lost or changed.
- Deleted data that is still readable after
purge_deletedreports that it is gone.
What to know before you run it
- Without
--auth keysthe server has no authentication. It then listens on127.0.0.1only by default. Do not put it on a public address without keys and TLS. --auth trusted-headertrusts thex-magpie-tenantheader. Use it only behind a proxy that authenticates the caller.- API keys are stored as hashes in the key file. The key itself is shown once, by
keygen. - The store is not encrypted on disk. Use an encrypted disk or bucket if you need that.
- Prompts and replies are stored as they arrive, unless a mask policy (
--mask) replaces private data first (Server reference, “Masking”). - A store is one folder. Anyone who can read the folder can read all of its data.
- The server serves a read-only web viewer at
/on its HTTP port (--no-uiturns it off). Its files are public and hold no data; the API it calls keeps the same keys. It shows every value as text and sends a strict Content-Security-Policy with Trusted Types (crates/server/README.md, “Viewer”). Its code is inweb/viewer/; the built files incrates/server/viewer/are checked against it bycargo test -p magpie-server. A script that breaks out of that would count as a security problem.
What the server does with requests from outside
- A page of another site cannot make a browser send a write (
403), on the HTTP port and on the gRPC port; the routes that write takeapplication/jsononly, and the gRPC portapplication/grpconly (crates/server/README.md, “Query API”). - With no keys on a loopback address (the default), or with no keys and
--allowed-host, the server answers only tolocalhost, IP addresses and the names of--allowed-host: a page of a host name that its owner points at127.0.0.1(DNS rebinding) is refused (README “Host names”). With keys there is no host check: a rebound page has no key. - An error never quotes the request: no value, number, name, key or header comes back, also not in the report of an
import. A message whose shape the server does not know gives a fixed reason. A hash and a length of what was left out do come back. - A write takes one of 16 places before its body is read (64 more wait; then
429). With keys, the key is checked first, on both ports. - The decode of an OTLP request or a score write is counted from its bytes before it is made (protobuf by its schema, JSON by every value in it; not below the real decode for any body shape measured in
crates/server/tests/budget_alloc.rs, but an estimate, not a proof); one that would cost more than--ingest-memory-mbis refused (413), and the ones in flight share that budget. The spans of a request are counted before the decode too, and an OTLP/JSON body with an array directly in an array (the array form of a struct, which no encoder writes and the count would not follow) is refused (400). One OTLP request may not map to more than--max-spans-per-requestspans or--max-mapped-bytesbytes (413). - Slow and idle clients have deadlines (
--header-timeout,--body-timeout,--grpc-max-connection-age, which closes gracefully), and each port has at most--max-connectionsconnections (README “Slow clients”). - One list of a request (attributes, events, links, values, a JSON array, the words of a search) has at most
--max-list-itemsitems, counted before the decode (413), and a protobuf field of one message may come only once (400; the decoder would join the lists of its copies): on macOS the allocator keeps the memory of a decoded very long list, and this cap is what stops that (docs/FINDINGS.mdF78; not measured on Linux). - With TLS, a server certificate that is not valid now stops the start (another certificate of the file only warns), one that ends within 30 days gets a warning, and failed handshakes are logged (at most one line a minute per port, no client address): an expired certificate is not a silent loss of every span (D-ur-5).
- Not bounded yet: queries, deletes and purges take no place, and queries have no work budget. The spans that one OTLP request maps to (each span with a copy of its resource, at most
--max-mapped-bytes, default 128 MiB) are not in the ingest memory budget: 16 small requests that copy a resource of 100 KB into each span took the server to 5.6 GB (2.8 GB with the old cap of 64 MiB;docs/FINDINGS.mdF99). On a small machine, lower--max-mapped-bytes.
Versions
Magpie is not released yet. Until the first release, fixes go tomain only.