Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T04:05:52.170Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

bind_source_toctou_test.sh

30 lines · 997 B · shellscript
1#!/usr/bin/env bash
2set -u
3command -v bwrap >/dev/null || { echo "bwrap not found" >&2; exit 2; }
4
5ROOT="$(mktemp -d)"; trap 'rm -rf "$ROOT"' EXIT
6READ_WRITE_DIR="$ROOT/foo/bar"
7ATTACK_TARGET="$ROOT/baz"
8mkdir -p "$READ_WRITE_DIR" "$ATTACK_TARGET"
9
10# /foo (parent of the grant) is read-only; only /foo/bar is writable, so staging
11# then renaming a symlink over /foo/bar fails.
12# 
13# Writable access to `/foo/bar` should not result in the ability to make
14# `/foo/bar` into a symlink.
15bwrap \
16  --ro-bind / / \
17  --bind "$READ_WRITE_DIR" "$READ_WRITE_DIR" \
18  --unshare-user \
19  --setenv READ_WRITE_DIR "$READ_WRITE_DIR" \
20  --setenv ATTACK_TARGET "$ATTACK_TARGET" \
21  /bin/sh -c '
22    ln -s "$ATTACK_TARGET" "$READ_WRITE_DIR.link" && mv -fT "$READ_WRITE_DIR.link" "$READ_WRITE_DIR" && exit 7
23    exit 0
24  '
25rc=$?
26
27if [ "$rc" -eq 7 ] || [ -L "$READ_WRITE_DIR" ]; then echo "FAIL: grant redirected"; exit 1; fi
28[ "$rc" -eq 0 ] || { echo "bwrap error (rc=$rc)" >&2; exit 2; }
29echo "PASS: swap blocked"
30
Served at tenant.openagents/omega Member data and write actions are omitted.