interplane.Get Omega
Read in your language

omtex

aien-dev/omtex

Brought by drakestapleton

GitHub aien-dev/omtex#1 (code only)

closed derived a5d69dddfeac499b #1

Imported from GitHub aien-dev/omtex#1 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 363500c1b010219ce0b22f8e8e53d0aff7c55834 · Head f6061d7d3c5b4af28957f58693f2461f68873461

drakestapleton reviewed (COMMENTED) on 2026-10-30 21:49 UTC

Verdict: hold, author intent.

The title says (draft) and the body says "Draft on purpose". Before this merges, Drake also needs to OK publishing drake@aienos.com as the security contact in SECURITY.md, and the audit scope text. Private vulnerability reporting is not enabled here yet. This pass found no code must-fix; it is docs plus CI hygiene, with no gate, anchor or receipt changes.

— Grokbot

Fetch it

A git bundle of the pull request's head, 7909 bytes.

curl -fsSL https://interplane.io/drakestapleton/omtex/patches/a5d69dddfeac499b.bundle -o a5d69dddfeac499b.bundle
git fetch a5d69dddfeac499b.bundle refs/pull/1/head

Raw bundle · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/omtex
1
f6061d7d3c5b4af28957f58693f2461f68873461
{"kind":"github-import","owner":"aien-dev","repo":"omtex","number":1,"url":"https://github.com/aien-dev/omtex/pull/1","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:40:49Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..54dc308
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,9 @@
+# Dependabot: monthly version updates for the pinned GitHub Actions.
+# Pull requests only; nothing merges itself. Security advisories are handled by GitHub
+# Dependabot security updates on the repository settings.
+version: 2
+updates:
+  - package-ecosystem: github-actions
+    directory: /
+    schedule:
+      interval: monthly
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..a0c354a
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,36 @@
+# CI for omtex: fetches the pinned omega-mv commit (tools/pin.sh), checks the committed omc
+# against the pinned sha256, and runs tests/run.sh on a GitHub-hosted arm64 runner (omc is an
+# AArch64 ELF). A second job writes an SPDX SBOM of the tree for auditors.
+name: CI
+on:
+  pull_request:
+  push:
+    branches: [main]
+permissions:
+  contents: read
+jobs:
+  test:
+    runs-on: ubuntu-24.04-arm
+    timeout-minutes: 20
+    env:
+      OMTEX_NICE: ''
+    steps:
+      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
+        with:
+          persist-credentials: false
+      - name: Pin record
+        run: sed -n '1,4p' tools/pin.sh
+      - name: Run the suite with the pinned omc
+        run: sh tests/run.sh
+  sbom:
+    runs-on: ubuntu-latest
+    timeout-minutes: 10
+    steps:
+      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
+        with:
+          persist-credentials: false
+      - uses: anchore/sbom-action@66cbf4bc1f1c0d2edc94016e65bc221b6bb0ad6c # v0.24.3
+        with:
+          path: .
+          format: spdx-json
+          artifact-name: sbom-${{ github.sha }}.spdx.json
diff --git a/AUDIT_SCOPE.md b/AUDIT_SCOPE.md
new file mode 100644
index 0000000..04d1136
--- /dev/null
+++ b/AUDIT_SCOPE.md
@@ -0,0 +1,111 @@
+# Audit scope
+
+Written for an outside, independent security audit. Revision described:
+`4c86614a1ee09a5b8ca4da6c2f4a7bc958d1fd64` on `main`, 2026-10-26. Everything below is taken from the repository's own files at
+that revision; items marked NOT_RUN were not executed while writing this document.
+
+## What this repository is
+
+An Omega library, `lib/omtex.om` (1,176 lines, an `om2` unit), that writes LaTeX. A paper
+(`examples/*/paper.om`) is concatenated after the library and compiled with the pinned `omc`; the
+resulting generator prints the `.tex` file, and `paper.gen check OMC DIR` compiles every Omega
+listing to confirm it is accepted or refused as stated. `docs/DESIGN.md` (110 lines) is the
+contract for escaping, the math check, listings and refusal codes. `tools/` holds `build.sh`,
+`pin.sh`, `compare.sh` and `zenodo-draft.sh`; `tests/run.sh` is the suite. Licence: Apache 2.0
+(`LICENSE`, `NOTICE`).
+
+## What to review, in priority order
+
+1. Prose escaping in `lib/omtex.om` against the table in `docs/DESIGN.md` ("Prose markup"):
+   always-escaped characters, paired quotes and emphasis, cite and ref keys, the allowed
+   backslash escapes, and refusal of control bytes and malformed UTF-8 (trap 11, exit 111).
+2. The math check: printable ASCII only, balanced braces, no `% $ #`, and a deny list of control
+   sequences (`\input \include \write \def \edef \gdef \xdef \let \catcode \immediate \openout
+   \openin \csname \special \read`). It is a deny list; check whether other primitives or macros
+   (for example `\newcommand`, `\renewcommand`, `\expandafter`) can reach the same effects.
+   `rawtex` and `preamble` lines use the same check with `&` and `\\` allowed.
+3. Listings: bodies containing `\end{lstlisting}`, non-ASCII or control bytes other than LF and
+   tab are refused.
+4. The `check` path (`txcheck`, `txrun`, `txchild`, `txpath`): it writes `DIR/<label>.om` and runs
+   `OMC` with fork and exec. The label character set (`zrkey`) allows `.` and `/`; check whether a
+   label such as `../x` leaves `DIR`.
+5. `tools/zenodo-draft.sh`: every request goes through `api()`, which refuses any URL containing
+   `publish`; the token is written to a header file under `umask 077` and unset; the script ends by
+   re-reading the deposition and failing unless it is still unsubmitted. The `eval` of the token
+   variable name takes a fixed name chosen by `--sandbox`.
+6. `tools/build.sh`: runs `pdflatex -interaction=nonstopmode -halt-on-error -no-shell-escape`,
+   and `bibtex` only when the `.aux` names bibliography data.
+7. `tools/pin.sh`: fetches omega-mv commit `91b3c9326919faf1491e29ae9276929e8349b8c7` with
+   `git fetch --depth 1` and refuses any `omc` whose sha256 differs from
+   `189ada82e00bb440cb41351bd252cc68c54a1b1050051cc42a1df700081c3b54`.
+
+## Trust boundaries
+
+- The paper source is written by its author and compiled as code. omtex treats prose and math
+  text inside it as data that must not become arbitrary LaTeX.
+- pdfTeX is trusted to honour `-no-shell-escape`.
+- Zenodo is reached over HTTPS with a bearer token from the environment (`ZENODO_TOKEN` or
+  `ZENODO_SANDBOX_TOKEN`).
+
+## Threat model summary
+
+- Assets: the integrity of generated papers, the Zenodo token, published Zenodo records.
+- Attackers considered: prose or math text that tries to inject LaTeX; a mistaken run of the
+  Zenodo script against a published record.
+- Defended: escaping with no raw prose path, math deny list, listing checks, output cap of 4 MiB,
+  deterministic output, the publish refusal in `api()`.
+- Not defended / explicitly out of scope: a hostile paper author (the paper is a program; it can
+  call Omega host words directly); TeX Live vulnerabilities.
+
+## Build from source at a pin
+
+Host tools and versions are listed in `DEPENDENCIES.md` (pdfTeX 3.141592653-2.6-1.40.25, TeX Live
+2023, `cm-super` 0.3.4-17, `git`, `sha256sum`). The compiler is fetched by `tools/pin.sh`.
+
+```sh
+tools/build.sh examples/listings/paper.om build/listings
+OMTEX_NO_PDF=1 tools/build.sh examples/hello/hello.om build/hello   # stop after the .tex
+```
+
+## Run every test
+
+NOT_RUN while writing this document. From AGENTS.md:
+
+```sh
+tests/run.sh
+tools/compare.sh ORIG.tex ORIG.pdf build/X/paper.tex build/X/paper.pdf
+```
+
+`tests/run.sh` pairs every refusal case with an accepted case, prints NOT_RUN (never PASS) for
+cases the host cannot run, and exits 1 on any FAIL. `tools/compare.sh` needs poppler-utils and an
+original paper's `.tex` and PDF. `tools/zenodo-draft.sh` needs a Zenodo token and network; NOT_RUN.
+
+## Known limitations and NOT_RUN
+
+- Hosted CI (`.github/workflows/ci.yml`, added with this document) runs `sh tests/run.sh` with the
+  pinned `omc` on a GitHub-hosted arm64 runner and writes an SPDX SBOM. It does not run
+  `tools/compare.sh` or `tools/zenodo-draft.sh`.
+- Moving the pin requires rerunning `tests/run.sh`, both reproductions and the keyword parity test
+  (AGENTS.md).
+- A typesetting engine in Omega is not started; pdfTeX stays a host tool (`DEPENDENCIES.md`).
+- `curl`, `jq` and `md5sum` are used by the Zenodo script; Omega replacements are named in
+  `DEPENDENCIES.md` but not built.
+
+## Dependencies and provenance
+
+- Build path: pinned `omc` (fetched and hash-checked), pdfTeX and TeX Live packages, `bibtex` when
+  used, POSIX shell tools. The generator is a static Omega binary that only writes LaTeX to stdout
+  (`DEPENDENCIES.md`).
+- Verification only: poppler-utils 24.02.0, mawk 1.3.4 (for the pin's `seed/omc/genkw.awk`).
+- Zenodo script: curl 8.5.0, jq 1.7, md5sum (coreutils 9.4).
+
+## Evidence
+
+- `evidence/tests.txt`: `TESTS pass=59 fail=0 not_run=0`.
+- `evidence/REPRODUCTION.md` with `compare-omega-language.txt` and `compare-turing-brief.txt`:
+  reproductions of two published papers (for the first, 0 differing text lines and 9 of 9 pages
+  pixel-identical against the original rebuilt on the same TeX Live).
+- `evidence/zenodo-new.txt` and `evidence/zenodo-newversion.txt`: draft runs against zenodo.org.
+
+AGENTS.md: never edit a recorded result. These are the author's logs, not independent
+reproduction.
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 0000000..5baf5a6
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,55 @@
+# Security policy
+
+## Reporting a vulnerability
+
+Report privately. Do not open a public issue, pull request or discussion about it.
+
+Report vulnerabilities privately through the repository's Security tab,
+"Report a vulnerability", at https://github.com/aien-dev/omtex/security/advisories/new.
+
+Include the commit or release you tested, the component (path), steps to reproduce, and what an
+attacker gains. If the report involves a secret, say where it was exposed and do not send the
+secret itself. Encrypted mail is not required; do not post proof-of-concept payloads publicly.
+
+## Response targets
+
+This project has one maintainer; the targets below are best effort and stated honestly.
+
+- Acknowledgement: within 3 working days.
+- Triage and severity: within 7 days of acknowledgement.
+- Fix or mitigation for confirmed issues: aim for 30 days for high and critical, 90 days
+  otherwise, with a status update at least every 14 days until closed.
+- Disclosure: coordinated. An advisory is published with credit (unless you ask otherwise)
+  once the fix is on the default branch. Default embargo 90 days, negotiable.
+
+## Scope
+
+`omtex` is an Omega library (`lib/omtex.om`) for writing LaTeX papers. A paper is an Omega program
+compiled together with the library; running it prints LaTeX, which `pdflatex` renders.
+`tools/zenodo-draft.sh` uploads a built PDF to an unpublished Zenodo draft.
+
+In scope:
+
+- Prose text that reaches LaTeX unescaped, or math, `rawtex` or `preamble` text that passes the
+  check in `docs/DESIGN.md` while using a control sequence that reads or writes files or changes
+  category codes.
+- A listing body that escapes its `lstlisting` environment.
+- `paper.gen check OMC DIR` writing outside `DIR` or running something other than the given
+  compiler.
+- `tools/zenodo-draft.sh` publishing a record, leaking the token (it is meant to stay in a
+  mode-600 header file, never in argv or output), or changing a record it should refuse.
+- `tools/pin.sh` accepting a compiler other than the pinned sha256.
+
+Out of scope:
+
+- TeX Live, pdfTeX, Zenodo, the pinned compiler itself, and the host operating system.
+
+## Supported versions
+
+Only the default branch `main`; there is no release. Reports against older commits are welcome but fixes land on the default branch only.
+
+## Status
+
+Hosted CI (`.github/workflows/ci.yml`) runs `sh tests/run.sh` with the pinned compiler on every
+pull request and push to `main`. No certification, no bug bounty. See AUDIT_SCOPE.md for what to
+review and how to build and test it.