omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / si / inquisitor / test.om
| 1 | note si/inquisitor/test.om: comprehensive test suite for pure-Omega spark-inquisitor |
| 2 | note Composed after si/directives/om2.om and si/inquisitor/lib.om. |
| 3 | note Covers clean patch PASS, deterministic receipt check, WARN rules, and BLOCK negative controls. |
| 4 | |
| 5 | text t_pass_pre "PASS " |
| 6 | text t_fail_pre "FAIL " |
| 7 | text t_nl "\n" |
| 8 | |
| 9 | text t_c1 "clean_patch_pass_and_determinism" |
| 10 | text t_c2 "block_protected_evidence_path" |
| 11 | text t_c3 "block_protected_aien_path" |
| 12 | text t_c4 "block_protected_gates_path" |
| 13 | text t_c5 "block_secret_aws_key" |
| 14 | text t_c6 "block_secret_ghp_and_pem" |
| 15 | text t_c7 "block_env_file_diff_and_binary" |
| 16 | text t_c8 "block_not_run_labelled_pass_inline" |
| 17 | text t_c9 "block_not_run_labelled_pass_multiline" |
| 18 | text t_c10 "block_dirty_tree_flags" |
| 19 | text t_c11 "block_telemetry_and_negation_guard" |
| 20 | text t_c12 "block_hard_stub_and_warn_soft_todo" |
| 21 | text t_c13 "warn_unslop_dash_and_buzzword_flag_guard" |
| 22 | text t_c14 "pass_removed_lines_only" |
| 23 | text t_c15 "block_secret_in_self_exempt_paths_dra440" |
| 24 | text t_c16 "block_multifile_unified_and_post_bin_patch" |
| 25 | text t_c17 "block_long_ghp_and_long_env_path_no_trap" |
| 26 | text t_c18 "block_in_hunk_plus3_secret_and_dra440" |
| 27 | text t_c19 "block_in_hunk_plus3_self_exempt_smuggle" |
| 28 | text t_c20 "block_in_hunk_minus3_then_plus3_smuggle" |
| 29 | text t_c21 "block_protected_rename_move_and_diff_u_delete" |
| 30 | text t_c22 "block_rename_and_copy_extended_headers" |
| 31 | text t_c23 "block_diff_git_plus_mismatch_and_single_token" |
| 32 | text t_c24 "block_binary_files_delete_and_space_in_path" |
| 33 | text t_c25 "block_over_4200_byte_evidence_paths" |
| 34 | text t_c26 "block_protected_tools_aien_test_path" |
| 35 | text t_c27 "block_post_hunk_and_no_hunk_m3p3_smuggle" |
| 36 | text t_c28 "block_post_body_rename_and_dev_null_skip" |
| 37 | text t_c29 "block_quoted_and_ambiguous_diff_and_bin" |
| 38 | text t_c30 "block_git_octal_escaped_protected_paths" |
| 39 | text t_all_ok "INQUISITOR TESTS PASS (30/30)\n" |
| 40 | text t_all_fail "INQUISITOR TESTS FAILED\n" |
| 41 | |
| 42 | text s_clean "diff --git a/src/math.om b/src/math.om\n+++ b/src/math.om\n+fn add_pair a ulong b ulong to ulong\n+ret add a b\n+end\n" |
| 43 | text s_evid "diff --git a/evidence/seed.abc123.json b/evidence/seed.abc123.json\n+++ b/evidence/seed.abc123.json\n+{\"verdict\":\"PASS\"}\n" |
| 44 | text s_aien "diff --git a/.aien/always b/.aien/always\n+++ b/.aien/always\n+OMEGA-SKIP\n" |
| 45 | text s_gates "diff --git a/tests/gates/seed.gate b/tests/gates/seed.gate\n+++ b/tests/gates/seed.gate\n+cmd: true\n" |
| 46 | text s_aws "diff --git a/src/config.om b/src/config.om\n+++ b/src/config.om\n+text k \"AKIA1234567890ABCDEF\"\n" |
| 47 | text s_gh_pem "diff --git a/src/auth.om b/src/auth.om\n+++ b/src/auth.om\n+text t \"ghp_abcdefghijklmnopqrstuvwxyz0123456789\"\n+text p \"-----BEGIN RSA PRIVATE KEY-----\"\n" |
| 48 | text s_env "diff --git a/.env b/.env\n+++ b/.env\n+SECRET_KEY=hunter2\nBinary files /dev/null and b/.env.local differ\n" |
| 49 | text s_nr_inl "GATE: OMEGA-SILICON\nVERDICT: PASS (NOT_RUN)\n" |
| 50 | text s_nr_ml "GATE: OMEGA-GB10\nTESTS_RUN: 0\nGATE_STATE: NOT_RUN\nVERDICT: PASS\n" |
| 51 | text s_dirty "AUDIT_HEADER\nDIRTY_TREE: true\nGIT_STATUS: dirty\n" |
| 52 | text s_telem "diff --git a/src/net.om b/src/net.om\n+++ b/src/net.om\n+note send_telemetry to google-analytics.com\n" |
| 53 | text s_tel_ok "diff --git a/src/net.om b/src/net.om\n+++ b/src/net.om\n+note zero-telemetry sovereign transport\n" |
| 54 | text s_stub_h "diff --git a/src/core.om b/src/core.om\n+++ b/src/core.om\n+note STUB_ONLY unimplemented!()\n" |
| 55 | text s_todo_w "diff --git a/src/core.om b/src/core.om\n+++ b/src/core.om\n+note TODO: refine bound estimate\n" |
| 56 | text s_buzz "diff --git a/src/doc.om b/src/doc.om\n+++ b/src/doc.om\n+note this is a game-changer\n" |
| 57 | text s_flag_ok "diff --git a/src/cli.om b/src/cli.om\n+++ b/src/cli.om\n+note support --unleash and --elevate flags\n" |
| 58 | text s_removed "diff --git a/src/old.om b/src/old.om\n+++ b/src/old.om\n-text k \"AKIA1234567890ABCDEF\"\n-note send_telemetry mixpanel\n+note removed old secrets\n" |
| 59 | text s_dra440_inq "diff --git a/crates/spark-inquisitor/src/audit.rs b/crates/spark-inquisitor/src/audit.rs\n+++ b/crates/spark-inquisitor/src/audit.rs\n+let leaked = \"ghp_abcdefghijklmnopqrstuvwxyz0123456789\";\n" |
| 60 | text s_dra440_con "diff --git a/src/constitution.rs b/src/constitution.rs\n+++ b/src/constitution.rs\n+const LEAK: &str = \"AKIA1234567890ABCDEF\";\n" |
| 61 | text s_dra440_ok "diff --git a/crates/spark-inquisitor/src/audit.rs b/crates/spark-inquisitor/src/audit.rs\n+++ b/crates/spark-inquisitor/src/audit.rs\n+const PAT: &str = \"google-analytics\";\n" |
| 62 | text s_mf_env "--- a/src/ok.om\t2026-11-18\n+++ b/src/ok.om\t2026-11-18\n+note ok\n--- a/.env\t2026-11-18\n+++ b/.env\t2026-11-18\n+FOO=bar\n" |
| 63 | text s_bin_sec "diff --git a/foo.bin b/foo.bin\nGIT binary patch\nliteral 1\n\n--- a/src/auth.om\n+++ b/src/auth.om\n+text k \"AKIA1234567890ABCDEF\"\n" |
| 64 | text s_ghp_pre "diff --git a/src/tok.om b/src/tok.om\n+ghp_" |
| 65 | text s_env_pre "diff --git a/x b/" |
| 66 | text s_env_suf ".env\n+X=1\n" |
| 67 | text s_hunk_p3 "diff --git a/src/ok.om b/src/ok.om\n--- a/src/ok.om\n+++ b/src/ok.om\n@@ -1,1 +1,2 @@\n ok\n+++ AKIA1234567890ABCDEF\n" |
| 68 | text s_hunk_p3_dra "diff --git a/crates/spark-inquisitor/src/audit.rs b/crates/spark-inquisitor/src/audit.rs\n--- a/crates/spark-inquisitor/src/audit.rs\n+++ b/crates/spark-inquisitor/src/audit.rs\n@@ -1,1 +1,2 @@\n ok\n+++ AKIA1234567890ABCDEF\n" |
| 69 | text s_hunk_p3_ex "diff --git a/src/ok.om b/src/ok.om\n--- a/src/ok.om\n+++ b/src/ok.om\n@@ -1,1 +1,3 @@\n ok\n+++ spark-inquisitor\n+note send_telemetry to google-analytics.com\n" |
| 70 | text s_hunk_m3p3_g "diff --git a/src/ok.om b/src/ok.om\n--- a/src/ok.om\n+++ b/src/ok.om\n@@ -1,1 +1,1 @@\n--- foo\n+++ AKIA1234567890ABCDEF\n" |
| 71 | text s_hunk_m3p3_u "--- a/src/ok.om\n+++ b/src/ok.om\n@@ -1,1 +1,1 @@\n--- foo\n+++ AKIA1234567890ABCDEF\n" |
| 72 | text s_mv_evid "diff --git a/evidence/foo.json b/src/foo.json\n--- a/evidence/foo.json\n+++ b/src/foo.json\n+note moved\n" |
| 73 | text s_del_evid "--- a/evidence/r.json\n+++ /dev/null\n@@ -1,1 +0,0 @@\n-old\n" |
| 74 | text s_ren_hdr "rename from evidence/a.json\nrename to src/a.json\n" |
| 75 | text s_cpy_hdr "copy from evidence/a.json\ncopy to src/a.json\n" |
| 76 | text s_mis_env "diff --git a/src/ok.om b/src/ok.om\n--- a/src/ok.om\n+++ b/.env\n+FOO=1\n" |
| 77 | text s_sng_env "diff --git a/src/ok.om\n+++ b/.env\n+FOO=1\n" |
| 78 | text s_bin_del "Binary files a/evidence/r.bin and /dev/null differ\n" |
| 79 | text s_bin_spc "Binary files a/my dir/ok.bin and b/.env differ\n" |
| 80 | text s_long_dg_a "diff --git a/evidence/" |
| 81 | text s_long_dg_b "/x.json b/evidence/" |
| 82 | text s_long_dg_c "/x.json\n+ok\n" |
| 83 | text s_long_fl_a "FILE: evidence/" |
| 84 | text s_long_fl_b "/x.json\n" |
| 85 | text s_aien_test "diff --git a/tools/aien-test/foo.sh b/tools/aien-test/foo.sh\n--- a/tools/aien-test/foo.sh\n+++ b/tools/aien-test/foo.sh\n+echo hi\n" |
| 86 | text s_smug_nohk "--- a/src/ok.om\n+++ b/src/ok.om\n+ok\n--- foo\n+++ AKIA1234567890ABCDEF\n" |
| 87 | text s_smug_zero "--- a/src/ok.om\n+++ b/src/ok.om\n@@ -1,0 +1,0 @@\n--- foo\n+++ AKIA1234567890ABCDEF\n" |
| 88 | text s_smug_bak "diff --git a/src/ok.om b/src/ok.om\n--- a/src/ok.om\n+++ b/src/ok.om\n@@ -1,1 +1,1 @@\n-old\n+new\n--- a/x\n+++ b/AKIA1234567890ABCDEF\n" |
| 89 | text s_smug_idx "--- a/src/ok.om\nindex 1234567..89abcdef 100644\n+++ AKIA1234567890ABCDEF\n" |
| 90 | text s_smug_dty "--- foo\n+++ DIRTY_TREE: true\n" |
| 91 | text s_smug_ex "--- a/src/ok.om\n+++ b/src/ok.om\n+ok\n--- foo\n+++ spark-inquisitor\n+note send_telemetry to google-analytics.com\n" |
| 92 | text s_post_ren "diff --git a/src/ok.om b/src/ok.om\n--- a/src/ok.om\n+++ b/src/ok.om\n@@ -1,1 +1,1 @@\n ok\nrename from evidence/a.json\nrename to src/a.json\n" |
| 93 | text s_devn_skp "diff --git a/crates/spark-inquisitor/src/audit.rs b/crates/spark-inquisitor/src/audit.rs\n--- a/crates/spark-inquisitor/src/audit.rs\n+++ b/crates/spark-inquisitor/src/audit.rs\n@@ -1,1 +1,1 @@\n-old\n+new\n--- a/src/evil.om\n+++ /dev/null\n+note send_telemetry to google-analytics.com\n" |
| 94 | text s_dg_spb "diff --git a/my b/dir/.env b/src/ok.om\n" |
| 95 | text s_dg_qspb "diff --git \"a/my b/dir/.env\" \"b/src/ok.om\"\n" |
| 96 | text s_bin_qand "Binary files \"a/my and dir/.env\" and \"b/src/ok.bin\" differ\n" |
| 97 | text s_bin_andb "Binary files a/foo and b/bar/.env and b/src/ok.bin differ\n" |
| 98 | text s_bin_npand "Binary files a/my and dir/.env and src/ok.bin differ\n" |
| 99 | text s_oct_dg "diff --git \"a/\\145vidence/foo.json\" \"b/\\145vidence/foo.json\"\n" |
| 100 | text s_oct_env "diff --git \"a/\\056env\" \"b/\\056env\"\n" |
| 101 | text s_oct_bin "Binary files \"a/\\145vidence/r.bin\" and /dev/null differ\n" |
| 102 | text s_oct_ren "rename from \"\\145vidence/a.json\"\n" |
| 103 | text s_oct_fl "FILE: \"\\056env\"\n" |
| 104 | text s_oct_p3 "--- a/src/ok.om\n+++ \"b/\\056env\"\n" |
| 105 | |
| 106 | text chk_v_pass "\"verdict\":\"PASS\"" |
| 107 | text chk_v_warn "\"verdict\":\"WARN\"" |
| 108 | text chk_v_block "\"verdict\":\"BLOCK\"" |
| 109 | text chk_fp "\"fingerprint\":\"" |
| 110 | |
| 111 | global t_fails ulong 1 |
| 112 | global t_snap uchar 4096 |
| 113 | global t_snap_len ulong 1 |
| 114 | |
| 115 | fn t_print s view uchar * to void |
| 116 | k = write 1 s 0 len s |
| 117 | if lt k 0 |
| 118 | exit 2 |
| 119 | end |
| 120 | end |
| 121 | |
| 122 | fn t_report name view uchar * ok bool to void |
| 123 | if ok |
| 124 | t_print t_pass_pre |
| 125 | else |
| 126 | t_print t_fail_pre |
| 127 | put t_fails 0 add get t_fails 0 1 |
| 128 | end |
| 129 | t_print name |
| 130 | t_print t_nl |
| 131 | end |
| 132 | |
| 133 | fn t_out_contains pat view uchar * to bool |
| 134 | olen = get inq_out_len 0 |
| 135 | pl = len pat |
| 136 | if lt olen pl |
| 137 | ret false |
| 138 | end |
| 139 | lim = add sub olen pl 1 |
| 140 | for i ulong lim bound 32768 |
| 141 | ok = true |
| 142 | for j ulong pl bound 128 |
| 143 | if ne get inq_out add i j get pat j |
| 144 | ok = false |
| 145 | break |
| 146 | end |
| 147 | end |
| 148 | if ok |
| 149 | ret true |
| 150 | end |
| 151 | end |
| 152 | ret false |
| 153 | end |
| 154 | |
| 155 | fn run_case_clean to bool |
| 156 | n1 = inq_load_text s_clean |
| 157 | if eq n1 0 |
| 158 | ret false |
| 159 | end |
| 160 | v1 = inq_scan_input |
| 161 | r1 = inq_format_receipt |
| 162 | if ne v1 SEV_PASS |
| 163 | ret false |
| 164 | end |
| 165 | if ne get inq_blocks 0 0 |
| 166 | ret false |
| 167 | end |
| 168 | if ne get inq_warns 0 0 |
| 169 | ret false |
| 170 | end |
| 171 | if not t_out_contains chk_v_pass |
| 172 | ret false |
| 173 | end |
| 174 | if not t_out_contains chk_fp |
| 175 | ret false |
| 176 | end |
| 177 | if gt r1 4096 |
| 178 | ret false |
| 179 | end |
| 180 | for i ulong r1 bound 4096 |
| 181 | put t_snap i get inq_out i |
| 182 | end |
| 183 | put t_snap_len 0 r1 |
| 184 | h1 = get inq_hash 0 |
| 185 | n2 = inq_load_text s_clean |
| 186 | if ne n2 n1 |
| 187 | ret false |
| 188 | end |
| 189 | v2 = inq_scan_input |
| 190 | r2 = inq_format_receipt |
| 191 | if or ne v2 SEV_PASS ne r2 get t_snap_len 0 |
| 192 | ret false |
| 193 | end |
| 194 | if ne get inq_hash 0 h1 |
| 195 | ret false |
| 196 | end |
| 197 | for j ulong r2 bound 4096 |
| 198 | if ne get inq_out j get t_snap j |
| 199 | ret false |
| 200 | end |
| 201 | end |
| 202 | ret true |
| 203 | end |
| 204 | |
| 205 | fn run_case_dash_and_buzz to bool |
| 206 | n = inq_load_text s_buzz |
| 207 | note Append an added line containing raw UTF-8 em-dash (0xe2 0x80 0x94) |
| 208 | put inq_in n 43 |
| 209 | put inq_in add n 1 97 |
| 210 | put inq_in add n 2 226 |
| 211 | put inq_in add n 3 128 |
| 212 | put inq_in add n 4 148 |
| 213 | put inq_in add n 5 98 |
| 214 | put inq_in add n 6 10 |
| 215 | put inq_in_len 0 add n 7 |
| 216 | v = inq_scan_input |
| 217 | r = inq_format_receipt |
| 218 | if eq r 0 |
| 219 | ret false |
| 220 | end |
| 221 | if ne v SEV_WARN |
| 222 | ret false |
| 223 | end |
| 224 | if ne get inq_blocks 0 0 |
| 225 | ret false |
| 226 | end |
| 227 | if lt get inq_rcnt RULE_UNSLOP_WARN 2 |
| 228 | ret false |
| 229 | end |
| 230 | if not t_out_contains chk_v_warn |
| 231 | ret false |
| 232 | end |
| 233 | note Verify --unleash and --elevate CLI flags do not false-positive |
| 234 | n2 = inq_load_text s_flag_ok |
| 235 | if eq n2 0 |
| 236 | ret false |
| 237 | end |
| 238 | v2 = inq_scan_input |
| 239 | ret eq v2 SEV_PASS |
| 240 | end |
| 241 | |
| 242 | fn t_expect_rule src view uchar * want_v ulong rule ulong min_c ulong to bool |
| 243 | n = inq_load_text src |
| 244 | if eq n 0 |
| 245 | ret false |
| 246 | end |
| 247 | v = inq_scan_input |
| 248 | if ne v want_v |
| 249 | ret false |
| 250 | end |
| 251 | ret ge get inq_rcnt rule min_c |
| 252 | end |
| 253 | |
| 254 | fn run_case_evid to bool |
| 255 | n = inq_load_text s_evid |
| 256 | if eq n 0 |
| 257 | ret false |
| 258 | end |
| 259 | v = inq_scan_input |
| 260 | r = inq_format_receipt |
| 261 | if or eq r 0 ne v SEV_BLOCK |
| 262 | ret false |
| 263 | end |
| 264 | if lt get inq_rcnt RULE_PROTECTED_PATH 1 |
| 265 | ret false |
| 266 | end |
| 267 | ret t_out_contains chk_v_block |
| 268 | end |
| 269 | |
| 270 | fn run_case_env to bool |
| 271 | n = inq_load_text s_env |
| 272 | if eq n 0 |
| 273 | ret false |
| 274 | end |
| 275 | v = inq_scan_input |
| 276 | if ne v SEV_BLOCK |
| 277 | ret false |
| 278 | end |
| 279 | if lt get inq_rcnt RULE_ENV_FILE 2 |
| 280 | ret false |
| 281 | end |
| 282 | ret ge get inq_rcnt RULE_SECRET 1 |
| 283 | end |
| 284 | |
| 285 | fn run_case_telem to bool |
| 286 | if not t_expect_rule s_telem SEV_BLOCK RULE_TELEMETRY 1 |
| 287 | ret false |
| 288 | end |
| 289 | n = inq_load_text s_tel_ok |
| 290 | if eq n 0 |
| 291 | ret false |
| 292 | end |
| 293 | v = inq_scan_input |
| 294 | ret eq v SEV_PASS |
| 295 | end |
| 296 | |
| 297 | fn run_case_stubs to bool |
| 298 | if not t_expect_rule s_stub_h SEV_BLOCK RULE_STUB_HARD 1 |
| 299 | ret false |
| 300 | end |
| 301 | ret t_expect_rule s_todo_w SEV_WARN RULE_TODO_WARN 1 |
| 302 | end |
| 303 | |
| 304 | fn run_case_dra440 to bool |
| 305 | n1 = inq_load_text s_dra440_inq |
| 306 | if eq n1 0 |
| 307 | ret false |
| 308 | end |
| 309 | v1 = inq_scan_input |
| 310 | r1 = inq_format_receipt |
| 311 | if or eq r1 0 ne v1 SEV_BLOCK |
| 312 | ret false |
| 313 | end |
| 314 | if lt get inq_rcnt RULE_SECRET 1 |
| 315 | ret false |
| 316 | end |
| 317 | if not t_out_contains chk_v_block |
| 318 | ret false |
| 319 | end |
| 320 | if not t_expect_rule s_dra440_con SEV_BLOCK RULE_SECRET 1 |
| 321 | ret false |
| 322 | end |
| 323 | n3 = inq_load_text s_dra440_ok |
| 324 | if eq n3 0 |
| 325 | ret false |
| 326 | end |
| 327 | v3 = inq_scan_input |
| 328 | ret eq v3 SEV_PASS |
| 329 | end |
| 330 | |
| 331 | fn run_case_mf_and_bin to bool |
| 332 | if not t_expect_rule s_mf_env SEV_BLOCK RULE_ENV_FILE 1 |
| 333 | ret false |
| 334 | end |
| 335 | ret t_expect_rule s_bin_sec SEV_BLOCK RULE_SECRET 1 |
| 336 | end |
| 337 | |
| 338 | fn run_case_long_inputs to bool |
| 339 | n = inq_load_text s_ghp_pre |
| 340 | for i ulong 300 |
| 341 | put inq_in add n i 97 |
| 342 | end |
| 343 | put inq_in add n 300 10 |
| 344 | put inq_in_len 0 add n 301 |
| 345 | v1 = inq_scan_input |
| 346 | if or ne v1 SEV_BLOCK lt get inq_rcnt RULE_SECRET 1 |
| 347 | ret false |
| 348 | end |
| 349 | m = inq_load_text s_env_pre |
| 350 | for j ulong 150 |
| 351 | put inq_in add m mul j 2 100 |
| 352 | put inq_in add m add mul j 2 1 47 |
| 353 | end |
| 354 | pos = add m 300 |
| 355 | for k ulong len s_env_suf bound 32 |
| 356 | put inq_in add pos k get s_env_suf k |
| 357 | end |
| 358 | put inq_in_len 0 add pos len s_env_suf |
| 359 | v2 = inq_scan_input |
| 360 | if or ne v2 SEV_BLOCK lt get inq_rcnt RULE_ENV_FILE 1 |
| 361 | ret false |
| 362 | end |
| 363 | ret true |
| 364 | end |
| 365 | |
| 366 | fn run_case_hunk_p3 to bool |
| 367 | if not t_expect_rule s_hunk_p3 SEV_BLOCK RULE_SECRET 1 |
| 368 | ret false |
| 369 | end |
| 370 | ret t_expect_rule s_hunk_p3_dra SEV_BLOCK RULE_SECRET 1 |
| 371 | end |
| 372 | |
| 373 | fn run_case_hunk_m3p3 to bool |
| 374 | if not t_expect_rule s_hunk_m3p3_g SEV_BLOCK RULE_SECRET 1 |
| 375 | ret false |
| 376 | end |
| 377 | ret t_expect_rule s_hunk_m3p3_u SEV_BLOCK RULE_SECRET 1 |
| 378 | end |
| 379 | |
| 380 | fn run_case_rename_del to bool |
| 381 | if not t_expect_rule s_mv_evid SEV_BLOCK RULE_PROTECTED_PATH 1 |
| 382 | ret false |
| 383 | end |
| 384 | ret t_expect_rule s_del_evid SEV_BLOCK RULE_PROTECTED_PATH 1 |
| 385 | end |
| 386 | |
| 387 | fn run_case_ext_hdrs to bool |
| 388 | if not t_expect_rule s_ren_hdr SEV_BLOCK RULE_PROTECTED_PATH 1 |
| 389 | ret false |
| 390 | end |
| 391 | ret t_expect_rule s_cpy_hdr SEV_BLOCK RULE_PROTECTED_PATH 1 |
| 392 | end |
| 393 | |
| 394 | fn run_case_mismatch_single to bool |
| 395 | if not t_expect_rule s_mis_env SEV_BLOCK RULE_ENV_FILE 1 |
| 396 | ret false |
| 397 | end |
| 398 | ret t_expect_rule s_sng_env SEV_BLOCK RULE_ENV_FILE 1 |
| 399 | end |
| 400 | |
| 401 | fn run_case_bin_edge to bool |
| 402 | if not t_expect_rule s_bin_del SEV_BLOCK RULE_PROTECTED_PATH 1 |
| 403 | ret false |
| 404 | end |
| 405 | ret t_expect_rule s_bin_spc SEV_BLOCK RULE_ENV_FILE 1 |
| 406 | end |
| 407 | |
| 408 | fn t_append_in pos ulong s view uchar * to ulong |
| 409 | n = len s |
| 410 | for i ulong n bound 128 |
| 411 | put inq_in add pos i get s i |
| 412 | end |
| 413 | ret add pos n |
| 414 | end |
| 415 | |
| 416 | fn run_case_long_evid to bool |
| 417 | p = ulong 0 |
| 418 | p = t_append_in p s_long_dg_a |
| 419 | for i ulong 4200 |
| 420 | put inq_in add p i 97 |
| 421 | end |
| 422 | p = add p 4200 |
| 423 | p = t_append_in p s_long_dg_b |
| 424 | for j ulong 4200 |
| 425 | put inq_in add p j 97 |
| 426 | end |
| 427 | p = add p 4200 |
| 428 | p = t_append_in p s_long_dg_c |
| 429 | put inq_in_len 0 p |
| 430 | v1 = inq_scan_input |
| 431 | if or ne v1 SEV_BLOCK lt get inq_rcnt RULE_PROTECTED_PATH 1 |
| 432 | ret false |
| 433 | end |
| 434 | q = ulong 0 |
| 435 | q = t_append_in q s_long_fl_a |
| 436 | for k ulong 4200 |
| 437 | put inq_in add q k 97 |
| 438 | end |
| 439 | q = add q 4200 |
| 440 | q = t_append_in q s_long_fl_b |
| 441 | put inq_in_len 0 q |
| 442 | v2 = inq_scan_input |
| 443 | if or ne v2 SEV_BLOCK lt get inq_rcnt RULE_PROTECTED_PATH 1 |
| 444 | ret false |
| 445 | end |
| 446 | ret true |
| 447 | end |
| 448 | |
| 449 | fn run_case_smuggle_ext to bool |
| 450 | if not t_expect_rule s_smug_nohk SEV_BLOCK RULE_SECRET 1 |
| 451 | ret false |
| 452 | end |
| 453 | if not t_expect_rule s_smug_zero SEV_BLOCK RULE_SECRET 1 |
| 454 | ret false |
| 455 | end |
| 456 | if not t_expect_rule s_smug_bak SEV_BLOCK RULE_SECRET 1 |
| 457 | ret false |
| 458 | end |
| 459 | if not t_expect_rule s_smug_idx SEV_BLOCK RULE_SECRET 1 |
| 460 | ret false |
| 461 | end |
| 462 | if not t_expect_rule s_smug_dty SEV_BLOCK RULE_DIRTY_TREE 1 |
| 463 | ret false |
| 464 | end |
| 465 | ret t_expect_rule s_smug_ex SEV_BLOCK RULE_TELEMETRY 1 |
| 466 | end |
| 467 | |
| 468 | fn run_case_post_ren_devn to bool |
| 469 | if not t_expect_rule s_post_ren SEV_BLOCK RULE_PROTECTED_PATH 1 |
| 470 | ret false |
| 471 | end |
| 472 | ret t_expect_rule s_devn_skp SEV_BLOCK RULE_TELEMETRY 1 |
| 473 | end |
| 474 | |
| 475 | fn run_case_quoted_ambig to bool |
| 476 | if not t_expect_rule s_dg_spb SEV_BLOCK RULE_ENV_FILE 1 |
| 477 | ret false |
| 478 | end |
| 479 | if not t_expect_rule s_dg_qspb SEV_BLOCK RULE_ENV_FILE 1 |
| 480 | ret false |
| 481 | end |
| 482 | if not t_expect_rule s_bin_qand SEV_BLOCK RULE_ENV_FILE 1 |
| 483 | ret false |
| 484 | end |
| 485 | if not t_expect_rule s_bin_andb SEV_BLOCK RULE_ENV_FILE 1 |
| 486 | ret false |
| 487 | end |
| 488 | ret t_expect_rule s_bin_npand SEV_BLOCK RULE_ENV_FILE 1 |
| 489 | end |
| 490 | |
| 491 | fn run_case_octal_paths to bool |
| 492 | if not t_expect_rule s_oct_dg SEV_BLOCK RULE_PROTECTED_PATH 1 |
| 493 | ret false |
| 494 | end |
| 495 | if not t_expect_rule s_oct_env SEV_BLOCK RULE_ENV_FILE 1 |
| 496 | ret false |
| 497 | end |
| 498 | if not t_expect_rule s_oct_bin SEV_BLOCK RULE_PROTECTED_PATH 1 |
| 499 | ret false |
| 500 | end |
| 501 | if not t_expect_rule s_oct_ren SEV_BLOCK RULE_PROTECTED_PATH 1 |
| 502 | ret false |
| 503 | end |
| 504 | if not t_expect_rule s_oct_fl SEV_BLOCK RULE_ENV_FILE 1 |
| 505 | ret false |
| 506 | end |
| 507 | ret t_expect_rule s_oct_p3 SEV_BLOCK RULE_ENV_FILE 1 |
| 508 | end |
| 509 | |
| 510 | fn main to int |
| 511 | put t_fails 0 0 |
| 512 | |
| 513 | t_report t_c1 run_case_clean |
| 514 | t_report t_c2 run_case_evid |
| 515 | t_report t_c3 t_expect_rule s_aien SEV_BLOCK RULE_PROTECTED_PATH 1 |
| 516 | t_report t_c4 t_expect_rule s_gates SEV_BLOCK RULE_PROTECTED_PATH 1 |
| 517 | t_report t_c5 t_expect_rule s_aws SEV_BLOCK RULE_SECRET 1 |
| 518 | t_report t_c6 t_expect_rule s_gh_pem SEV_BLOCK RULE_SECRET 2 |
| 519 | t_report t_c7 run_case_env |
| 520 | t_report t_c8 t_expect_rule s_nr_inl SEV_BLOCK RULE_FALSE_PASS 1 |
| 521 | t_report t_c9 t_expect_rule s_nr_ml SEV_BLOCK RULE_FALSE_PASS 1 |
| 522 | t_report t_c10 t_expect_rule s_dirty SEV_BLOCK RULE_DIRTY_TREE 2 |
| 523 | t_report t_c11 run_case_telem |
| 524 | t_report t_c12 run_case_stubs |
| 525 | t_report t_c13 run_case_dash_and_buzz |
| 526 | t_report t_c14 t_expect_rule s_removed SEV_PASS RULE_SECRET 0 |
| 527 | t_report t_c15 run_case_dra440 |
| 528 | t_report t_c16 run_case_mf_and_bin |
| 529 | t_report t_c17 run_case_long_inputs |
| 530 | t_report t_c18 run_case_hunk_p3 |
| 531 | t_report t_c19 t_expect_rule s_hunk_p3_ex SEV_BLOCK RULE_TELEMETRY 1 |
| 532 | t_report t_c20 run_case_hunk_m3p3 |
| 533 | t_report t_c21 run_case_rename_del |
| 534 | t_report t_c22 run_case_ext_hdrs |
| 535 | t_report t_c23 run_case_mismatch_single |
| 536 | t_report t_c24 run_case_bin_edge |
| 537 | t_report t_c25 run_case_long_evid |
| 538 | t_report t_c26 t_expect_rule s_aien_test SEV_BLOCK RULE_PROTECTED_PATH 1 |
| 539 | t_report t_c27 run_case_smuggle_ext |
| 540 | t_report t_c28 run_case_post_ren_devn |
| 541 | t_report t_c29 run_case_quoted_ambig |
| 542 | t_report t_c30 run_case_octal_paths |
| 543 | |
| 544 | if eq get t_fails 0 0 |
| 545 | t_print t_all_ok |
| 546 | ret 0 |
| 547 | end |
| 548 | t_print t_all_fail |
| 549 | ret 1 |
| 550 | end |