code wiki / (root) / nx_mtls_authz.nx

nx_mtls_authz.nx

buildroot/runtime/nx_mtls_authz.nx

8148 B165 linesdepth 11pulls 17 transitivereach 6 importersview sourcekind tooltopic mtls
docsdependenciesstructsconstsfunctions

about

nx_mtls_authz.nx -- bind a VERIFIED client-cert identity to an access decision. mTLS rung R6 of the NO-COOKIE session carrier. After R3 proves key-possession, this rung answers "who is this, and what may they do." Two pieces, both the security floor: 1. nx_mtls_cert_identity: extract the Subject CN (= hex(user_id_hash), the SAME stable id the OPAQUE/HR stack keys on) from the presented cert -- the cert->identity bridge. 2. nx_mtls_authz_level: DENY-BY-DEFAULT (mirrors Consul Connect mc_intention). Access requires BOTH (a) cryptographic verification by R3 AND (b) enrollment in the roster the live HR/uid index supplies. A valid-but-unenrolled cert, or an unverified cert, gets level 0 (nothing). No fail-open path. The live daemon (R7) feeds the roster from olgd_idx_lookup (uidhex->handle) + the HR level, and emits the per-user entitlement LINKS via the proven he_emit_super (nx_hr_entitle) -- this rung is the DECISION, that is the DATA. Composes nx_x509 (parse). license_tier: ORIGINAL expect_exit: 0

dependencies 4 imports · 3 importers

nx_syscalls.nx nx_x509.nx nx_ed25519_signature.nx nx_x509_leaf_emit.nx nx_mtls_authz.nx nx_aw_mtls_inject.nx nx_mtls_serve_decision.nx nx_mtls_test_daemon.nx

imports: nx_syscalls.nxnx_x509.nxnx_ed25519_signature.nxnx_x509_leaf_emit.nx

imported by: nx_aw_mtls_inject.nxnx_mtls_serve_decision.nxnx_mtls_test_daemon.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main az_w sys_write sys_mmap az_hex az_mint sys_mmap ↻ ed25519_pub_from_priv sys_mmap ↻ ed25519_sha512 sys_mmap ↻ sha512_init sha512_update sha512_blk_set_byte blk_get_i64 blk_set_i64 sha512_compress sys_mmap ↻ blk_get_i64 ↻ sha512_gamma0 sha512_gamma1 sha512_sigma1 sha512_ch sha512_k sha512_sigma0 sha512_maj sha512_final sha512_blk_set_byte ↻ sha512_compress ↻ ge_p3_alloc sys_mmap ↻ fe_alloc nx_scratch nx_scratch_init nx_scratch_oom sys_mmap ↻ fe_zero ed25519_basepoint_p3 sys_mmap ↻ ge_p3_decompress

structs

none

consts

18const NX_MAGIC_4096: i64 = 4096
20const NX_AZ_DENY: i64 = 0 // deny-by-default access level

functions

25func nx_mtls_cert_identity(cert_der: *u8, cert_len: i64, out: *u8, cap: i64) -> i64
49func nx_mtls_authz_level(
70func az_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: az_rowmain calls 1: sys_write
71func az_row(name: *u8, ok: i64) -> i64 { if ok == 1 { az_w(" PASS " as *u8) } else { az_w(" FAIL " as *u8) } az_w(name); az_w("\n" as *u8); return ok }
called by 1: main calls 1: az_w
72func az_hex(src: *u8, n: i64, out: *u8) -> i64
called by 4: mainaz_mintmainmain
78func az_streq(a: *u8, an: i64, b: *u8, bn: i64) -> i64
called by 2: mainmain
85func az_mint(uid: *u8, cert: *u8, cap: i64) -> i64
100func main() -> i64