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/aienos.com/blob/main/om/agora/policy-check.om # aienos.com Source of www.aienos.com, served from my own hardware 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 `aienos.com / om / agora / policy-check.om` 215 lines ยท 4210 bytes Raw Blame History 1 note Compose: printf 'om2\n'; cat policy.om policy-check.om; pipe the result to the pinned omc. 2 note No args runs modeled fixtures. CLI: ALLOW DENY EXPECTED_PROXY EXPECTED_LOCAL. 3 note Exit 0 accepted, 1 refused, 90 malformed invocation/expected token or over-capacity argument. 4 note Optional first arg selects an intentionally broken oracle, never used by po_check. 5 note --mutant-order requires literal canonical deny order; --mutant-missing-deny accepts either deny alone. 6 note --mutant-extra-allow ignores extra allow tokens. Each flag alone runs the same fixtures and must fail. 7 text pc_proxy "192.0.2.10/32" 8 text pc_local "127.0.0.1/32" 9 text pc_a "192.0.2.10/32 127.0.0.1/32" 10 text pc_ar "127.0.0.1/32 192.0.2.10/32" 11 text pc_d "0.0.0.0/0 ::/0" 12 text pc_dr "::/0 0.0.0.0/0" 13 text pc_d4 "0.0.0.0/0" 14 text pc_d6 "::/0" 15 text pc_ax "192.0.2.10/32 127.0.0.1/32 198.51.100.7/32" 16 text pc_dx "0.0.0.0/0 ::/0 203.0.113.0/24" 17 text pc_ad "192.0.2.10/32 127.0.0.1/32 192.0.2.10/32" 18 text pc_dd "::/0 0.0.0.0/0 ::/0" 19 text pc_ws " \t192.0.2.10/32\n127.0.0.1/32\t " 20 text pc_emp "" 21 text pc_bad "0.0.0.0/0,::/0" 22 text pc_am "192.0.2.10/32,127.0.0.1/32" 23 text pc_wsp " \t\n " 24 text pc_m1 "--mutant-order" 25 text pc_m2 "--mutant-missing-deny" 26 text pc_m3 "--mutant-extra-allow" 27 text pc_pass "AGORA POLICY OMEGA PASS modeled exact sets, deny/allow permutations, omissions, extras, empty/malformed, whitespace, duplicates, and bounds\n" 28 fn pc_eval mode ulong to bool 29 if eq mode 0 30 ret po_check 0 4096 8192 12288 31 end 32 if eq mode 1 33 if not po_check 0 4096 8192 12288 34 ret false 35 end 36 ret po_text 4096 po_len 4096 pc_d 37 end 38 if eq mode 2 39 if ne po_set 0 8192 12288 false 3 40 ret false 41 end 42 d = po_set 4096 8192 12288 true 43 ret or eq d 1 or eq d 2 eq d 3 44 end 45 if eq mode 3 46 if ne po_set 4096 8192 12288 true 3 47 ret false 48 end 49 a = po_set 0 8192 12288 false 50 ret or eq a 3 eq a 7 51 end 52 ret false 53 end 54 fn pc_case a view uchar * d view uchar * want bool mode ulong to bool 55 if not po_load 0 a 56 ret false 57 end 58 if not po_load 4096 d 59 ret false 60 end 61 ret eq pc_eval mode want 62 end 63 fn pc_test mode ulong to int 64 if not po_load 8192 pc_proxy 65 ret 39 66 end 67 if not po_load 12288 pc_local 68 ret 39 69 end 70 if not pc_case pc_a pc_d true mode 71 ret 40 72 end 73 if not pc_case pc_a pc_dr true mode 74 ret 41 75 end 76 if not pc_case pc_ar pc_d true mode 77 ret 42 78 end 79 if not pc_case pc_ar pc_dr true mode 80 ret 43 81 end 82 if not pc_case pc_a pc_d4 false mode 83 ret 44 84 end 85 if not pc_case pc_a pc_d6 false mode 86 ret 45 87 end 88 if not pc_case pc_ax pc_d false mode 89 ret 46 90 end 91 if not pc_case pc_a pc_dx false mode 92 ret 47 93 end 94 if not pc_case pc_emp pc_d false mode 95 ret 48 96 end 97 if not pc_case pc_a pc_emp false mode 98 ret 49 99 end 100 if not pc_case pc_a pc_bad false mode 101 ret 50 102 end 103 if not pc_case pc_am pc_d false mode 104 ret 51 105 end 106 if not pc_case pc_ad pc_dd true mode 107 ret 52 108 end 109 if not pc_case pc_ws pc_dr true mode 110 ret 53 111 end 112 if not pc_case pc_wsp pc_d false mode 113 ret 54 114 end 115 if not pc_case pc_a pc_wsp false mode 116 ret 55 117 end 118 note Missing NUL: fill exactly one complete slot, then restore it through pc_case. 119 for i ulong 4096 120 put po_buf i 65 121 end 122 if po_check 0 4096 8192 12288 123 ret 56 124 end 125 if not pc_case pc_a pc_d true mode 126 ret 57 127 end 128 if po_check 16384 4096 8192 12288 129 ret 58 130 end 131 if po_check 0 4096 16384 12288 132 ret 59 133 end 134 if not po_load 8192 pc_emp 135 ret 60 136 end 137 if po_check 0 4096 8192 12288 138 ret 61 139 end 140 if not po_load 8192 pc_am 141 ret 62 142 end 143 if po_check 0 4096 8192 12288 144 ret 63 145 end 146 r = write 1 pc_pass 0 len pc_pass 147 if ne r long len pc_pass 148 ret 64 149 end 150 ret 0 151 end 152 fn pc_arg idx ulong off ulong to bool 153 n = argread idx po_buf off 4095 154 if or lt n 0 gt n 4095 155 ret false 156 end 157 put po_buf add off ulong n 0 158 ret true 159 end 160 fn pc_mode to ulong 161 if not pc_arg 1 0 162 ret 90 163 end 164 n = po_len 0 165 if po_text 0 n pc_m1 166 ret 1 167 end 168 if po_text 0 n pc_m2 169 ret 2 170 end 171 if po_text 0 n pc_m3 172 ret 3 173 end 174 ret 90 175 end 176 fn main to int 177 if eq argcnt 1 178 ret pc_test 0 179 end 180 mode = ulong 0 181 base = ulong 1 182 if or eq argcnt 2 eq argcnt 6 183 mode = pc_mode 184 if eq mode 90 185 ret 90 186 end 187 if eq argcnt 2 188 ret pc_test mode 189 end 190 base = 2 191 else 192 if ne argcnt 5 193 ret 90 194 end 195 end 196 if not pc_arg base 0 197 ret 90 198 end 199 if not pc_arg add base 1 4096 200 ret 90 201 end 202 if not pc_arg add base 2 8192 203 ret 90 204 end 205 if not pc_arg add base 3 12288 206 ret 90 207 end 208 if or not po_atom 8192 not po_atom 12288 209 ret 90 210 end 211 if pc_eval mode 212 ret 0 213 end 214 ret 1 215 end