Files
tessera/tests/auth-compat/README.md
Adnan Zahir a9ebded5ba feat: require authentication and own uploads per Outpost (auth M0)
- auth is mandatory by default, including loopback and local proxies; startup refuses a hub with no credentials; TESSERA_LOCAL_DEVELOPMENT is explicit and loopback-only
- legacy uploads are bound to an owning Outpost (PUT /api/v1/orbits/:id/outpost); unowned orbits and sessions fail closed
- typed Principal and payload-free audit_events table
- endpoint authorization contract with tests comparing it to the router
- A00 compatibility spike (tests/auth-compat) and library research
- archive the superseded A00-A25 plan

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 12:59:08 +07:00

117 lines
6.9 KiB
Markdown

# A00 compatibility spike
Evidence date: 11 November 2026. **Compatibility demonstrated; A00 acceptance
still open. This crate is not runtime authentication and does not prove OIDC
token validation, end-to-end revocation, or the self-service stories.**
Run from the repository root:
```sh
rtk proxy env CARGO_TARGET_DIR=target/auth-compat cargo test --locked --manifest-path tests/auth-compat/Cargo.toml
rtk cargo tree --manifest-path tests/auth-compat/Cargo.toml -i libsqlite3-sys
rtk cargo audit --file tests/auth-compat/Cargo.lock
```
The separate workspace/lockfile prevents experimental libraries entering the hub.
Keep this executable evidence until production implementations replace its tests.
No SQLx, second SQLite pool, external policy service, or workflow engine is used.
## Tested candidates
| Crate | Exact version | Features | Declared MSRV | License |
| --- | --- | --- | --- | --- |
| openidconnect | 4.1.0 | reqwest,rustls-tls; defaults off | 1.88 | MIT |
| reqwest | 0.12.28 (resolved) | OIDC feature closure | 1.64 | MIT OR Apache-2.0 |
| tower-sessions | 0.15.0 | defaults off | unspecified | MIT |
| governor | 0.10.4 | std; defaults off | unspecified | MIT |
| async-compression | 0.4.36 | tokio,gzip; defaults off | unspecified | MIT OR Apache-2.0 |
| casbin | 2.10.1 | runtime-tokio; defaults off | unspecified | Apache-2.0 |
| rusqlite_migration | 1.2.0 | defaults only | 1.70 | Apache-2.0 |
| time | 0.3.47 | defaults | 1.88 | MIT OR Apache-2.0 |
| rustls | 0.23.46 (resolved) | reqwest feature closure | 1.71 | Apache-2.0 OR ISC OR MIT |
All six tests pass with local `rustc 1.88.0` on aarch64-apple-darwin, Axum 0.7.9,
Tower 0.5.3, Tokio 1.40.0, rusqlite 0.31.0. No Linux image build was run.
Unspecified MSRV is not assumed: the locked dependency graph was compiled.
Declared licenses were inspected through `cargo info` and target-filtered
`cargo metadata`; cargo-deny has **not** been run, so this is not license clearance.
Tower 0.5 works with current session middleware using Axum 0.7's
`Extension<Session>`. Disable tower-sessions' Axum extractor feature. tower-cookies
still brings axum-core 0.5.6 alongside Axum's 0.4.5, but the actual router/layer
test passes: their extractor traits are not mixed. Do not upgrade Axum solely
to obtain the session extractor. Only one libsqlite3-sys (0.28.0) resolves, including
the migration helper. An Axum major upgrade and an ORM have not been justified.
## Checks and limits
- SQLite SessionStore: collision regeneration, digest-only key and data-only JSON
(never serialize Record containing the bearer ID), rotation invalidates old ID,
auth deadline survives rotation, idle/absolute expiry, stale save after delete
cannot recreate a revoked row. UPDATE-only save is essential. This spike uses
an in-memory SQLite connection, not durable hub sessions or a fake-clock suite.
- Production A07 must additionally bind sessions to active users and an
authoritative revocation generation/deadline: concurrent rotation/create can
otherwise create a new record after a bulk revoke. The spike does not prove
that stronger property. Do not copy it unchanged into runtime.
- Same 14-row exact actor/resource/action matrix for Casbin and SQLite grants:
no grant, reverse/unrelated relation, QA capture/download separation,
developer scope, service, Outpost, admin, anonymous and unknown action. Both
pass; removal denies on the next evaluation. Expiry/group/user-active/domain
safety guards still belong in A11 tests.
- Prefer typed permission + direct SQL grants for the fixed permission set.
Casbin still requires SQL persistence, reload/invalidation, list filtering and
domain guards, while the exact-scope query already implements this evaluator.
The prototype does not justify a new policy source/cache. Casbin is rejected
for runtime; this old comparison candidate also resolves unmaintained
smartstring. It is not a recommendation to ship casbin 2.10.1.
- governor keyed quota rejects source A's second request without consuming B's
quota. Semaphore admission and trusted-source extraction are A08 work.
- gzip magic, decompression and exact synthetic SQL bytes pass. Not an export
quota, memory, disconnect or disk-full benchmark (A21).
- OIDC HTTP client builds with redirects disabled and S256 PKCE. Discovery,
claims, signed fixtures, JWKS rotation/outage, nonce/state replay and IdP
browser verification remain A09/A25 work, not covered by this smoke test.
- rusqlite_migration can use the same Connection and advance user_version.
Production already has idempotent migrations; retain those until a numbered
baseline migration is designed in A24. No helper enters runtime yet.
## Audit evidence and release blockers
`cargo-audit 0.21.2` could not parse current RustSec CVSS 4 records. A temporary
0.22.0 installation (MSRV 1.85) under `/tmp/tessera-auth-tools` successfully
audited both lockfiles. No advisory ignore or weakened validation was added.
Initial baseline audit: **10 vulnerabilities**, plus two unmaintained warnings
and two Tokio unsound warnings. Initial spike: **12 vulnerabilities**. Updating
only the spike's resolved rustls/webpki to 0.23.46/0.103.16 and pinning time 0.3.47
removed its TLS/time findings; six tests still pass. Final spike still reports:
- [RUSTSEC-2026-0459](https://rustsec.org/advisories/RUSTSEC-2026-0459.html):
bundled SQLite via libsqlite3-sys 0.28.0; patched binding >=0.39.0.
- [RUSTSEC-2023-0071](https://rustsec.org/advisories/RUSTSEC-2023-0071.html):
RSA 0.9.10, patched >=0.10.0. openidconnect 4.1.0 still depends on 0.9.
Tessera's intended RP uses public-key verification, not RSA private-key
decryption/signing; document reachability before any narrowly scoped exception.
Do not silently suppress it or write a replacement verifier.
- Tokio 1.40.0 unsound warnings: RUSTSEC-2025-0023 and RUSTSEC-2026-0386;
a common patched branch is 1.51.6 (MSRV 1.71).
Workspace runtime TLS is **still** rustls 0.23.23/webpki 0.102.8 with its baseline
findings: RUSTSEC-2026-0346, -0285, -0348, -0349; webpki -0104, -0098, -0099,
-0049, -0382. The runtime manifest/lockfile was deliberately not changed by this
isolated experiment. Existing unmaintained warnings concern proc-macro-error and
rustls-pemfile. Release approval requires triage/remediation, not merely compilation.
Further A00 work: prove a patched SQLite baseline, test required upgrades across
workspace and old DBs, resolve/triage RSA and Tokio, run cargo-deny, and re-audit.
rusqlite 0.41.1 declares Rust 1.89, while libsqlite3-sys 0.39.0 declares 1.88;
do not assume the current compiler or migration helper supports the upgrade.
Record a separate compiler/binding migration slice if needed. No runtime auth
library has been selected as release-ready until these checks pass.
Primary API references were fetched through Context7:
`/ramosbugs/openidconnect-rs`, `/maxcountryman/tower-sessions`, `/apache/casbin-rs`.
Published package manifests/metadata and RustSec were checked directly; versions
were not selected solely from a `latest` documentation URL.