Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-sovereign-core-mv/blob/main/om/inquisitor-exit/check.om # aien-sovereign-core-mv AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-sovereign-core-mv / om / inquisitor-exit / check.om` 687 lines ยท 10391 bytes Raw Blame History 1 om2 2 note om/inquisitor-exit/check.om: exit-status contract of spark-inquisitor, report format 2 (DRA-99). 3 note Usage: check BIN DIR. BIN is a built spark-inquisitor, DIR an existing writable scratch directory. 4 note Each case writes a diff into DIR, runs BIN on it with stdout and stderr in DIR/CASE.out, and checks 5 note the exit status and the output. Style findings (dash, buzzword) are advisory: exit 0, finding printed. 6 note A planted GitHub token or AWS key, or a .env file, blocks: exit 1, and the token is never echoed. 7 note Secrets and dash bytes are assembled at run time, so this file holds neither. 8 note Prints PASS NAME or FAIL NAME per case, then INQEXIT PASS cases=N or INQEXIT FAIL cases=N fail=K. 9 note Exit 0 every case as expected, 1 a case failed, 2 usage, 3 a host call failed. 10 text tpass "PASS " 11 text tfail "FAIL " 12 text tnl "\n" 13 text tsum "INQEXIT " 14 text tok1 "PASS cases=" 15 text tbad "FAIL cases=" 16 text tfl " fail=" 17 text tusage "usage: check BIN DIR\n" 18 text thost "check: host call failed\n" 19 text tslash "/" 20 text areview "review" 21 text aaudit "audit" 22 text aauthor "--author" 23 text auser "check" 24 text apr "--pr" 25 text anum "1" 26 text adiff "--diff" 27 text hgit "diff --git a/" 28 text hb " b/" 29 text hplus "+" 30 text hci "ci.sh" 31 text hexport "export GH_TOKEN=" 32 text hrs "src/key.rs" 33 text hconst "const KEY: &str = \"" 34 text hq "\";" 35 text henv "deploy/.env.local" 36 text hnew "new file mode 100644\n--- /dev/null\n+++ b/deploy/.env.local\n@@ -0,0 +1 @@\n+PORT=8080\n" 37 text hlib "src/lib.rs" 38 text hnote "// note " 39 text hdashx " the dash is style only" 40 text hgame "// a game-changer helper" 41 text hclean "pub fn ok() -> bool { true }" 42 text gp1 "gh" 43 text gp2 "p_" 44 text gp3 "Zz9Yy8Xx7Ww6Vv5Uu4Tt3Ss2Rr1Qq0Pp9Oo8" 45 text ak1 "AK" 46 text ak2 "IA" 47 text ak3 "QWERTYUIOPASDFGH" 48 text mgh "Plaintext GitHub Personal Access Token detected" 49 text maws "Plaintext AWS Access Key detected" 50 text menv ".env secret file" 51 text mfail "Doctrine Diff Audit: FAILED" 52 text mdash "Em/En dash detected" 53 text madv "Doctrine Diff Audit: PASS (style advisories)" 54 text mgame "game-changer" 55 text mfmt "spark-inquisitor-report/2" 56 text mpass "Doctrine Diff Audit: PASS" 57 text maudok "passed critical security invariants" 58 text mclean "Diff is clean" 59 text mafail "Doctrine audit failed" 60 text mred "[line redacted: it contains a plaintext secret]" 61 text c1 "token-review-blocks" 62 text c2 "aws-key-audit-blocks" 63 text c3 "env-file-review-blocks" 64 text c4 "dash-only-review-passes-and-prints" 65 text c5 "dash-only-audit-passes-and-prints" 66 text c6 "buzzword-only-review-passes" 67 text c7 "clean-review-passes" 68 text c8 "secret-with-dash-review-blocks" 69 text f1 "t1" 70 text f2 "t2" 71 text f3 "t3" 72 text f4 "t4" 73 text f5 "t5" 74 text f6 "t6" 75 text f7 "t7" 76 text f8 "t8" 77 text sdiff ".diff" 78 text sout ".out" 79 global bin uchar 2048 80 global binl ulong 1 81 global dir uchar 2048 82 global dirl ulong 1 83 global pth uchar 4096 84 global pthl ulong 1 85 global opth uchar 4096 86 global opl ulong 1 87 global fx uchar 8192 88 global fxl ulong 1 89 global tok uchar 128 90 global tokl ulong 1 91 global pkt uchar 4096 92 global pktl ulong 1 93 global obuf uchar 262144 94 global obl ulong 1 95 global st uchar 4 96 global cnt ulong 2 97 global nb uchar 32 98 global nfail ulong 1 99 100 fn fxadd t view uchar * to void 101 n = get fxl 0 102 for i ulong len t 103 put fx add n i get t i 104 end 105 put fxl 0 add n len t 106 ret 107 end 108 109 fn fxdash to void 110 n = get fxl 0 111 put fx n uchar 226 112 put fx add n 1 uchar 128 113 put fx add n 2 uchar 148 114 put fxl 0 add n 3 115 ret 116 end 117 118 fn fxtok to void 119 n = get fxl 0 120 t = get tokl 0 121 for i ulong t 122 put fx add n i get tok i 123 end 124 put fxl 0 add n t 125 ret 126 end 127 128 fn tokadd t view uchar * to void 129 n = get tokl 0 130 for i ulong len t 131 put tok add n i get t i 132 end 133 put tokl 0 add n len t 134 ret 135 end 136 137 fn fxhead name view uchar * to void 138 put fxl 0 0 139 fxadd hgit 140 fxadd name 141 fxadd hb 142 fxadd name 143 fxadd tnl 144 ret 145 end 146 147 fn dpath name view uchar * to void 148 n = get dirl 0 149 for i ulong n 150 put pth i get dir i 151 end 152 put pth n get tslash 0 153 n = add n 1 154 for i ulong len name 155 put pth add n i get name i 156 end 157 n = add n len name 158 for i ulong len sdiff 159 put pth add n i get sdiff i 160 end 161 put pthl 0 add n len sdiff 162 ret 163 end 164 165 fn opath name view uchar * to void 166 n = get dirl 0 167 for i ulong n 168 put opth i get dir i 169 end 170 put opth n get tslash 0 171 n = add n 1 172 for i ulong len name 173 put opth add n i get name i 174 end 175 n = add n len name 176 for i ulong len sout 177 put opth add n i get sout i 178 end 179 put opl 0 add n len sout 180 ret 181 end 182 183 fn fxwr to long 184 fd = fopen pth 0 get pthl 0 577 420 185 if lt fd 0 186 ret fd 187 end 188 n = get fxl 0 189 k = write int fd fx 0 n 190 r = fclose int fd 191 if ne k long n 192 ret -1 193 end 194 ret 0 195 end 196 197 fn pkhdr to void 198 n = get pktl 0 199 c = add get cnt 1 1 200 put cnt 1 c 201 put pkt 0 uchar and c 255 202 put pkt 1 uchar shr c 8 203 ret 204 end 205 206 fn pkadd t view uchar * to void 207 n = get pktl 0 208 m = len t 209 put pkt n uchar and m 255 210 put pkt add n 1 uchar shr m 8 211 n = add n 2 212 for i ulong m 213 put pkt add n i get t i 214 end 215 put pktl 0 add n m 216 pkhdr 217 ret 218 end 219 220 fn pkbin to void 221 n = get pktl 0 222 m = get binl 0 223 put pkt n uchar and m 255 224 put pkt add n 1 uchar shr m 8 225 n = add n 2 226 for i ulong m 227 put pkt add n i get bin i 228 end 229 put pktl 0 add n m 230 pkhdr 231 ret 232 end 233 234 fn pkpth to void 235 n = get pktl 0 236 m = get pthl 0 237 put pkt n uchar and m 255 238 put pkt add n 1 uchar shr m 8 239 n = add n 2 240 for i ulong m 241 put pkt add n i get pth i 242 end 243 put pktl 0 add n m 244 pkhdr 245 ret 246 end 247 248 fn pkstart to void 249 put pktl 0 2 250 put cnt 1 0 251 pkbin 252 ret 253 end 254 255 fn pkreview to void 256 pkstart 257 pkadd areview 258 pkadd aauthor 259 pkadd auser 260 pkadd apr 261 pkadd anum 262 pkadd adiff 263 pkpth 264 ret 265 end 266 267 fn pkaudit to void 268 pkstart 269 pkadd aaudit 270 pkadd adiff 271 pkpth 272 ret 273 end 274 275 note run: fork, child sends stdout and stderr to opth and executes the packet; returns the exit 276 note status 0..255, or -1 when the child died by a signal, or -2 when a host call failed. 277 fn run to long 278 pid = fork 279 if lt pid 0 280 ret -2 281 end 282 if eq pid 0 283 fd = fopen opth 0 get opl 0 577 420 284 if lt fd 0 285 exit 126 286 end 287 r = dupfd int fd 1 0 288 r = dupfd int fd 2 0 289 r = execprog pkt 0 get pktl 0 290 exit 127 291 end 292 r = waitpid int pid st 0 4 0 293 if ne r pid 294 ret -2 295 end 296 if ne get st 0 0 297 ret -1 298 end 299 ret long get st 1 300 end 301 302 fn rdout to long 303 put obl 0 0 304 fd = fopen opth 0 get opl 0 0 0 305 if lt fd 0 306 ret fd 307 end 308 n = ulong 0 309 c = true 310 while c bound 262145 311 k = read int fd obuf n sub len obuf n 312 if lt k 0 313 r = fclose int fd 314 ret k 315 end 316 if eq k 0 317 c = false 318 else 319 n = add n ulong k 320 if eq n len obuf 321 c = false 322 end 323 end 324 end 325 r = fclose int fd 326 put obl 0 n 327 ret 0 328 end 329 330 fn matchat i ulong t view uchar * to bool 331 for j ulong len t 332 if ne get obuf add i j get t j 333 ret false 334 end 335 end 336 ret true 337 end 338 339 fn has t view uchar * to bool 340 n = get obl 0 341 if lt n len t 342 ret false 343 end 344 m = add sub n len t 1 345 for i ulong m 346 if matchat i t 347 ret true 348 end 349 end 350 ret false 351 end 352 353 fn attok i ulong to bool 354 t = get tokl 0 355 for j ulong t 356 if ne get obuf add i j get tok j 357 ret false 358 end 359 end 360 ret true 361 end 362 363 fn hastok to bool 364 n = get obl 0 365 t = get tokl 0 366 if lt n t 367 ret false 368 end 369 m = add sub n t 1 370 for i ulong m 371 if attok i 372 ret true 373 end 374 end 375 ret false 376 end 377 378 fn pnum v ulong to void 379 n = ulong 0 380 x = v 381 c = true 382 while c bound 32 383 put nb sub 31 n uchar add 48 rem x 10 384 n = add n 1 385 x = div x 10 386 if eq x 0 387 c = false 388 end 389 end 390 k = write 1 nb sub 32 n n 391 ret 392 end 393 394 fn rep name view uchar * ok bool to void 395 put cnt 0 add get cnt 0 1 396 if ok 397 k = write 1 tpass 0 len tpass 398 else 399 k = write 1 tfail 0 len tfail 400 put nfail 0 add get nfail 0 1 401 end 402 k = write 1 name 0 len name 403 k = write 1 tnl 0 len tnl 404 ret 405 end 406 407 note go: write the fixture to DIR/F.diff, run the prepared argument kind, read DIR/F.out. 408 note kind 0 is review, 1 is audit. Returns the exit status, or -3 when a host call failed. 409 fn go f view uchar * kind ulong to long 410 dpath f 411 opath f 412 r = fxwr 413 if ne r 0 414 ret -3 415 end 416 if eq kind 0 417 pkreview 418 else 419 pkaudit 420 end 421 rc = run 422 if lt rc -1 423 ret -3 424 end 425 r = rdout 426 if ne r 0 427 ret -3 428 end 429 ret rc 430 end 431 432 fn tokgh to void 433 put tokl 0 0 434 tokadd gp1 435 tokadd gp2 436 tokadd gp3 437 ret 438 end 439 440 fn tokaws to void 441 put tokl 0 0 442 tokadd ak1 443 tokadd ak2 444 tokadd ak3 445 ret 446 end 447 448 fn case1 to long 449 tokgh 450 fxhead hci 451 fxadd hplus 452 fxadd hexport 453 fxtok 454 fxadd tnl 455 rc = go f1 0 456 if eq rc -3 457 ret 3 458 end 459 ok = eq rc 1 460 if eq has mgh false 461 ok = false 462 end 463 if eq has mfail false 464 ok = false 465 end 466 if hastok 467 ok = false 468 end 469 rep c1 ok 470 ret 0 471 end 472 473 fn case2 to long 474 tokaws 475 fxhead hrs 476 fxadd hplus 477 fxadd hconst 478 fxtok 479 fxadd hq 480 fxadd tnl 481 rc = go f2 1 482 if eq rc -3 483 ret 3 484 end 485 ok = eq rc 1 486 if eq has maws false 487 ok = false 488 end 489 if eq has mafail false 490 ok = false 491 end 492 if hastok 493 ok = false 494 end 495 rep c2 ok 496 ret 0 497 end 498 499 fn case3 to long 500 fxhead henv 501 fxadd hnew 502 rc = go f3 0 503 if eq rc -3 504 ret 3 505 end 506 ok = eq rc 1 507 if eq has menv false 508 ok = false 509 end 510 if eq has mfail false 511 ok = false 512 end 513 rep c3 ok 514 ret 0 515 end 516 517 fn dashfx to void 518 fxhead hlib 519 fxadd hplus 520 fxadd hnote 521 fxdash 522 fxadd hdashx 523 fxadd tnl 524 ret 525 end 526 527 fn case4 to long 528 dashfx 529 rc = go f4 0 530 if eq rc -3 531 ret 3 532 end 533 ok = eq rc 0 534 if eq has mdash false 535 ok = false 536 end 537 if eq has madv false 538 ok = false 539 end 540 if eq has mfmt false 541 ok = false 542 end 543 if has mfail 544 ok = false 545 end 546 rep c4 ok 547 ret 0 548 end 549 550 fn case5 to long 551 dashfx 552 rc = go f5 1 553 if eq rc -3 554 ret 3 555 end 556 ok = eq rc 0 557 if eq has mdash false 558 ok = false 559 end 560 if eq has maudok false 561 ok = false 562 end 563 if has mafail 564 ok = false 565 end 566 rep c5 ok 567 ret 0 568 end 569 570 fn case6 to long 571 fxhead hlib 572 fxadd hplus 573 fxadd hgame 574 fxadd tnl 575 rc = go f6 0 576 if eq rc -3 577 ret 3 578 end 579 ok = eq rc 0 580 if eq has mgame false 581 ok = false 582 end 583 if eq has madv false 584 ok = false 585 end 586 rep c6 ok 587 ret 0 588 end 589 590 fn case7 to long 591 fxhead hlib 592 fxadd hplus 593 fxadd hclean 594 fxadd tnl 595 rc = go f7 0 596 if eq rc -3 597 ret 3 598 end 599 ok = eq rc 0 600 if eq has mpass false 601 ok = false 602 end 603 if has madv 604 ok = false 605 end 606 if has mfail 607 ok = false 608 end 609 rep c7 ok 610 ret 0 611 end 612 613 fn case8 to long 614 tokgh 615 fxhead hci 616 fxadd hplus 617 fxadd hexport 618 fxtok 619 fxadd hnote 620 fxdash 621 fxadd tnl 622 rc = go f8 0 623 if eq rc -3 624 ret 3 625 end 626 ok = eq rc 1 627 if eq has mgh false 628 ok = false 629 end 630 if eq has mdash false 631 ok = false 632 end 633 if eq has mred false 634 ok = false 635 end 636 if hastok 637 ok = false 638 end 639 rep c8 ok 640 ret 0 641 end 642 643 fn main to int 644 if ne argcnt 3 645 k = write 2 tusage 0 len tusage 646 ret 2 647 end 648 n = argread 1 bin 0 len bin 649 if le n 0 650 k = write 2 tusage 0 len tusage 651 ret 2 652 end 653 put binl 0 ulong n 654 n = argread 2 dir 0 len dir 655 if le n 0 656 k = write 2 tusage 0 len tusage 657 ret 2 658 end 659 put dirl 0 ulong n 660 put cnt 0 0 661 put nfail 0 0 662 r = add case1 case2 663 r = add r case3 664 r = add r case4 665 r = add r case5 666 r = add r case6 667 r = add r case7 668 r = add r case8 669 if ne r 0 670 k = write 2 thost 0 len thost 671 ret 3 672 end 673 k = write 1 tsum 0 len tsum 674 nf = get nfail 0 675 if eq nf 0 676 k = write 1 tok1 0 len tok1 677 pnum get cnt 0 678 k = write 1 tnl 0 len tnl 679 ret 0 680 end 681 k = write 1 tbad 0 len tbad 682 pnum get cnt 0 683 k = write 1 tfl 0 len tfl 684 pnum nf 685 k = write 1 tnl 0 len tnl 686 ret 1 687 end