From f6a41ee70265224cabe6d7c06f57321151a69678 Mon Sep 17 00:00:00 2001 From: Adnan Zahir Date: Sat, 14 Nov 2026 12:58:46 +0700 Subject: [PATCH] chore: raise the dependency baseline for OIDC (auth M1) Clears every RustSec vulnerability in the workspace so openidconnect can be added without inheriting known issues. - rustls 0.23.23 -> 0.23.46 (webpki 0.103.17), tokio 1.40 -> 1.54 - rusqlite 0.31 -> 0.41.1 (SQLite binding 0.39.1); Rust 1.88 -> 1.89 as 0.41 requires - drop unmaintained rustls-pemfile in favour of rustls::pki_types::pem - add deny.toml (advisories, licenses, bans, sources); mark crates publish = false - add tasks/auth-plan.md with per-milestone auth plan and M1 results Co-Authored-By: Claude Sonnet 5.5 --- Cargo.lock | 188 ++++++++++++---------------- Cargo.toml | 4 +- Dockerfile | 2 +- crates/tessera-agent/Cargo.toml | 4 +- crates/tessera-agent/src/http.rs | 13 +- crates/tessera-cli/Cargo.toml | 1 + crates/tessera-core/Cargo.toml | 1 + crates/tessera-demo/Cargo.toml | 1 + crates/tessera-hub/Cargo.toml | 4 +- crates/tessera-hub/src/mtls.rs | 13 +- crates/tessera-providers/Cargo.toml | 1 + crates/tessera-store/Cargo.toml | 1 + deny.toml | 28 +++++ rust-toolchain.toml | 2 +- tasks/auth-plan.md | 80 ++++++++++++ 15 files changed, 208 insertions(+), 135 deletions(-) create mode 100644 deny.toml create mode 100644 tasks/auth-plan.md diff --git a/Cargo.lock b/Cargo.lock index 4ce1c4d..d081204 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,21 +2,6 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "addr2line" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e567177890eb1617b1f774005b66b26b2377afd138a2ca37aae7d8f0c81429d4" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler2" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" - [[package]] name = "aead" version = "0.5.2" @@ -52,18 +37,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "ahash" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - [[package]] name = "aho-corasick" version = "1.1.5" @@ -252,21 +225,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "backtrace" -version = "0.3.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f4220217f3288537b83684130f42fad43320b1c3b805f1910d683d52ded24f" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-link", -] - [[package]] name = "base64" version = "0.22.1" @@ -561,6 +519,12 @@ version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + [[package]] name = "form_urlencoded" version = "1.2.2" @@ -648,28 +612,28 @@ dependencies = [ "polyval", ] -[[package]] -name = "gimli" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1033caf0b349c518623b5396bfb2cf0bddf44f0306d543a250e5743297aafd10" - [[package]] name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" dependencies = [ - "ahash", + "foldhash", ] [[package]] name = "hashlink" -version = "0.9.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" +checksum = "a596f1b20ed2cc5ecac41a164aaebc7258057060f06c0cf7a2ba3991ee7990fb" dependencies = [ - "hashbrown", + "hashbrown 0.17.1", ] [[package]] @@ -828,7 +792,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.14.5", "serde", ] @@ -888,9 +852,9 @@ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" [[package]] name = "libsqlite3-sys" -version = "0.28.0" +version = "0.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f" +checksum = "14a5f01b87b92705d07b433c06f96cbc764637d81a0bffb5734ce17cf0f9a2b3" dependencies = [ "cc", "pkg-config", @@ -961,15 +925,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" -[[package]] -name = "miniz_oxide" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" -dependencies = [ - "adler2", -] - [[package]] name = "mio" version = "1.2.4" @@ -1038,15 +993,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "object" -version = "0.40.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd229a0361b9d0d4396176e02d65897f487eebeab7caa6d443855ee152ca0b9c" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.21.4" @@ -1322,10 +1268,19 @@ dependencies = [ ] [[package]] -name = "rusqlite" -version = "0.31.0" +name = "rsqlite-vfs" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" +checksum = "353b74f9810d5b085b6c42c9d86a5f0fdb795553235cdd48753b32e3809d18a7" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "rusqlite" +version = "0.41.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da9bba6f3506135e120a6586df05be18b48d18896600646a4bec8f993d91a594" dependencies = [ "bitflags", "fallible-iterator", @@ -1333,14 +1288,9 @@ dependencies = [ "hashlink", "libsqlite3-sys", "smallvec", + "sqlite-wasm-rs", ] -[[package]] -name = "rustc-demangle" -version = "0.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb" - [[package]] name = "rustix" version = "1.1.6" @@ -1356,9 +1306,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.23" +version = "0.23.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47796c98c480fce5406ef69d1c76378375492c3b0a0de587be0c1d9feb12f395" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" dependencies = [ "aws-lc-rs", "log", @@ -1382,15 +1332,6 @@ dependencies = [ "security-framework", ] -[[package]] -name = "rustls-pemfile" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" -dependencies = [ - "rustls-pki-types", -] - [[package]] name = "rustls-pki-types" version = "1.15.1" @@ -1402,9 +1343,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.8" +version = "0.103.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +checksum = "e3a0760a887c14823fca5a1c970b01d47c328c696c0c64829d1df50e8f853fd5" dependencies = [ "aws-lc-rs", "ring", @@ -1605,12 +1546,12 @@ checksum = "149309498a5f7334b12ddae0cad8aba81ce785fe91755068867e017cf98fee46" [[package]] name = "socket2" -version = "0.5.10" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -1619,6 +1560,16 @@ version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e" +[[package]] +name = "sqlite-wasm-rs" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cd504cecbfe7eef649988840f9a6cb768d11085efec138f8e99f160632d867" +dependencies = [ + "cc", + "rsqlite-vfs", +] + [[package]] name = "strsim" version = "0.10.0" @@ -1692,7 +1643,6 @@ dependencies = [ "hex", "rustls", "rustls-native-certs", - "rustls-pemfile", "serde", "serde_json", "sha2", @@ -1734,7 +1684,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "thiserror", + "thiserror 1.0.69", "utoipa", "uuid", ] @@ -1774,7 +1724,6 @@ dependencies = [ "rcgen", "rusqlite", "rustls", - "rustls-pemfile", "serde", "serde_json", "sha2", @@ -1827,7 +1776,7 @@ dependencies = [ "sha2", "tempfile", "tessera-core", - "thiserror", + "thiserror 1.0.69", "tokio", "tracing", "uuid", @@ -1840,7 +1789,16 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", ] [[package]] @@ -1854,6 +1812,17 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + [[package]] name = "thread_local" version = "1.1.10" @@ -1884,11 +1853,10 @@ checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" [[package]] name = "tokio" -version = "1.40.0" +version = "1.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" dependencies = [ - "backtrace", "bytes", "libc", "mio", @@ -1897,18 +1865,18 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] name = "tokio-macros" -version = "2.4.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.119", + "syn 3.0.10", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 8ad3212..35acd62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,9 +29,9 @@ rand = "0.8" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" sha2 = "=0.10.8" -rusqlite = { version = "=0.31.0", features = ["bundled"] } +rusqlite = { version = "=0.41.1", features = ["bundled"] } thiserror = "1.0" -tokio = { version = "=1.40.0", features = ["full"] } +tokio = { version = "1.51.6", features = ["full"] } tokio-cron-scheduler = "0.13" tower = "0.5" tower-http = { version = "0.6", features = ["fs", "trace", "cors"] } diff --git a/Dockerfile b/Dockerfile index 7dda586..067a4d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ RUN npm ci COPY web/ ./ RUN npm run build -FROM rust:1.88-bookworm AS rust +FROM rust:1.89-bookworm AS rust WORKDIR /build COPY Cargo.toml Cargo.lock* ./ COPY crates ./crates diff --git a/crates/tessera-agent/Cargo.toml b/crates/tessera-agent/Cargo.toml index 333ab8f..84a3abb 100644 --- a/crates/tessera-agent/Cargo.toml +++ b/crates/tessera-agent/Cargo.toml @@ -3,6 +3,7 @@ name = "tessera-agent" version.workspace = true edition.workspace = true license.workspace = true +publish = false [[bin]] name = "tessera-agent" @@ -23,6 +24,5 @@ base64 = "0.22" tempfile.workspace = true sha2.workspace = true hex.workspace = true -rustls = { version = "=0.23.23", default-features = false, features = ["ring", "std"] } -rustls-pemfile = "=2.2.0" +rustls = { version = "=0.23.46", default-features = false, features = ["ring", "std"] } rustls-native-certs = "0.8" diff --git a/crates/tessera-agent/src/http.rs b/crates/tessera-agent/src/http.rs index 4735b91..9526110 100644 --- a/crates/tessera-agent/src/http.rs +++ b/crates/tessera-agent/src/http.rs @@ -226,19 +226,16 @@ fn connect_tls( } fn load_certs(path: &std::path::Path) -> Result>> { - let mut reader = - BufReader::new(File::open(path).with_context(|| format!("open {}", path.display()))?); - rustls_pemfile::certs(&mut reader) + use rustls::pki_types::{pem::PemObject, CertificateDer}; + CertificateDer::pem_file_iter(path) + .with_context(|| format!("open {}", path.display()))? .collect::, _>>() .context("parse certificate") } fn load_key(path: &std::path::Path) -> Result> { - let mut reader = - BufReader::new(File::open(path).with_context(|| format!("open {}", path.display()))?); - rustls_pemfile::private_key(&mut reader) - .context("parse private key")? - .context("no private key in client key file") + use rustls::pki_types::{pem::PemObject, PrivateKeyDer}; + PrivateKeyDer::from_pem_file(path).context("parse private key in client key file") } #[allow(dead_code)] diff --git a/crates/tessera-cli/Cargo.toml b/crates/tessera-cli/Cargo.toml index edc55f5..29a87ec 100644 --- a/crates/tessera-cli/Cargo.toml +++ b/crates/tessera-cli/Cargo.toml @@ -3,6 +3,7 @@ name = "tessera-cli" version.workspace = true edition.workspace = true license.workspace = true +publish = false [[bin]] name = "tessera" diff --git a/crates/tessera-core/Cargo.toml b/crates/tessera-core/Cargo.toml index c02a9cf..67437a1 100644 --- a/crates/tessera-core/Cargo.toml +++ b/crates/tessera-core/Cargo.toml @@ -3,6 +3,7 @@ name = "tessera-core" version.workspace = true edition.workspace = true license.workspace = true +publish = false [dependencies] anyhow.workspace = true diff --git a/crates/tessera-demo/Cargo.toml b/crates/tessera-demo/Cargo.toml index e4f70ae..e5dfb66 100644 --- a/crates/tessera-demo/Cargo.toml +++ b/crates/tessera-demo/Cargo.toml @@ -3,6 +3,7 @@ name = "tessera-demo" version.workspace = true edition.workspace = true license.workspace = true +publish = false [dependencies] tessera-core = { path = "../tessera-core" } diff --git a/crates/tessera-hub/Cargo.toml b/crates/tessera-hub/Cargo.toml index 3d31cd9..8dc5efd 100644 --- a/crates/tessera-hub/Cargo.toml +++ b/crates/tessera-hub/Cargo.toml @@ -3,6 +3,7 @@ name = "tessera-hub" version.workspace = true edition.workspace = true license.workspace = true +publish = false [[bin]] name = "tessera-hub" @@ -38,8 +39,7 @@ tempfile.workspace = true indexmap = "=2.2.6" hyper = { version = "=1.12.0", features = ["server", "http1"] } hyper-util = { version = "=0.1.21", features = ["tokio"] } -rustls = { version = "=0.23.23", default-features = false, features = ["ring", "std"] } -rustls-pemfile = "=2.2.0" +rustls = { version = "=0.23.46", default-features = false, features = ["ring", "std"] } tokio-rustls = "=0.26.2" tower = { workspace = true } diff --git a/crates/tessera-hub/src/mtls.rs b/crates/tessera-hub/src/mtls.rs index 1725b78..c9f2008 100644 --- a/crates/tessera-hub/src/mtls.rs +++ b/crates/tessera-hub/src/mtls.rs @@ -6,14 +6,12 @@ use axum::Router; use hyper::body::Incoming; use hyper_util::rt::TokioIo; use hyper_util::service::TowerToHyperService; -use rustls::pki_types::{CertificateDer, PrivateKeyDer}; +use rustls::pki_types::{pem::PemObject, CertificateDer, PrivateKeyDer}; use rustls::server::WebPkiClientVerifier; use rustls::RootCertStore; use rustls::ServerConfig; use std::convert::Infallible; -use std::fs::File; use std::future::Future; -use std::io::BufReader; use std::net::SocketAddr; use std::path::Path; use std::pin::Pin; @@ -120,17 +118,14 @@ impl Service> for HyperApp { } pub fn load_certs(path: &Path) -> Result>> { - let mut reader = BufReader::new(File::open(path).with_context(|| format!("open {}", path.display()))?); - rustls_pemfile::certs(&mut reader) + CertificateDer::pem_file_iter(path) + .with_context(|| format!("open {}", path.display()))? .collect::, _>>() .context("parse certificate") } pub fn load_key(path: &Path) -> Result> { - let mut reader = BufReader::new(File::open(path).with_context(|| format!("open {}", path.display()))?); - rustls_pemfile::private_key(&mut reader) - .context("parse private key")? - .context("certificate file has no private key") + PrivateKeyDer::from_pem_file(path).context("parse private key (none found in file?)") } pub fn load_ca(path: &Path) -> Result { diff --git a/crates/tessera-providers/Cargo.toml b/crates/tessera-providers/Cargo.toml index ddf205f..0e8b3ee 100644 --- a/crates/tessera-providers/Cargo.toml +++ b/crates/tessera-providers/Cargo.toml @@ -3,6 +3,7 @@ name = "tessera-providers" version.workspace = true edition.workspace = true license.workspace = true +publish = false [dependencies] tessera-core = { path = "../tessera-core" } diff --git a/crates/tessera-store/Cargo.toml b/crates/tessera-store/Cargo.toml index e310938..39da874 100644 --- a/crates/tessera-store/Cargo.toml +++ b/crates/tessera-store/Cargo.toml @@ -3,6 +3,7 @@ name = "tessera-store" version.workspace = true edition.workspace = true license.workspace = true +publish = false [dependencies] tessera-core = { path = "../tessera-core" } diff --git a/deny.toml b/deny.toml new file mode 100644 index 0000000..d3031d1 --- /dev/null +++ b/deny.toml @@ -0,0 +1,28 @@ +# Supply-chain gate. Run: cargo deny check +[graph] +all-features = false + +[advisories] +version = 2 +# Unmaintained warnings are tracked, not ignored silently; see tasks/auth-plan.md (M1). +unmaintained = "workspace" + +[licenses] +version = 2 +allow = [ + "MIT", "MIT-0", "Apache-2.0", "Apache-2.0 WITH LLVM-exception", "ISC", + "BSD-2-Clause", "BSD-3-Clause", "Unicode-3.0", "Zlib", "CC0-1.0", + "BSL-1.0", "Unlicense", + "AGPL-3.0-or-later", # Tessera's own crates +] +confidence-threshold = 0.9 + +[bans] +multiple-versions = "warn" +wildcards = "deny" +allow-wildcard-paths = true + +[sources] +unknown-registry = "deny" +unknown-git = "deny" +allow-registry = ["https://github.com/rust-lang/crates.io-index"] diff --git a/rust-toolchain.toml b/rust-toolchain.toml index e88baf1..b67e7d5 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.88.0" +channel = "1.89.0" diff --git a/tasks/auth-plan.md b/tasks/auth-plan.md new file mode 100644 index 0000000..f72354e --- /dev/null +++ b/tasks/auth-plan.md @@ -0,0 +1,80 @@ +# Auth Tessera: rencana per milestone + +Dibuat 14 November 2026, menggantikan rencana A00–A25 (arsip: `archive/`). +Referensi yang tetap berlaku: [kontrak endpoint](auth-endpoint-contract.md), [riset library](auth-self-service-libraries.md), [spike kompatibilitas](../tests/auth-compat/README.md). + +Tujuan: login per orang lewat OIDC dengan sesi persisten, lalu hak akses per scope, lalu workflow self-service. Setiap milestone bisa dirilis sendiri dan punya kriteria selesai yang bisa dibuktikan. Milestone M4 ke atas ditulis kasar dan dipecah ulang saat tiba gilirannya. + +Prinsip: pakai library untuk protokol (OIDC, rate limit, gzip), tulis sendiri hanya aturan domain Tessera. Satu hub, satu issuer, SQLite. Tidak ada policy engine, broker, atau workflow engine baru. + +## M0 — Fondasi (selesai) + +Auth wajib secara default, mode development eksplisit dan loopback saja, upload terikat pemilik Outpost, `Principal` dan `audit_events` bertipe, kontrak endpoint, login operator + CSRF. +Bukti: `cargo test -p tessera-hub` (kontrak, upload ownership, sesi operator). +Catatan: perubahan ini masih uncommitted di working tree. Commit sebelum M1. + +## M1 — Baseline dependency (selesai di working tree, belum di-commit, 14 November 2026) + +Hasil: workspace siap menerima `openidconnect` tanpa pin yang bentrok. +- rustls 0.23.23 → 0.23.46 (webpki 0.102.8 → 0.103.17), tokio 1.40.0 → 1.54.1 (pin `1.51.6`), rusqlite 0.31.0 → 0.41.1 (libsqlite3-sys 0.28 → 0.39.1). +- Compiler 1.88.0 → **1.89.0** (`rust-toolchain.toml`, `Dockerfile`), karena rusqlite 0.41 butuh 1.89. Tidak ada perubahan source untuk rusqlite/tokio. +- `rustls-pemfile` (unmaintained) dibuang; PEM dibaca lewat `rustls::pki_types::pem` di `mtls.rs` dan agent `http.rs`. +- `deny.toml` ditambahkan (advisories, lisensi permisif eksplisit, bans, sources); semua crate internal `publish = false`. +Bukti: `cargo test --workspace` hijau (jumlah tes sama dengan sebelum upgrade), `cargo audit` 0 vulnerability (sisa 1 warning: `proc-macro-error` unmaintained, transitif), `cargo deny check` ok. Hub booting di salinan DB dev lama (`integrity_check` ok), `/health` dan `/api/v1/orbits` merespons. +Belum terbukti: build image Docker `rust:1.89`, dan tes Restic ignored. Belum ada CI di repo, jadi gate ini baru jalan manual (`cargo audit`, `cargo deny check`). +Sisa catatan: `rsa` 0.9 (RUSTSEC-2023-0071) baru muncul saat `openidconnect` masuk di M3; dikecualikan dengan alasan reachability di sana, bukan sekarang. + +## M2 — User dan sesi persisten + +Hasil: identitas per orang dan sesi yang bertahan setelah restart. +- Tabel `users` (UNIQUE issuer+subject, status aktif) dan `sessions` (digest ID, user, CSRF, created/last_seen/expires, auth_time, auth method, revocation generation). +- Store sesi sendiri di rusqlite, bukan `tower-sessions`: UPDATE-only save, key digest, idle 30 menit dan absolute 8 jam, revoke per sesi dan per user, rotasi ID saat login. Alasan: adapter yang aman sudah meniru hampir semua logika library, dan library membawa `axum-core` ganda. +- Ganti `SessionGate` in-memory. Akun darurat (password) tetap login lewat jalur yang sama sebagai principal `Emergency`. +- `GET /me` mengembalikan identitas dan capabilities aman. +Selesai bila: tes fake clock (idle/absolute), session fixation, CSRF, revoke saat request konkuren tidak menghidupkan sesi lagi, restart mempertahankan sesi valid dan menolak yang kedaluwarsa. + +## M3 — Login OIDC + +Hasil: SSO berfungsi; ini inti permintaan. +- `openidconnect` 4.x, confidential client, Authorization Code + PKCE S256, redirect URI statis dari config, redirect HTTP dimatikan untuk discovery/token/JWKS. +- Transaksi login singkat, sekali pakai, terikat cookie korelasi SameSite=Lax terpisah. Validasi state, nonce, iss, aud, exp, alg allowlist; JWKS di-cache dengan refresh terbatas. +- User dibuat/dicocokkan lewat (issuer, subject), tanpa auto-link email, tanpa auto-admin. User baru tanpa grant mendapat halaman "belum punya akses". +- Admin ditentukan config eksplisit: daftar subject atau satu claim grup. Claim grup hilang tidak menambah hak. +- Endpoint: `/auth/oidc/login`, `/auth/oidc/callback`, logout lokal (+ RP-initiated logout bila IdP mendukung). +- UI: tombol SSO di `OperatorGate`, login darurat dipisah, halaman tanpa akses. +Selesai bila: tes wiremock untuk signature/alg/iss/aud/nonce/state salah, replay callback, token kedaluwarsa, JWKS rotasi dan outage; satu lari nyata dengan Keycloak fixture lewat browser (cookie lintas situs, logout, user tanpa grant). + +## M4 — Hardening kredensial + +Hasil: tidak ada rahasia aktif yang tersimpan mentah dan login tidak bisa dibanjiri. +- Token Outpost/service disimpan sebagai digest, migrasi di tempat, rotate/revoke/expiry, audit. Pairing code berupa digest sekali pakai. +- `governor` untuk login darurat dan claim: kunci per sumber tepercaya plus backoff akun, kuota global tidak mengunci semua user. Semaphore untuk hashing Argon2. +- Token shared admin lama hanya untuk transisi, ada tanggal berakhir dan audit. +Selesai bila: DB baru tidak memuat token aktif mentah, token dicabut ditolak di request berikutnya, flood satu sumber tidak menghabiskan kuota user lain. + +## M5 — Hak akses per scope + +Hasil: QA, developer, dan DevOps punya hak berbeda per orbit. +- Permission bertipe dan tabel `access_grants` (principal user/group/service, permission, scope, expiry). Tanpa Casbin. +- Satu gate terpusat dipakai semua handler; scope di luar akses = 404, tanpa izin pada resource terlihat = 403. List dan akses UUID langsung ikut difilter. +- Admin UI untuk grant dan mapping grup; perubahan berlaku di request berikutnya. +Selesai bila: tes tabel seluruh matriks di kontrak endpoint lulus, grant dicabut langsung menolak, unknown permission ditolak. + +## M6 — Self-service data + +Hasil: QA refresh staging sendiri, developer unduh snapshot terkompresi. +- Environment dan binding target, relasi berarah production → staging, refresh run durable (capture baru → snapshot spesifik → restore) dengan revalidasi sebelum apply. +- Download `.gz` streaming (`async-compression`), kuota, audit. +Dipecah ulang menjadi sub-milestone saat M5 selesai; detail desain lama ada di `archive/auth-self-service-plan.md` bagian 7–9. + +## M7 — Rilis + +Migrasi pada salinan DB nyata, rehearsal dengan IdP target, dokumentasi bootstrap admin dan rollback, review keamanan khusus auth. + +## Di luar lingkup + +Multi-tenant, multi-issuer, SCIM, device flow untuk CLI, manajemen password publik, policy engine generik, approval per refresh. + +## Urutan dan dependensi + +M0 → M1 → M2 → M3 → M4 → M5 → M6 → M7. M4 tidak bergantung pada M3 dan boleh dikerjakan paralel setelah M2.