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

+721
View File
@@ -0,0 +1,721 @@
/* visa.buildfor.life: the buildfor.life colors, navy #071323 and gold
#f5c000, with tints of both. Status colors (--ok, --warn, --bad) appear
only on chips and notes that carry a text label. No inline styles: the
Content Security Policy allows none. */
:root {
--bg: #071323;
--panel: #0d1d33;
--panel2: #12284a;
--line: rgba(229, 236, 245, 0.12);
--stroke: rgba(229, 236, 245, 0.24);
--field: #0a182c;
--fg: #e6ebf2;
--hd: #ffffff;
--mute: #9ba8ba;
--accent: #f5c000;
--accent-s: rgba(245, 192, 0, 0.14);
--on-accent: #071323;
--link: #f5c000;
--ok: #4cc38a;
--ok-s: rgba(76, 195, 138, 0.15);
--warn: #ffb547;
--warn-s: rgba(255, 181, 71, 0.15);
--bad: #ff7a7a;
--bad-s: rgba(255, 107, 107, 0.15);
--shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
--mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;
--side: 220px;
--toph: 56px;
color-scheme: dark;
}
html[data-theme="light"] {
--bg: #f4f6f9;
--panel: #ffffff;
--panel2: #eef2f7;
--line: #e1e6ee;
--stroke: #c4ccd8;
--field: #ffffff;
--fg: #13202f;
--hd: #071323;
--mute: #566375;
--accent-s: rgba(245, 192, 0, 0.2);
--link: #0b3a78;
--ok: #17784a;
--ok-s: #e2f2e9;
--warn: #8f5300;
--warn-s: #fdf0d5;
--bad: #b42318;
--bad-s: #fce8e6;
--shadow: 0 1px 2px rgba(7, 19, 35, 0.06);
color-scheme: light;
}
[hidden] {
display: none !important;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
background: var(--bg);
color: var(--fg);
font:
15px/1.5 system-ui,
-apple-system,
"Segoe UI",
Roboto,
"Helvetica Neue",
"Noto Sans Thai",
Tahoma,
sans-serif;
-webkit-font-smoothing: antialiased;
}
a {
color: var(--link);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
html[data-theme="light"] main p a,
html[data-theme="light"] main dd a {
text-decoration: underline;
text-underline-offset: 2px;
}
:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
h1,
h2,
h3 {
color: var(--hd);
line-height: 1.25;
}
h1 {
font-size: 24px;
margin: 0;
}
h1 a {
color: inherit;
}
h2 {
font-size: 16px;
margin: 0;
}
.muted {
color: var(--mute);
}
.small {
font-size: 13px;
}
.mono {
font-family: var(--mono);
font-variant-numeric: tabular-nums;
font-size: 0.94em;
}
.strong {
font-weight: 650;
}
.sub {
font-size: 12.5px;
color: var(--mute);
}
.pre {
white-space: pre-wrap;
}
/* ---- top bar */
.top {
position: sticky;
top: 0;
z-index: 20;
height: var(--toph);
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 0 20px;
background: #071323;
border-bottom: 1px solid rgba(245, 192, 0, 0.35);
}
.brand {
display: flex;
align-items: center;
gap: 10px;
color: #ffffff;
}
.brand:hover {
text-decoration: none;
}
.mark {
width: 32px;
height: 32px;
flex: none;
}
.brand .nm {
font-weight: 800;
font-size: 17px;
letter-spacing: 0.01em;
}
.brand .sub {
color: #f5c000;
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.1em;
}
.ib {
width: 34px;
height: 34px;
border-radius: 8px;
border: 1px solid rgba(255, 255, 255, 0.28);
background: transparent;
color: #ffffff;
font-size: 16px;
cursor: pointer;
}
.ib:hover {
border-color: #f5c000;
}
/* ---- frame */
.app {
display: grid;
grid-template-columns: var(--side) minmax(0, 1fr);
min-height: calc(100vh - var(--toph));
}
.side {
display: flex;
flex-direction: column;
gap: 18px;
padding: 18px 12px;
background: var(--panel);
border-right: 1px solid var(--line);
}
.nav {
display: flex;
flex-direction: column;
gap: 2px;
}
.nav a {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 12px;
border-radius: 8px;
color: var(--fg);
font-weight: 560;
}
.nav a:hover {
background: var(--panel2);
text-decoration: none;
}
.nav a.on {
background: var(--accent-s);
color: var(--hd);
box-shadow: inset 3px 0 0 var(--accent);
}
.who {
margin-top: auto;
font-size: 13px;
color: var(--mute);
padding: 0 12px;
}
.who .k {
display: block;
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.08em;
}
.who b {
display: block;
color: var(--hd);
font-size: 14px;
}
.who p {
margin: 2px 0 10px;
}
main {
padding: 24px 28px 40px;
min-width: 0;
max-width: 1200px;
width: 100%;
}
.ft {
margin-top: 28px;
font-size: 12.5px;
color: var(--mute);
}
/* ---- page heads */
.crumbs {
font-size: 13px;
color: var(--mute);
margin-bottom: 4px;
}
.pagehead {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
margin-bottom: 14px;
}
.pagehead .actions {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.phead {
margin-bottom: 18px;
padding-bottom: 14px;
border-bottom: 1px solid var(--line);
}
.phead .pagehead {
margin-bottom: 4px;
}
.meta {
margin: 0;
color: var(--mute);
}
.meta .sep {
margin: 0 6px;
opacity: 0.6;
}
/* ---- buttons */
.btn {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 8px 14px;
border-radius: 8px;
border: 1px solid var(--stroke);
background: var(--panel);
color: var(--fg);
font: inherit;
font-size: 14px;
font-weight: 600;
line-height: 1.2;
cursor: pointer;
white-space: nowrap;
}
.btn:hover {
border-color: var(--accent);
text-decoration: none;
}
.btn.pri {
background: var(--accent);
border-color: var(--accent);
color: var(--on-accent);
}
.btn.pri:hover {
filter: brightness(1.06);
}
.btn.sm {
padding: 5px 10px;
font-size: 13px;
}
.btn.ghost {
background: transparent;
}
.btn.danger {
color: var(--bad);
background: transparent;
}
.btn.danger:hover {
border-color: var(--bad);
background: var(--bad-s);
}
.inline-form {
display: inline;
margin: 0;
}
/* the first submit button of a form with two actions: Enter saves */
.default-submit {
position: absolute;
left: -9999px;
width: 1px;
height: 1px;
overflow: hidden;
}
/* ---- cards */
.card {
background: var(--panel);
border: 1px solid var(--line);
border-radius: 12px;
padding: 18px 20px;
margin-bottom: 16px;
box-shadow: var(--shadow);
min-width: 0;
}
.card > header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
flex-wrap: wrap;
margin-bottom: 12px;
}
.card.flush {
padding: 0;
overflow: hidden;
}
.cols {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px;
align-items: start;
}
.cols > .card {
margin-bottom: 0;
}
.cols .span2 {
grid-column: 1 / -1;
}
@media (max-width: 1060px) {
.cols {
grid-template-columns: minmax(0, 1fr);
}
}
.kv {
display: grid;
grid-template-columns: 150px minmax(0, 1fr);
gap: 6px 14px;
margin: 0;
}
.kv dt {
color: var(--mute);
font-size: 13px;
padding-top: 1px;
}
.kv dd {
margin: 0;
overflow-wrap: anywhere;
}
.chip {
display: inline-block;
padding: 1px 9px;
border-radius: 999px;
font-size: 12.5px;
font-weight: 600;
background: var(--panel2);
border: 1px solid var(--line);
}
.chip.ok {
background: var(--ok-s);
color: var(--ok);
border-color: transparent;
}
.chip.warn {
background: var(--warn-s);
color: var(--warn);
border-color: transparent;
}
.chip.bad {
background: var(--bad-s);
color: var(--bad);
border-color: transparent;
}
.tag {
display: inline-block;
font-size: 11px;
font-weight: 700;
letter-spacing: 0.06em;
text-transform: uppercase;
padding: 1px 7px;
border-radius: 5px;
background: var(--accent-s);
color: var(--hd);
}
.tag.plain {
background: var(--panel2);
color: var(--mute);
}
/* ---- notes */
.notice {
padding: 10px 14px;
border-radius: 10px;
background: var(--panel2);
border: 1px solid var(--line);
margin: 0 0 14px;
}
.notice.warn {
background: var(--warn-s);
border-color: transparent;
}
.notice.ok {
background: var(--ok-s);
border-color: transparent;
}
.okline {
margin: 0;
color: var(--ok);
font-weight: 600;
font-size: 14px;
}
.hintline {
margin: 8px 0 0;
color: var(--warn);
font-weight: 600;
font-size: 14px;
}
/* ---- tables */
.toolbar {
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
margin-bottom: 12px;
}
.toolbar .filter {
flex: 1 1 240px;
max-width: 440px;
}
.tblwrap {
overflow-x: auto;
}
.tbl {
width: 100%;
border-collapse: collapse;
}
.tbl th {
text-align: left;
font-size: 11.5px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--mute);
background: var(--panel2);
padding: 9px 14px;
border-bottom: 1px solid var(--line);
white-space: nowrap;
}
.tbl td {
padding: 10px 14px;
border-bottom: 1px solid var(--line);
vertical-align: top;
}
.tbl tbody tr:last-child td {
border-bottom: 0;
}
.tbl tbody tr:hover {
background: var(--panel2);
}
.filter-empty {
margin: 0;
padding: 14px;
color: var(--mute);
}
@media (max-width: 760px) {
.tbl .hs {
display: none;
}
.tbl th,
.tbl td {
padding: 9px 10px;
}
}
/* ---- record lists inside cards */
.item {
padding: 12px 0;
border-top: 1px solid var(--line);
}
.item:first-of-type {
border-top: 0;
padding-top: 0;
}
.item.old {
opacity: 0.78;
}
.item .row {
display: flex;
align-items: baseline;
gap: 8px;
flex-wrap: wrap;
margin-bottom: 6px;
}
.rowactions {
display: flex;
gap: 14px;
font-size: 13px;
margin-top: 6px;
}
.empty-inline {
margin: 0;
color: var(--mute);
}
.addr {
margin: 0 0 8px;
}
.log {
list-style: none;
margin: 0;
padding: 0;
font-size: 13px;
}
.log li {
display: flex;
gap: 10px;
flex-wrap: wrap;
padding: 6px 0;
border-top: 1px solid var(--line);
}
.log li:first-child {
border-top: 0;
}
.log .when {
color: var(--mute);
min-width: 140px;
}
/* ---- forms */
.form .grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 14px 16px;
}
.form .wide {
grid-column: 1 / -1;
}
@media (max-width: 700px) {
.form .grid {
grid-template-columns: minmax(0, 1fr);
}
}
.field label {
display: block;
font-size: 13px;
font-weight: 650;
color: var(--hd);
margin-bottom: 4px;
}
input,
select,
textarea {
width: 100%;
padding: 8px 10px;
border: 1px solid var(--stroke);
border-radius: 8px;
background: var(--field);
color: var(--fg);
font: inherit;
}
input:focus,
select:focus,
textarea:focus {
outline: 2px solid var(--accent);
outline-offset: 0;
border-color: var(--accent);
}
.field.has-err input,
.field.has-err select,
.field.has-err textarea {
border-color: var(--bad);
}
textarea {
resize: vertical;
}
textarea.mrz {
font-family: var(--mono);
font-size: 15px;
letter-spacing: 0.05em;
line-height: 1.6;
}
.hint {
font-size: 12.5px;
color: var(--mute);
margin: 4px 0 0;
}
.lead {
margin: -4px 0 12px;
font-size: 14px;
}
.err {
font-size: 13px;
font-weight: 600;
color: var(--bad);
margin: 4px 0 0;
}
.req {
color: var(--bad);
}
.formactions {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
margin-top: 12px;
}
.dangerzone {
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
margin-top: 22px;
padding-top: 14px;
border-top: 1px solid var(--line);
}
/* ---- a page outside the frame */
.solo {
max-width: 560px;
margin: 64px auto;
padding: 0 16px;
}
.solo .eyebrow {
font-size: 12px;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--mute);
}
/* ---- phones */
@media (max-width: 860px) {
.app {
grid-template-columns: minmax(0, 1fr);
}
.side {
flex-direction: row;
align-items: center;
gap: 8px;
padding: 8px 12px;
border-right: 0;
border-bottom: 1px solid var(--line);
}
.nav {
flex-direction: row;
}
.who {
margin: 0 0 0 auto;
padding: 0;
}
.who .k,
.who b,
.who p {
display: none;
}
main {
padding: 16px 14px 32px;
}
.card {
padding: 14px;
}
.kv {
grid-template-columns: minmax(0, 1fr);
gap: 2px;
}
.kv dt {
margin-top: 8px;
}
}