Phase 1: app, Kanidm login, people, passports, addresses, audit log
CI / secret scan (push) Successful in 4s
CI / fmt, clippy, tests (push) Successful in 42s

visa.buildfor.life keeps the immigration records of the foreigners B4L
looks after. This first phase is the base the deadlines and extension
packs build on (docs/PLAN.md, phases 2 to 7).

- One Rust binary (axum 0.8, minijinja, sqlx on PostgreSQL) with its
  templates, static files and migrations compiled in.
- Login through Kanidm (OpenID Connect with PKCE and a nonce, ES256),
  client visa-web, group visa; sessions in PostgreSQL keyed by the
  SHA-256 of the cookie. VISA_INSECURE_NO_LOGIN=1 for loopback
  development only.
- Same-site check and form token on every POST; a CSP without inline
  script or style; security headers.
- People: list with filter, page, create, edit, archive, restore.
- Passports from the machine-readable zone with check digits (ICAO
  9303 TD3); expiry warnings at 12 and 6 months.
- Addresses in Thailand in the order Thai forms use, with the house
  master and the TM.30 receipt.
- Append-only audit log of every view and change, with the names of the
  changed fields but never their values (PDPA); the Activity page.
- Invented demo people (visa seed-demo, refused when login is on).
- 40 tests: unit tests, pages with demo data, the forms, the audit log
  and the whole login against a fake OpenID provider.
- CI: gitleaks over the history, fmt, clippy and the tests against
  PostgreSQL 18; the pre-commit secret scan.
This commit is contained in:
grabowski committed 2026-11-17 16:58:48 +07:00
commit 2e009700a9
56 files changed
+11193

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
[package]
name = "visa"
version = "0.1.0"
edition = "2024"
rust-version = "1.95"
description = "visa.buildfor.life: immigration records, deadlines and extension packs for foreigners in Thailand"
publish = false
# Integration tests are one binary: tests/main.rs declares every tests/*.rs
# as a module, so the suite links once.
autotests = false
[lib]
doctest = false
[[bin]]
name = "visa"
path = "src/main.rs"
test = false
[[test]]
name = "integration"
path = "tests/main.rs"
[dependencies]
anyhow = "1"
axum = "0.8"
base64 = "0.22"
chrono = { version = "0.4", default-features = false, features = ["clock", "std", "serde"] }
form_urlencoded = "1"
minijinja = "2"
# The login service's certificate is checked against the system's CA bundle
# (native roots), so a NixOS VM test can bring its own CA.
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls-native-roots", "json"] }
# ID token signatures (ES256 from Kanidm, RS256 accepted), PKCE, random tokens
# and the session hashes, as in proplan and the fleet overview.
ring = "0.17"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
sqlx = { version = "0.8", default-features = false, features = ["runtime-tokio", "postgres", "chrono", "migrate", "macros"] }
tokio = { version = "1", features = ["macros", "net", "rt-multi-thread", "signal", "sync", "time"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
[dev-dependencies]
http-body-util = "0.1"
tower = { version = "0.5", features = ["util"] }
[profile.dev]
# Line tables keep file:line in panics at a fraction of full debug info.
debug = "line-tables-only"
[profile.dev.package."*"]
debug = false
[profile.release]
lto = "thin"
strip = true