interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

[Codex Security] Unvalidated argus.lock content is evaluated as shell syntax by GNU make

open eb0e50a79088fd5d #9 · opened 2026-11-15 17:10 UTC

Imported from GitHub drakestapleton/omega-mv#9, by drakestapleton

Base 91f88c287d7831784a808c5b054818fd9055afb5 · Head dedfb9188cafd84dadb69fae9e91eff176a9b486

drakestapleton wrote on 2026-11-15 17:10 UTC

The patch validates argus.lock as data before GNU make can derive or execute any ARGUS command.

  • A fixed awk parser accepts exactly one lowercase 40-hex commit; trailing bytes and malformed representations fail make parsing.
  • ARGUS_COMMIT and ARGUS_SHORT are override-protected parser outputs, and the archive revision is quoted and option-delimited.
  • This breaks the contributor-controlled lock-to-shell path before arbitrary commands can run with developer, CI, or gate authority.
  • The original ARGUS commit remains pinned, canonical final-newline handling remains supported, and copied-Makefile fixtures receive the required lock.

Static Verification Checks

  • Strict lock parsing (Passed) — Makefile ARGUS_LOCK_FIELDS accepts one lowercase 40-hex line and excludes every other lock byte from shell expansion.
  • Protected archive revision (Passed) — Makefile ARGUS_COMMIT and ARGUS_SHORT are override-protected parser outputs, preserving pinned archive selection without attacker-controlled syntax.
  • Gate path closure (Passed) — tests/gates/run.sh quotes the first field, while Makefile rejects the complete malformed file before ARGUS shell sinks.
  • Malformed input coverage (Passed) — tests/argus_lock_validation.sh asserts whitespace, extra fields, options, newlines, comments, and metacharacters are refused without payload execution.
  • Legitimate pin preservation (Passed) — argus.lock retains the original commit, and source assertions accept canonical content with or without its final newline.
  • Fixture compatibility preserved (Passed) — tests/aienos_lock_source/run.sh copies argus.lock into its Makefile fixture, preserving unrelated lock-source behavior under strict parsing.
  • Finding: acf_d908322d5e74752a52568ec815fc1d4e

  • Patch: arp_278019b86ba27a93f64c6dd9d1aaf001
  • Base commit: 91f88c287d7831784a808c5b054818fd9055afb5
  • Patch SHA-256: 1ed590425d6842772925be337589a4f535e81ab9d28e5a77551caffa0d0107fd

Apply it

git checkout -b patch-eb0e50a79088fd5d 91f88c287d7831784a808c5b054818fd9055afb5
curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/eb0e50a79088fd5d.patch | git am

Raw patch (mbox) · Diff

Provenance

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

github-import 1
drakestapleton/omega-mv
9
dedfb9188cafd84dadb69fae9e91eff176a9b486
{"kind":"github-import","owner":"drakestapleton","repo":"omega-mv","number":9,"url":"https://github.com/drakestapleton/omega-mv/pull/9","export_sha256":"7a4dc05cfaafc4ff4b6c7811f8b55128091a7d4d233c7761f900f26220660f83","imported_utc":"2026-11-18T16:39:50Z"}

Changes

diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index aa4a7bd38..00ddd1a67 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -7,6 +7,7 @@ The current development method is [Human-Directed Agentic Engineering (HDAE)](RE
 
 | Model | What it did |
 |---|---|
+| OpenAI Codex | Made `argus.lock` a strict single-commit file, validated it as data before GNU make derives ARGUS paths or recipes, and added static regression coverage for malformed and shell-bearing lock content. |
 | Grok 4.7 (via Cursor Agent) | Merged main `fd3751b31` (#1020, carrying #1045 and #1050) into #1052. The only conflict was the generated root `.crumb` (child `last_commit` stamps, the `tests` digest, and the root digest). Recompiled with the crumb.lock tool (`d0f0b95d`); `crumb verify .` current. The #525/#962 pins were left as committed: `src/checker2/c2_check.c`, `src/compiler/osc_ir.c` and `src/compiler/osc_ir.h` still hash to the SHA-256s in `ACCEPTED`. |
 | Claude Opus 5.5 (via omp) | #1020 (actions/cache-4.3.0 ->6.1.0): merged main `d3d1b1bc` and recompiled the root crumb with the crumb.lock tool (`d0f0b95d`). The root crumb's source tree covers `.github/workflows/`, so the bump alone left it stale and `AIEN Checks` failed at `crumb verify .` (`1 of 188 crumbs stale`). |
 | Claude Opus 5.5 (via omp) | #1018 (actions/upload-artifact-4 ->7): merged main `d3d1b1bc` and recompiled the root crumb with the crumb.lock tool (`d0f0b95d`). The root crumb's source tree covers `.github/workflows/`, so the bump alone left it stale and `AIEN Checks` failed at `crumb verify .` (`1 of 188 crumbs stale`). |
diff --git a/Makefile b/Makefile
index 7e1426b3b..7fd47bd47 100644
--- a/Makefile
+++ b/Makefile
@@ -1427,8 +1427,15 @@ test-typed-results: $(RX_TYPED_TEST)
 # same library as the default targets (with no observer set it
 # costs one NULL check per admin operation), RX_ARGUS=0 included.
 ARGUS_REPO ?= ../aienos-argus
-ARGUS_COMMIT ?= $(shell head -n 1 argus.lock)
-ARGUS_SHORT = $(shell echo $(ARGUS_COMMIT) | cut -c1-7)
+# The lock is code-adjacent input: parse it as data and expose only validated
+# lowercase commit text to recipes.  The second field is derived in the same
+# parser so no lock content is ever interpolated into another shell command.
+override ARGUS_LOCK_FIELDS := $(shell LC_ALL=C awk 'NR == 1 && length($$0) == 40 && $$0 ~ /^[0-9a-f]+$$/ { commit = $$0; next } { invalid = 1 } END { if (!invalid && NR == 1) printf "%s %s\n", commit, substr(commit, 1, 7); else exit 1 }' argus.lock 2>/dev/null)
+ifneq ($(words $(ARGUS_LOCK_FIELDS)),2)
+$(error argus.lock must contain exactly one lowercase 40-hex commit)
+endif
+override ARGUS_COMMIT := $(word 1,$(ARGUS_LOCK_FIELDS))
+override ARGUS_SHORT := $(word 2,$(ARGUS_LOCK_FIELDS))
 ARGUS_SRC = $(OUT_DIR)/argus-src/$(ARGUS_SHORT)/native/argus
 ARGUS_STAMP = $(OUT_DIR)/argus-src/$(ARGUS_SHORT)/.extracted
 ARGUS_LIB_SRCS = $(addprefix $(ARGUS_SRC)/,argus_event.c argus_ring.c argus_core.c argus_detect.c)
@@ -1443,11 +1450,17 @@ ARGUS_CFLAGS = $(CFLAGS) -DRX_ARGUS=$(RX_ARGUS) -I$(ARGUS_SRC)
 ARGUS_STREAMS ?= $(HOME)/workspace/argus-runtime-streams
 ARGUS_RUN_ID = $(shell git rev-parse --short HEAD 2>/dev/null)-argus$(ARGUS_SHORT)
 
+.PHONY: check-argus-lock test-argus-lock
+check-argus-lock:
+	@:
+
+test-argus-lock:
+	bash tests/argus_lock_validation.sh
+
 $(ARGUS_STAMP):
-	@test -n "$(ARGUS_COMMIT)" || { echo "argus.lock is empty"; exit 1; }
-	mkdir -p $(OUT_DIR)/argus-src/$(ARGUS_SHORT)
-	git -C $(ARGUS_REPO) archive $(ARGUS_COMMIT) native/argus | tar -x -C $(OUT_DIR)/argus-src/$(ARGUS_SHORT)
-	touch $@
+	mkdir -p "$(OUT_DIR)/argus-src/$(ARGUS_SHORT)"
+	git -C "$(ARGUS_REPO)" archive "$(ARGUS_COMMIT)" -- native/argus | tar -x -C "$(OUT_DIR)/argus-src/$(ARGUS_SHORT)"
+	touch "$@"
 
 $(ARGUS_LIB_SRCS): $(ARGUS_STAMP)
 
diff --git a/argus.lock b/argus.lock
index a9b8350ac..99e018202 100644
--- a/argus.lock
+++ b/argus.lock
@@ -1,5 +1 @@
 b375dcaa2887d53cda407d773c2e4e489a0b1365
-# aien-dev/aienux native/argus (ARGUS-0, ABI v1.1), branch feat/argus-0 (integrator round 3 head).
-# argus_abi.h is byte-identical at 398cfb9, 03b9f06, be2814d and b375dca (sha256 5ff168ea...).
-# On origin (origin/feat/argus-0, origin/feat/argus-1-spec contain it). The branch head a64bc55
-# differs from b375dca in native/argus only by docs (ARGUS0_GATES.md, HOSTILE_REVIEW.md).
diff --git a/tests/aienos_lock_source/run.sh b/tests/aienos_lock_source/run.sh
index 683ac482d..e4e1033cd 100644
--- a/tests/aienos_lock_source/run.sh
+++ b/tests/aienos_lock_source/run.sh
@@ -116,7 +116,7 @@ check "dirty checkout of the locked commit: exit 1" '[ "$(rc env AIENOS_LOCK_REP
 unset OUT_DIR
 W=$SCR/omega; mkdir -p "$W"
 cp -r "$HERE/Makefile" "$HERE/mk" "$HERE/tools" "$W/"
-cp "$HERE/physics.lock" "$W/" 2>/dev/null || true
+cp "$HERE/physics.lock" "$HERE/argus.lock" "$W/" 2>/dev/null || true
 echo "$GOOD" > "$W/aienos.lock"
 M() { make -s -C "$W" AIENOS_LOCK_REPO="$LK" "$@" >"$SCR/make.log" 2>&1; echo $?; }
 check "make: default cache materialized and library built" '[ "$(M build/aienos-cap/$GOOD/libaienos_capability.a)" = 0 ] && [ -f "$W/build/aienos-cap/$GOOD/libaienos_capability.a" ] && [ ! -e "$W/build/aienos-authority/$GOOD/native/capability/out" ]'
diff --git a/tests/argus_lock_validation.sh b/tests/argus_lock_validation.sh
new file mode 100644
index 000000000..2526b9764
--- /dev/null
+++ b/tests/argus_lock_validation.sh
@@ -0,0 +1,61 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: Apache-2.0
+# Copyright 2026 Drake Stapleton (AIEN / aien-dev)
+
+set -u
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+TMP=$(mktemp -d "${TMPDIR:-/tmp}/omega-argus-lock.XXXXXX") || exit 2
+trap 'rm -rf "$TMP"' EXIT INT TERM
+GOOD=$(tr -d '\n' < "$ROOT/argus.lock")
+FAILS=0
+
+accept() {
+    local name=$1 content=$2
+    printf '%s' "$content" > "$TMP/argus.lock"
+    if make -s -C "$TMP" -f "$ROOT/Makefile" check-argus-lock >"$TMP/make.log" 2>&1; then
+        printf 'ok   %s\n' "$name"
+    else
+        printf 'FAIL %s\n' "$name"
+        FAILS=$((FAILS + 1))
+    fi
+}
+
+reject() {
+    local name=$1 content=$2
+    printf '%s' "$content" > "$TMP/argus.lock"
+    if make -s -C "$TMP" -f "$ROOT/Makefile" check-argus-lock >"$TMP/make.log" 2>&1; then
+        printf 'FAIL %s\n' "$name"
+        FAILS=$((FAILS + 1))
+    elif grep -q 'argus.lock must contain exactly one lowercase 40-hex commit' "$TMP/make.log"; then
+        printf 'ok   %s\n' "$name"
+    else
+        printf 'FAIL %s (wrong refusal)\n' "$name"
+        FAILS=$((FAILS + 1))
+    fi
+}
+
+accept "one lowercase commit" "$GOOD"$'\n'
+accept "commit without final newline" "$GOOD"
+reject "empty lock" ""
+reject "abbreviated commit" "${GOOD:0:39}"$'\n'
+reject "uppercase commit" "${GOOD^^}"$'\n'
+reject "leading whitespace" " $GOOD"$'\n'
+reject "trailing whitespace" "$GOOD "$'\n'
+reject "extra field" "$GOOD extra"$'\n'
+reject "option-like value" "--$GOOD"$'\n'
+reject "second commit" "$GOOD"$'\n'"$GOOD"$'\n'
+reject "trailing blank line" "$GOOD"$'\n\n'
+reject "trailing comment" "$GOOD"$'\n# comment\n'
+
+PWNED="$TMP/shell-metacharacters-ran"
+reject "shell metacharacters" "$GOOD ; touch $PWNED"$'\n'
+if [ -e "$PWNED" ]; then
+    echo "FAIL shell metacharacters executed"
+    FAILS=$((FAILS + 1))
+fi
+
+if [ "$FAILS" -ne 0 ]; then
+    echo "argus lock validation: $FAILS FAILED"
+    exit 1
+fi
+echo "argus lock validation: PASS"