|
1 | | -# ============================================================================== |
| 1 | +# ============================================================================= |
2 | 2 | # High-trust RDF Bloom filter hardening: trusted artifact vs tampered artifact |
3 | 3 | # |
4 | 4 | # Why this example exists: |
|
19 | 19 | # * :trustedArtifact is accepted under both the weak and hardened rules |
20 | 20 | # * :tamperedArtifact can pass the weak budget-only path |
21 | 21 | # * :tamperedArtifact is rejected by the hardened path, with explicit reasons |
22 | | -# ============================================================================== |
| 22 | +# ============================================================================= |
23 | 23 |
|
24 | 24 | @prefix : <http://example.org/high-trust-rdf#>. |
25 | 25 | @prefix math: <http://www.w3.org/2000/10/swap/math#>. |
26 | 26 | @prefix log: <http://www.w3.org/2000/10/swap/log#>. |
27 | 27 | @prefix xsd: <http://www.w3.org/2001/XMLSchema#>. |
28 | 28 |
|
29 | | -# ---------------- |
| 29 | +# ----------------- |
30 | 30 | # Trusted artifact |
31 | | -# ---------------- |
| 31 | +# ----------------- |
32 | 32 |
|
33 | 33 | :trustedArtifact a :HighTrustRdfArtifact; |
34 | 34 | :canonicalTripleCount 1200; |
|
45 | 45 | :maybePositivePolicy :ConfirmAgainstCanonicalGraph; |
46 | 46 | :definiteNegativePolicy :ReturnAbsent. |
47 | 47 |
|
48 | | -# ----------------- |
| 48 | +# ------------------ |
49 | 49 | # Tampered artifact |
50 | | -# ----------------- |
| 50 | +# ------------------ |
51 | 51 |
|
52 | 52 | :tamperedArtifact a :HighTrustRdfArtifact; |
53 | 53 | :canonicalTripleCount 1200; |
|
94 | 94 | ?a :lambda ?lambda. |
95 | 95 | }. |
96 | 96 |
|
97 | | -# ---------------------------------------------------------------------------- |
| 97 | +# ========================== |
98 | 98 | # Weak path (pre-hardening) |
99 | | -# |
| 99 | +# ========================== |
100 | 100 | # This path deliberately computes a budget envelope from whatever numbers were |
101 | 101 | # supplied, without first proving that they form a sane certificate. |
102 | | -# ---------------------------------------------------------------------------- |
103 | 102 |
|
104 | 103 | { |
105 | 104 | ?a :hashFunctions ?k; |
|
158 | 157 | ?a :weakDecision :AcceptUnderWeakBudgetOnlyRules. |
159 | 158 | }. |
160 | 159 |
|
161 | | -# ------------------------------ |
| 160 | +# ============================== |
162 | 161 | # Hardened path (current design) |
163 | | -# ------------------------------ |
| 162 | +# ============================== |
164 | 163 |
|
165 | 164 | # Parameter sanity is explicit and required. |
166 | 165 | { |
|
263 | 262 | ?a :hardenedDecision :AcceptForHighTrustUse. |
264 | 263 | }. |
265 | 264 |
|
266 | | -# ------------------------------------------------- |
| 265 | +# ====================================== |
267 | 266 | # Explicit tamper evidence / reject path |
268 | | -# |
| 267 | +# ====================================== |
269 | 268 | # These rules make hardening visible in the output. |
270 | | -# ------------------------------------------------- |
271 | 269 |
|
272 | 270 | { |
273 | 271 | ?a :bloomBits ?m. |
|
324 | 322 | ?a :hardenedDecision :RejectForHighTrustUse. |
325 | 323 | }. |
326 | 324 |
|
| 325 | + |
| 326 | +# --------------------------------- |
| 327 | +# Explicit contrast for wide readers |
| 328 | +# --------------------------------- |
| 329 | + |
| 330 | +{ |
| 331 | + :trustedArtifact :weakDecision :AcceptUnderWeakBudgetOnlyRules; |
| 332 | + :hardenedDecision :AcceptForHighTrustUse. |
| 333 | +} |
| 334 | +=> |
| 335 | +{ |
| 336 | + :result :trustedArtifactBehavesAsExpected true. |
| 337 | +}. |
| 338 | + |
| 339 | +{ |
| 340 | + :tamperedArtifact :weakDecision :AcceptUnderWeakBudgetOnlyRules; |
| 341 | + :hardenedDecision :RejectForHighTrustUse. |
| 342 | +} |
| 343 | +=> |
| 344 | +{ |
| 345 | + :result :tamperedArtifactShowsWhyHardeningMatters true. |
| 346 | +}. |
| 347 | + |
| 348 | +{ |
| 349 | + ?a :weakDecision ?weak; |
| 350 | + :hardenedDecision ?hard. |
| 351 | +} |
| 352 | +log:query |
| 353 | +{ |
| 354 | + :result :decision [ |
| 355 | + :artifact ?a; |
| 356 | + :weak ?weak; |
| 357 | + :hardened ?hard |
| 358 | + ]. |
| 359 | +}. |
| 360 | + |
327 | 361 | # --------------- |
328 | 362 | # Readable output |
329 | 363 | # --------------- |
|
0 commit comments