Threat model
A hostile or compromised registry can try to:- Make Cyrnel fetch internal addresses (SSRF): e.g. via
downloadUrl, capability URLs, redirects, or the token endpoint. - Exhaust memory/disk with unbounded downloads.
- Install malicious modules. Module installs are subject to the same scrutiny as any locally-authored module - see Security.
- Exfiltrate credentials via redirects - mitigated by per-hop rescoping and transport rules.
Egress guard
Applied to every registry fetch: well-known, browse pages, version descriptors, definition/archive/icon downloads, and oauth2 token endpoints.
For each resolved address, in order:
- Blocklist:
CYRNEL_REGISTRY_BLOCKED_IPS(CIDR CSV) denies; takes priority over everything. - Allowlist:
CYRNEL_REGISTRY_ALLOWED_IPS(CIDR CSV) permits and bypasses the default guard. - Block-all:
CYRNEL_BLOCK_ALL_REGISTRIES=1|truedenies everything that didn’t match the allowlist. - Default guard: the address must be a valid IP with range
unicast(private, loopback, link-local, multicast, and reserved ranges are blocked unless allowlisted). - Allow.
502 (e.g.
Registry download blocked: address is not publicly routable.).
Size caps
Enforced twice per download - viacontent-length up front and by
streamed byte-counting - and reported as 413:
Zero-byte downloads fail with
400 Downloaded <label> was empty. There is
no retry logic anywhere in the fetch path (a single oauth2 401 retry
excepted).
Integrity
Advertised hashes are optional but without them Cyrnel cannot detect a
mutated artifact - always publish them.
Auth transport
Credential-bearing requests require https; plaintext is refused with502 unless the resolved address is loopback or in
CYRNEL_REGISTRY_AUTH_INSECURE_CIDRS. Credentials attach only within the
registry’s origin + base-path scope and are stripped on cross-origin hops
(which also defeats redirect-based credential theft). See
Authentication.
Environment variables
All registry-related runtime variables:
Related storage: registry ids/base URLs and auth config live in the
registries/registry_auth tables; registry_auth.config and token
are encrypted at rest with CYRNEL_SECRETS_KEY (AES-256-GCM). See
Secrets.
Author checklist
- Serve over https (or loopback) if you require auth.
- Keep artifacts immutable by version and descriptors stable forever: updates re-resolve stored URLs.
- Publish
hashfor every artifact and icon. - Apply request filters before pagination and keep ordering stable.
- Keep pages under the 256 KiB serialized cap.
- Don’t require auth for
/.well-known/registry.json: it must always be discoverable. - Don’t rely on Cyrnel honoring redirects beyond 5 or issuing a
304. - Validate and sandbox anything your registry installs onto servers.