Phase 1: app, Kanidm login, people, passports, addresses, audit log
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:
commit
2e009700a9
56 files changed
+11193
No files matched your search
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# The local database: PostgreSQL 18 (as on cnx01) in the docker container
|
||||
# visa-pg on 127.0.0.1:55438. Development and tests only; the password is
|
||||
# not a secret.
|
||||
set -euo pipefail
|
||||
if docker inspect visa-pg >/dev/null 2>&1; then
|
||||
docker start visa-pg >/dev/null
|
||||
else
|
||||
docker run -d --name visa-pg -e POSTGRES_USER=visa -e POSTGRES_PASSWORD=visa-dev \
|
||||
-e POSTGRES_DB=visa -p 127.0.0.1:55438:5432 postgres:18 >/dev/null
|
||||
fi
|
||||
until docker exec visa-pg pg_isready -U visa >/dev/null 2>&1; do sleep 1; done
|
||||
echo "export DATABASE_URL=postgres://visa:visa-dev@127.0.0.1:55438/visa"
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
# The development server on http://127.0.0.1:8040 without login, with the
|
||||
# invented demo people, against the database of scripts/dev-db.sh.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
export VISA_DATABASE_URL=${VISA_DATABASE_URL:-postgres://visa:visa-dev@127.0.0.1:55438/visa}
|
||||
export VISA_INSECURE_NO_LOGIN=1
|
||||
export VISA_LISTEN=${VISA_LISTEN:-127.0.0.1:8040}
|
||||
cargo build -q
|
||||
./target/debug/visa seed-demo
|
||||
exec ./target/debug/visa serve
|
||||
@@ -0,0 +1,23 @@
|
||||
# /// script
|
||||
# dependencies = ["pycountry"]
|
||||
# ///
|
||||
"""Writes src/countries.rs: ISO 3166-1 alpha-3 codes with English short names.
|
||||
|
||||
uv run scripts/gen_countries.py > src/countries_data.rs
|
||||
|
||||
The names come from pycountry (Debian's iso-codes); `common_name` wins where
|
||||
iso-codes has one ("Bolivia" instead of "Bolivia, Plurinational State of").
|
||||
"""
|
||||
|
||||
import json
|
||||
|
||||
import pycountry
|
||||
|
||||
rows = sorted(
|
||||
(c.alpha_3, getattr(c, "common_name", None) or c.name) for c in pycountry.countries
|
||||
)
|
||||
print("// Generated by scripts/gen_countries.py from pycountry; do not edit by hand.")
|
||||
print("pub static COUNTRIES: &[(&str, &str)] = &[")
|
||||
for code, name in rows:
|
||||
print(f" ({json.dumps(code)}, {json.dumps(name, ensure_ascii=False)}),")
|
||||
print("];")
|
||||
Reference in new issue
Block a user