Repository navigation
Eight PRs (#28–#32, #52–#54) rolled into a coordinated release
closing the remaining h2ck.me v1 NEXT-TASKS backlog: T-4, T-7, T-8,
T-12, T-13, T-15, T-18, T-19. Every open finding from the h2ck.me v1
audit is now landed.
No breaking wire-behaviour changes. The only operator-visible shift
is the container runtime — see "Upgrading from 0.4.0-alpha" below.
Upgrading from 0.4.0-alpha
Container runtime switched to distroless (T-12 / G1). If your
deployment pulls docker.io/turnerrainer/tim:0.4.1-alpha (or
ghcr.io/...) unchanged, no action needed — the smaller, zero-CVE
image runs as nonroot:nonroot (UID 65532) and starts on the same
port with the same env vars.
If your deployment customises the container in any of these ways,
adjust before upgrading:
- Custom
Dockerfile FROM tim:0.4.0-alpha— the base is now
gcr.io/distroless/cc-debian12:nonroot. No shell, noapt, no
curl. Move anyRUNsteps into an earlier builder stage. - Custom HEALTHCHECK invoking
curl— swap to
["CMD", "/app/tim", "healthcheck"]. Thetim healthcheck
subcommand probes/healthvia reqwest and exits 0/1; no shell
needed. docker exec <container> sh— no shell exists. Use
kubectl debug --image=busyboxon K8s, or attach a debug
sidecar in compose.- Bind-mounted paths under
/opt/tim/keys— the container user
is UID 65532 (was 1000). Ensure the file mode allows reads by
that UID. tinias PID 1 — removed. TIM is a single-process axum server;
child-reaping is a no-op. K8s ordocker run --initcover PID-1
signal forwarding externally if needed.
No schema migration required.
Added
jwt.previous_keyconfig block (T-7 / F-PR-3) — signing-key
rotation with a grace period. JWKS emits both keys and
/introspectaccepts tokens signed by either while
retires_at > now; afterretires_atthe previous key is dropped
from JWKS and refused on verification. Boot +tim doctoremit
WARN when the retirement cliff is within
jwt.rotation_warn_daysdays (default 7). See
book/src/security-hardening.md§Grace-period rotation.tim healthchecksubcommand (T-12) — probes/healthvia
reqwestand exits 0 on 200 / 1 otherwise. Wired as the
docker-compose HEALTHCHECK on the distroless image (which has no
curl/ shell forCMD-SHELL).--urloverrides the default
http://127.0.0.1:<server.port>/health;--timeout-seconds
bounds the probe (default 5s).
Changed
- Docker runtime image switched to distroless (T-12 / G1). Was
debian:13.6-slim; nowgcr.io/distroless/cc-debian12:nonroot.
Trivy--severity HIGH,CRITICALcount drops from 65 (3
CRITICAL + 62 HIGH) to 0. Image size shrinks from 119 MB to
32 MB. No shell, no package manager, nocurl, nouseradd. See
"Upgrading from 0.4.0-alpha" above. .cargo/audit.toml(T-13) — reviewedRUSTSEC-2023-0071(rsa
Marvin timing) rationale. Confirmed session-at-rest encryption
uses ChaCha20-Poly1305 (not RSA), noRsaPrivateKey::decrypt
call path exists. Next review 2027-03-18.
Fixed
- JWKS thundering herd (T-4 / concurrency mini-audit R-3).
src/oauth2/jwks.rsreplaces theget()+insert()cache-miss
path with Moka'stry_get_with, coalescing N concurrent misses on
the samejwks_uriinto a single upstream fetch. Regression pin:
oauth2::jwks::tests::concurrent_misses_coalesce_to_single_upstream_fetch
— 100 concurrent misses → 1 upstream hit. - Attacker-controlled fields clipped in error responses (T-18 /
AP-6). Provider IDs, OIDC callbackerror+
error_description, id_token parse errors, JWK decode errors,
and?jwt=echoes are all clipped to 256 characters via
error::clip_untrusted. Bounds response payload from a malformed
input and caps downstream log-echo blast radius. Regression pin:
tests/security_error_echo_clipped.rs.
Security
- JWT algorithm-confusion regression pins (T-8 / G4).
tests/security_jwt_alg_confusion_v1.rsproves TIM refuses
alg=nonewith a valid kid, HS256-signed-with-public-key, and
every symmetric algorithm +noneforging the signer's kid — all
resolve to{"active": false}. Pins the positive control against
a future regression that swaps in a permissiveValidation. - Slow-body Slowloris probe (T-15). Verified that
tower_http::timeout::TimeoutLayerbounds body-read too, not
just handler execution: a request that trickles bytes past
server.request_timeout_secondsis aborted at the configured
deadline. Not vulnerable, but pinned by
tests/security_slow_body_timeout.rs— 8s trickle against a 2s
timeout completes in ~2s. - Admin-surface audit (T-19). Enumerated every route in
src/router/mod.rs::build_router; confirmed no accidental public
exposure — every mutating endpoint runs behindAdminAuth, every
session-scoped read behindSessionAuth, the eight
public-by-design endpoints are all protocol-required (health
probes, JWKS, OAuth flow endpoints, RFC 7662 discovery).
Regression pin:tests/security_admin_surface_audit.rs— 5 cases
covering admin/bearer/session/cookie 401s AND that
documented-public routes do NOT 401. Book updated with the full
inventory (§Endpoint auth invariants). Explicit verdict: TIM does
NOT adopt a Ruuter-style/_/*env-gated admin surface — the
current gating is comprehensive and adding/_/*would offer
attackers a distinct env-shape to probe without security benefit.