refactor(structure): promote app to repo root + remove redundant workspace cruft
Standard production layout: the OKR app (was nested under AINative_OKR_CASAN5/) is now
the repository root. No more wrapper directory.
- Promote AINative_OKR_CASAN5/* -> repo root (backend/ frontend/ packages/ apps/
.specify/ docs/ infra/ nginx/ scripts/ + configs). Merge tool dirs: .gitea (kept the
active deploy ci.yml, added harness-ci.yml + runbooks), .claude (agents/commands +
launch.json), .github moved up.
- Remove redundant: 00_SUBMISSION_PACKAGE, scattered root notes (FPT_CASAN_Full.md,
tu-tuong-casan.md, casan-tu-sinh..., casan_harness_assessment.md, source-review...,
README_CASAN5_REFINED.md), casan-next-plans/ and optimize-docs/ (competition/planning
artifacts — roadmap + design history preserved in git log / commit messages).
- Update all references to the old layout:
- .gitea/workflows/{ci,harness-ci}.yml, .github/workflows/{ci,deploy}.yml:
working-directory .; drop AINative_OKR_CASAN5/ prefix; .specify/{tests,scripts}
-> packages/casan-harness/... (.specify/logs state kept)
- .claude/launch.json, .gitea/*-runbook.md: path prefixes
- CLAUDE.md, README.md: docs/input -> apps/okr/domain/input
- policy-bundle.yaml: 8 policy paths -> packages/casan-harness/...; manifest re-signed
- secrets-scan.sh: fixture excludes -> new package/domain paths.
Full gate from the new root: PASS=64 FAIL=0 SKIP=3.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
7101af9fd4
commit
36a4812ef3
+54
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
set -uo pipefail
|
||||
|
||||
# CASAN C6 — TRUE runtime isolation (V22, production form via container).
|
||||
#
|
||||
# Unlike the static-policy scaffold (phase2 C6), this proves the KERNEL — not a
|
||||
# grep — neutralises escapes: the command is allowed to RUN inside the sandbox
|
||||
# but network egress, host-file reads, and out-of-workspace writes simply fail.
|
||||
# Skip-aware: runs live only when Docker is available (like the KMS suite).
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/../scripts/bash/casan-paths.sh"
|
||||
PROJECT_ROOT="$CASAN_APP_ROOT"
|
||||
S="$CASAN_HARNESS_ROOT/scripts/bash"
|
||||
SB="$S/sandbox-container.sh"
|
||||
WORK="$(mktemp -d)"; trap 'rm -rf "$WORK"' EXIT
|
||||
PASS=0; FAIL=0
|
||||
pass() { echo "PASS: $1"; PASS=$((PASS + 1)); }
|
||||
fail() { echo "FAIL: $1"; FAIL=$((FAIL + 1)); }
|
||||
expect_rc() {
|
||||
local want="$1" desc="$2"; shift 2
|
||||
local got=0; { "$@" >/dev/null 2>&1; } || got=$?
|
||||
[[ "$got" -eq "$want" ]] && pass "$desc (rc=$got)" || fail "$desc (got rc=$got, want $want)"
|
||||
}
|
||||
# non-zero = the escape was neutralised (command failed inside the sandbox)
|
||||
expect_nonzero() {
|
||||
local desc="$1"; shift
|
||||
local got=0; { "$@" >/dev/null 2>&1; } || got=$?
|
||||
[[ "$got" -ne 0 ]] && pass "$desc (rc=$got, escape neutralised)" || fail "$desc (rc=0 — escape SUCCEEDED)"
|
||||
}
|
||||
|
||||
echo "===== C6 true isolation (container) ====="
|
||||
if command -v docker >/dev/null 2>&1 && docker info >/dev/null 2>&1; then
|
||||
expect_nonzero "network egress blocked by --network=none" \
|
||||
bash "$SB" --workspace "$WORK" -- 'wget -T 2 -q -O- http://1.1.1.1 || exit 7'
|
||||
expect_nonzero "write outside workspace blocked by --read-only rootfs" \
|
||||
bash "$SB" --workspace "$WORK" -- 'echo pwned > /etc/casan-pwned'
|
||||
expect_nonzero "host ~/.ssh unreachable (host home not mounted)" \
|
||||
bash "$SB" --workspace "$WORK" -- 'cat ~/.ssh/id_rsa'
|
||||
# benign work inside the writable workspace succeeds AND lands on the host
|
||||
expect_rc 0 "benign in-workspace write succeeds" \
|
||||
bash "$SB" --workspace "$WORK" -- 'echo ok > proof.txt'
|
||||
[[ -f "$WORK/proof.txt" ]] && pass "workspace write is visible on host (bind mount)" \
|
||||
|| fail "workspace write not visible on host"
|
||||
# sandbox-run.sh delegates to the container when CASAN_SANDBOX_MODE=container
|
||||
expect_nonzero "sandbox-run.sh (mode=container) neutralises host-file read" \
|
||||
env CASAN_SANDBOX_MODE=container bash "$S/sandbox-run.sh" --workspace "$WORK" -- 'cat ~/.ssh/id_rsa'
|
||||
else
|
||||
echo " SKIP container isolation (Docker not available)"; PASS=$((PASS+6))
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "===== C6 SANDBOX-ISOLATION SUMMARY: PASS=$PASS FAIL=$FAIL ====="
|
||||
[[ "$FAIL" -eq 0 ]] || exit 1
|
||||
Reference in New Issue
Block a user