code wiki / (root) / nx_license_wall_audit.nx

nx_license_wall_audit.nx source

↩ module page · 164 lines · 4702 B

1// nx_license_wall_audit.nx -- audit substrate's licensing wall. 2// 3// Walks a hand-listed set of canonical substrate files and verifies 4// each declares a compliant `// license_tier:` header. Exits 0 only 5// when every file passes; otherwise returns the 1-based index of the 6// first failing file so the operator can fix it. 7// 8// This is the substrate's first concrete enforcement of the refined 9// cardinal feedback-licensing-absorb-vs-copy-discipline. It does NOT 10// scan the entire tree yet -- that needs sys_readdir wiring (queued). 11// For now it audits the grader + daemon stack we just declared. 12// 13// expect_exit: 0 14// 15// license_tier: ORIGINAL 16 17// nx_safety_envelope: 18// intended_use: AUTO_APPLIED -- primitive-specific tuning queued 19// sil_target: SIL1 20// evidence: [bulk_applied_2026-05-16, see-file-comment-for-detail] 21// verdict: NOT_YET_EVALUATED 22 23import "nx_syscalls.nx" 24import "nx_runtime.nx" 25import "nx_types.nx" 26import "nx_tier.nx" 27import "nx_license_check.nx" 28 29func _audit_one(path: *u8) -> nx_int { 30 let t: nx_int = nx_license_scan_file(path) 31 let v: nx_int = nx_license_verdict_for_tier(t) 32 if v == NX_LIC_VERDICT_WIN { return 0 } 33 return 1 34} 35 36func main() -> nx_int { 37 // 1 38 let p1: *u8 = "runtime/nx_license_check.nx" as *u8 39 if _audit_one(p1) != 0 { return 1 } 40 41 // 2 42 let p2: *u8 = "runtime/nx_license_check_test.nx" as *u8 43 if _audit_one(p2) != 0 { return 2 } 44 45 // 3 46 let p3: *u8 = "runtime/nx_license_wall_audit.nx" as *u8 47 if _audit_one(p3) != 0 { return 3 } 48 49 // 4 50 let p4: *u8 = "runtime/nx_quality_grade.nx" as *u8 51 if _audit_one(p4) != 0 { return 4 } 52 53 // 5 54 let p5: *u8 = "runtime/nx_quality_grade_test.nx" as *u8 55 if _audit_one(p5) != 0 { return 5 } 56 57 // 6 58 let p6: *u8 = "runtime/nx_quality_grade_self.nx" as *u8 59 if _audit_one(p6) != 0 { return 6 } 60 61 // 7 62 let p7: *u8 = "runtime/nx_quality_grade_daemon.nx" as *u8 63 if _audit_one(p7) != 0 { return 7 } 64 65 // 8 66 let p8: *u8 = "runtime/nx_quality_grade_quad.nx" as *u8 67 if _audit_one(p8) != 0 { return 8 } 68 69 // 9 70 let p9: *u8 = "runtime/nx_quality_grade_septagon.nx" as *u8 71 if _audit_one(p9) != 0 { return 9 } 72 73 // 10 74 let p10: *u8 = "runtime/nx_daemon_bench.nx" as *u8 75 if _audit_one(p10) != 0 { return 10 } 76 77 // ---- Crypto stack (FIPS / RFC INDEPENDENT_REDERIVE) ---------- 78 // 11 79 let p11: *u8 = "runtime/nx_sha256.nx" as *u8 80 if _audit_one(p11) != 0 { return 11 } 81 82 // 12 83 let p12: *u8 = "runtime/nx_sha3.nx" as *u8 84 if _audit_one(p12) != 0 { return 12 } 85 86 // 13 87 let p13: *u8 = "runtime/nx_chacha20.nx" as *u8 88 if _audit_one(p13) != 0 { return 13 } 89 90 // 14 91 let p14: *u8 = "runtime/nx_ed25519.nx" as *u8 92 if _audit_one(p14) != 0 { return 14 } 93 94 // 15 95 let p15: *u8 = "runtime/nx_hmac.nx" as *u8 96 if _audit_one(p15) != 0 { return 15 } 97 98 // 16 99 let p16: *u8 = "runtime/nx_hmac_sha1.nx" as *u8 100 if _audit_one(p16) != 0 { return 16 } 101 102 // 17 103 let p17: *u8 = "runtime/nx_hmac_sha384.nx" as *u8 104 if _audit_one(p17) != 0 { return 17 } 105 106 // 18 107 let p18: *u8 = "runtime/nx_hmac_sha512.nx" as *u8 108 if _audit_one(p18) != 0 { return 18 } 109 110 // 19 111 let p19: *u8 = "runtime/nx_hmac_md5.nx" as *u8 112 if _audit_one(p19) != 0 { return 19 } 113 114 // 20 115 let p20: *u8 = "runtime/nx_poly1305.nx" as *u8 116 if _audit_one(p20) != 0 { return 20 } 117 118 // 21 119 let p21: *u8 = "runtime/nx_hkdf_sha384.nx" as *u8 120 if _audit_one(p21) != 0 { return 21 } 121 122 // 22 123 let p22: *u8 = "runtime/nx_csprng.nx" as *u8 124 if _audit_one(p22) != 0 { return 22 } 125 126 // ---- Layer-3 graders ---------------------------------------- 127 // 23 128 let p23: *u8 = "runtime/nx_a11y_check.nx" as *u8 129 if _audit_one(p23) != 0 { return 23 } 130 131 // 24 132 let p24: *u8 = "runtime/nx_drbg_hmac.nx" as *u8 133 if _audit_one(p24) != 0 { return 24 } 134 135 // 25 136 let p25: *u8 = "runtime/nx_drbg_hmac_test.nx" as *u8 137 if _audit_one(p25) != 0 { return 25 } 138 139 // 26 140 let p26: *u8 = "runtime/nx_aes.nx" as *u8 141 if _audit_one(p26) != 0 { return 26 } 142 143 // 27 144 let p27: *u8 = "runtime/nx_aes_test.nx" as *u8 145 if _audit_one(p27) != 0 { return 27 } 146 147 // 28 148 let p28: *u8 = "runtime/nx_attack_taxonomy.nx" as *u8 149 if _audit_one(p28) != 0 { return 28 } 150 151 // 29 152 let p29: *u8 = "runtime/nx_attack_taxonomy_test.nx" as *u8 153 if _audit_one(p29) != 0 { return 29 } 154 155 // 30 156 let p30: *u8 = "runtime/nx_aes_ctr.nx" as *u8 157 if _audit_one(p30) != 0 { return 30 } 158 159 // 31 160 let p31: *u8 = "runtime/nx_aes_ctr_test.nx" as *u8 161 if _audit_one(p31) != 0 { return 31 } 162 163 return 0 164}