Skip to content

Instantly share code, notes, and snippets.

@raeq
raeq / pua-benign-census.py
Created November 1, 2026 13:00
Reproduction for raeq/disarm#1212: where private-use characters sit in the corpora benchmarks/meta reads
r"""Where private-use characters sit in the benign and practitioner corpora benchmarks/meta reads.
For raeq/disarm. Counts and code points only, and no corpus text is printed. Pass a checkout of raeq/disarm
and a cache that benchmarks.meta has provisioned:
DISARM_META_CACHE=cache python -m benchmarks.meta --run --subject disarm --select benign-controls label-free-invariants --no-baseline
python -I pua-benign-census.py <checkout> cache
Expected output, 0.19.0 wheel, CPython 3.13:
@raeq
raeq / pua-in-a-word.py
Last active November 1, 2026 13:01
Reproduction for raeq/disarm#1212: private-use characters inside words, what reports and what canonicalize removes
r"""Private-use characters inside words: what reports, and what `canonicalize` then removes.
For raeq/disarm. Needs only disarm, and every input is built here. Run it on each wheel, on CPython 3.13.
Expected output, 0.18.0 wheel:
disarm 0.18.0
input has_anomalies kinds canonicalize llm_guardrail is_canonical
one inside a word False [] 'password' 'password' False
one inside a word, supplementary plane False [] 'password' 'password' False
@raeq
raeq / cr-two-spaces.py
Created November 1, 2026 12:30
raeq/disarm #1211: what a CR with two spaces shows on a terminal and what disarm reports
"""A CR with two spaces hides a two-letter word, and the comment and pages name only three spaces.
Needs disarm and pyte==0.8.2, a VT100 emulator that gives the screen column independently of disarm.
Run it under `pip install disarm==0.18.0` and again under `disarm==0.19.0`, on CPython 3.13.
Each input is the cover, CR, the spaces, LF, `next`. Built here.
Expected output, 0.18.0 wheel:
disarm 0.18.0
@raeq
raeq / overlay-false-positives.py
Created November 1, 2026 12:30
raeq/disarm #1210: words the overlay rule reports against the guide, on the 0.18.0 wheel, the parent of #1199 and the 0.19.0 wheel
"""Words the overlay rule reports that #1199's own reasoning, or the guide, says should stay clean.
Needs only disarm. Run it on each of the three builds below, on CPython 3.13. Every input is built here, and no set read holds these words.
`*x` means `x` followed by the mark.
Expected output, 0.18.0 wheel:
disarm 0.18.0
spec mark marked/letters has_anomalies kinds
@raeq
raeq / overlay-filler-regression.py
Created November 1, 2026 12:30
raeq/disarm #1209: a format character between a letter and its strike, on the 0.18.0 wheel, the parent of #1199 and the 0.19.0 wheel
"""A format character between a letter and its strike: reported at 7b84f9d2, clean on the 0.19.0 wheel.
Needs only disarm. Run it on each of the three builds below, on CPython 3.13. The 0.18.0 wheel predates
the overlay rule, so it reads a plain struck word clean as well. Every input is built here, and no set
read holds this shape.
Expected output, 0.18.0 wheel:
disarm 0.18.0
== every Cf the host names, between each letter of `password` and U+0336
@raeq
raeq / encoded-text-census.py
Created November 1, 2026 11:57
raeq/disarm #1208: base64, hex and binary spelled in text, what disarm does and what a decode would cost
"""Base64, hex and binary spelled in text: what disarm does today, and what a decode would cost.
disarm 0.19.0 from PyPI, CPython 3.13. Prints counts. No prompt or decoded text is printed.
python -I encoded-text-census.py <L1B3RT4S at f441d65> <jailbreak_llms> <FuzzyAI> [<directory of repositories, a stress set>]
A run has the shape when the pattern matches it. It reads as text when it also decodes to valid UTF-8
that is wholly printable and at least 70% letters and spaces, the same bar `decode_smuggled` sets for
its `text` field, with the letter share added because a hash decodes to noise.
@raeq
raeq / substitution-letters.py
Created November 1, 2026 11:57
raeq/disarm #1205: the letters llm_guardrail keeps in L1B3RT4S, and rag_ingest on small capitals
"""The letters llm_guardrail keeps in L1B3RT4S, why they stay, and what rag_ingest does instead.
disarm 0.19.0 from PyPI, CPython 3.13 (host UCD 15.1 supplies names and categories). Prints counts,
hex and Unicode names. No corpus text, and nothing in the corpus is decoded: the comparison with
upstream's maps is set membership.
python -I substitution-letters.py <repo at v0.19.0> <DISARM_META_CACHE after the suite ran>
<L1B3RT4S at f441d65> <jailbreak_llms> <FuzzyAI> [<directory of repositories, a stress set>]
Expected output:
@raeq
raeq / st3gg-silent-techniques.py
Created November 1, 2026 11:57
raeq/disarm #1207: the three ST3GG techniques has_anomalies reads as clean, and what a report would cost
"""ST3GG's eleven text techniques: which read clean to has_anomalies, and what a report would cost.
disarm 0.19.0 from PyPI, CPython 3.13. Prints counts only. ST3GG's files are read as data and its
README is never opened.
python -I st3gg-silent-techniques.py <repo at v0.19.0> <DISARM_META_CACHE after the suite ran>
<jailbreak_llms> <FuzzyAI> [<directory of repositories, a stress set>]
Expected output:
@raeq
raeq / regional-indicator-runs.py
Created November 1, 2026 11:57
raeq/disarm #1206: regional indicators in L1B3RT4S and benign text, and the 16 style pairs of p4rs3lt0ngv3-transforms
"""Regional indicators, and the 16 style pairs of p4rs3lt0ngv3-transforms that do not recover.
disarm 0.19.0 from PyPI, CPython 3.13. Prints counts and code points. No corpus text.
python -I regional-indicator-runs.py <repo at v0.19.0> <DISARM_META_CACHE after the suite ran>
<L1B3RT4S at f441d65> <jailbreak_llms> <FuzzyAI> <emoji-sequences.txt, Emoji 18.0>
[<directory of repositories, a stress set>]
The first two arguments exist so that upstream's transforms run only inside the suite's own
Node permission sandbox, after its digest check. decancer-py is optional.
@raeq
raeq / untrace-techniques-repro.py
Created November 1, 2026 11:36
Reproduction for raeq/disarm#1204: why untrace-techniques fell from 16 to 10, and what the suite reads
#!/usr/bin/env python3
r"""Why `untrace-techniques` in disarm's meta-benchmark fell from 16 to 10, and what it reads.
For raeq/disarm: the suite's `reported_by_any_detector` falls between 0.15.0 and 0.16.0. This runs
the suite's own probe selection against each published wheel, and reads untrace's expected reports.
Nothing from upstream executes, and no corpus text is printed: only file names, counts and code
points. The corpus is pinned here. The suite itself fetches `refs/heads/main`, which is this commit
as of 2026-11-01, unchanged since 2026-08-18.