Skip to content

Reverse Engineering / Authorized Penetration Testing / Security Research Skill Router Pack AI-powered routing + On-demand toolchain bootstrapping + Self-evolving knowledge base Supports Claude Code, Kiro, Cursor, Cline, and other AI coding clients 逆向/渗透/安全技能路由包 - AI 自动路由 + 按需自举工具链 + 自动进化经验库 | 支持 Claude Code / Kiro / Cursor / Cline 等代码 AI 客户端

Shell

fix(scripts): portable sed for macOS bash workflow tests

Yu-0312e93135211dfc
diff --git a/.github/workflows/macos-bash-compat.yml b/.github/workflows/macos-bash-compat.yml
index b9a160a..09c6287 100644
--- a/.github/workflows/macos-bash-compat.yml
+++ b/.github/workflows/macos-bash-compat.yml
@@ -41,6 +41,10 @@ jobs:
shell: bash
run: /bin/bash skills/scripts/test-client-neutral-bootstrap.sh
+ - name: Run bash workflow regression (portable sed; case-guard reject paths)
+ shell: bash
+ run: /bin/bash skills/scripts/test-bash-workflow.sh
+
- name: Exercise structured router and case contract
shell: bash
run: |
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8aa18a3..33e13f2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@ Versioning follows [Semantic Versioning](https://semver.org/).
- **Optional Codex adapter plugin** — added `plugins/reverse-skill/` without changing the client-neutral core or auto-registering MCP servers.
### Fixed
+- **macOS BSD sed in bash workflow tests** — `test-bash-workflow.sh` used GNU-only `sed -i 's/…/…/'`. BSD `sed` (macOS) treats the expression as a backup suffix and aborts with `invalid command code`, so Test 4/5 (case-guard reject paths) never ran on macOS. Replaced with a portable `mktemp` + `sed` + `mv` helper and wired `test-bash-workflow.sh` into `macos-bash-compat.yml` so the reject-path contract is covered on macOS CI (closes #135).
- **IDA MCP HTTP stall** — `run-supervisor.py` patches stock `idalib_supervisor` onto `ThreadingHTTPServer` and accepts Streamable HTTP GET `/mcp` (patch failure is skipped, supervisor still starts). Keep-alive deadlock is **time since last healthy `tools/list`**, not process `CreationDate`; `open.ps1` holds `opening.lock` so in-flight opens are never `-Force`d. New `recover.ps1` is an immediate `-Force` path. Never `taskkill`s `ida.exe`.
- **Broken internal doc links + guard** — removed a dangling `phishing-case-study.md` reference and redirected the missing payloader `反弹shell.md` index entry to its tracked raw data. Added `skills/scripts/verify-doc-links.py`, wired into CI, so internal Markdown links are checked from Git index blobs even when Defender quarantines a working-tree payload file.
- **Windows PowerShell 5.1 encoding** — added a UTF-8 BOM to five non-ASCII `.ps1` scripts (`skills/scripts/verify-doc-facts.ps1`, `apk-reverse/scripts/frida-run.ps1`, `apk-reverse/scripts/rebuild-sign-install.ps1`, `ida-reverse/scripts/start.ps1`, `radare2/scripts/recon.ps1`). Without a BOM, PS 5.1 parses these files as the system ANSI codepage and garbles their Chinese / em-dash string literals; `verify-doc-facts.ps1` was failing four checks under 5.1 (CI only ran it under `pwsh`, which defaults to UTF-8). CI now guards every non-ASCII `.ps1` for a BOM.
diff --git a/skills/scripts/test-bash-workflow.sh b/skills/scripts/test-bash-workflow.sh
index 049e191..36473a8 100755
--- a/skills/scripts/test-bash-workflow.sh
+++ b/skills/scripts/test-bash-workflow.sh
@@ -8,6 +8,17 @@ trap 'rm -rf "$SCRATCH"' EXIT
echo "=== Testing Bash Workflow ==="
+# Portable in-place rewrite: works with GNU sed and BSD sed (macOS).
+# Avoids platform-specific `sed -i` / `sed -i ''` branching.
+replace_in_file() {
+ local expr="$1"
+ local file="$2"
+ local tmp
+ tmp="$(mktemp "${file}.XXXXXX")"
+ sed "$expr" "$file" > "$tmp"
+ mv "$tmp" "$file"
+}
+
# Test 1: case-init.sh creates proper structure
echo "[Test 1] case-init.sh basic execution"
bash "$SCRIPT_DIR/case-init.sh" \
@@ -49,7 +60,7 @@ fi
# Test 4: case-guard.sh rejects invalid network mode
echo "[Test 4] case-guard.sh rejects invalid network mode"
-sed -i 's/mode: authorized_target_only/mode: invalid_mode/g' "$SCRATCH/work/test-bash-01/scope.md"
+replace_in_file 's/mode: authorized_target_only/mode: invalid_mode/g' "$SCRATCH/work/test-bash-01/scope.md"
if bash "$SCRIPT_DIR/case-guard.sh" --case-root "$SCRATCH/work/test-bash-01" > /dev/null 2>&1; then
echo "FAIL: case-guard accepted invalid network mode"
exit 1
@@ -57,11 +68,12 @@ fi
# Test 5: case-guard.sh rejects ungranted auth
echo "[Test 5] case-guard.sh rejects ungranted auth"
-sed -i 's/mode: invalid_mode/mode: authorized_target_only/g' "$SCRATCH/work/test-bash-01/scope.md"
-sed -i 's/status: granted/status: pending/g' "$SCRATCH/work/test-bash-01/scope.md"
+replace_in_file 's/mode: invalid_mode/mode: authorized_target_only/g' "$SCRATCH/work/test-bash-01/scope.md"
+replace_in_file 's/status: granted/status: pending/g' "$SCRATCH/work/test-bash-01/scope.md"
if bash "$SCRIPT_DIR/case-guard.sh" --case-root "$SCRATCH/work/test-bash-01" > /dev/null 2>&1; then
echo "FAIL: case-guard accepted pending auth"
exit 1
fi
+echo "TOTAL=5 PASS=5 FAIL=0"
echo "=== All Bash Workflow Tests Passed ==="