mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-08 08:53:43 +08:00
Completes the move started on Windows. `update` prints the install script's
command and exits 0 on every platform; the download/extract/chmod/exec sequence
is compiled out of release builds entirely, and the MCP background thread that
ran cbm_popen("curl ... api.github.com ...") on first tool call is gone.
The installers now place themselves beside the binary, which closes the last
gap: `update` referenced a raw.githubusercontent URL purely because an
install.sh-installed user had no local copy to point at. Two details make that
safe.
The source is the install script from the archive we JUST checksum-verified,
never "$0" -- which does not exist under `curl | bash`, and would pin the user
to the OLD installer forever. Since the script ships inside the verified
archive, it inherits that verification instead of needing its own.
And it is published by atomic rename, never written over the live path. Bash
reads a script incrementally by byte offset, so overwriting the file it is
executing continues reading NEW bytes at the OLD offset: silent, bizarre
corruption. cp to a temp name then mv -f swaps the directory entry while the
running shell keeps its original inode. Windows follows the same rule via
Copy-Item + Move-Item even though PowerShell parses up front.
Deliberately NOT done: spawning the new installer to delete and replace its
predecessor. Fetch remote code -> drop to disk -> spawn -> self-delete is a
textbook stager, and self-deletion is among the most heavily weighted
heuristics there is. It also gains nothing -- `"$DLBIN" install` already runs
the NEW release's install logic, because the binary owns the install.
Net: zero install or download URLs remain in the shipped binary, and the
allow-list entry is retired with it. Both scripts scan CLEAN (0/61) with the
self-placement code in them.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
73 lines
5.3 KiB
Plaintext
73 lines
5.3 KiB
Plaintext
# Security allow-list for dangerous function calls.
|
|
# Format: file:function:justification
|
|
# Lines starting with # are comments. Empty lines are ignored.
|
|
# Any call to a listed function in a .c file under src/ that is NOT on this
|
|
# list causes the security audit (scripts/security-audit.sh) to fail.
|
|
|
|
# ── Foundation: platform abstraction (defines cbm_popen wrapper + shell-free exec) ──
|
|
src/foundation/compat_fs.c:popen:cbm_popen wrapper definition (POSIX)
|
|
src/foundation/compat_fs.c:cbm_popen:cbm_popen function definition
|
|
src/foundation/compat_fs.c:fork:cbm_exec_no_shell — fork+execvp for shell-free subprocess execution
|
|
src/foundation/subprocess.c:fork:cbm_run_posix — fork+execv for the crash/hang-isolating index worker (supervisor primitive; child execs immediately, no code runs in the forked image)
|
|
src/foundation/compat_fs.c:execvp:cbm_exec_no_shell — direct exec without shell interpretation
|
|
|
|
# ── Coordination daemon: detached bootstrap and test-only watchdog probe ────
|
|
src/daemon/bootstrap.c:fork:validated shell-free double-fork; grandchild resets signals/umask, closes inherited descriptors, and execv's the exact current CBM image
|
|
src/main.c:fork:test-only parent-death containment descendant; inert unless the private CBM_TEST_WORKER_DESCENDANT_PID_FILE probe is explicitly set
|
|
|
|
# ── Coordination daemon: count-bounded local IPC (never Internet sockets) ──
|
|
# Format: NETWORK:file:function:expected-count:justification
|
|
NETWORK:src/daemon/ipc.c:socket:1:single owner-only AF_UNIX stream constructor
|
|
NETWORK:src/daemon/ipc.c:connect:1:single sockaddr_un-typed connect wrapper used only with the stable owner-only daemon endpoint
|
|
|
|
# ── Coordination daemon: count-bounded private internal file writes ────────
|
|
# Format: WRITE:file:expected-count:justification
|
|
WRITE:src/main.c:1:supervised worker writes its MCP result only to the private unique response path created and retained by its parent
|
|
WRITE:src/daemon/application.c:1:recovery truncates only its private uniquely-created per-job marker file
|
|
|
|
# ── CLI: update command (user-initiated, interactive) ──────────────────────
|
|
src/cli/cli.c:cbm_popen:sha256 checksum verification (update cmd)
|
|
src/cli/cli.c:popen:sha256 checksum computation via shasum
|
|
|
|
# ── Watcher: git status polling (repo paths validated via cbm_validate_shell_arg) ──
|
|
src/watcher/watcher.c:system:git repo detection (is_git_repo)
|
|
src/watcher/watcher.c:cbm_popen:git HEAD hash (git_head)
|
|
src/watcher/watcher.c:cbm_popen:git working tree status (git_is_dirty)
|
|
src/watcher/watcher.c:cbm_popen:git file count (git_file_count)
|
|
src/watcher/watcher.c:popen:via cbm_popen wrapper calls
|
|
|
|
# ── Git context: git metadata resolution (repo paths validated via cbm_validate_shell_arg) ──
|
|
src/git/git_context.c:cbm_popen:git rev-parse/symbolic-ref/merge-base metadata lookup
|
|
src/git/git_context.c:popen:via cbm_popen wrapper call
|
|
|
|
# ── MCP server: search and change detection ────────────────────────────────
|
|
src/mcp/mcp.c:cbm_popen:search_code via grep (pattern in temp file, path validated)
|
|
src/mcp/mcp.c:cbm_popen:detect_changes via git diff (args validated)
|
|
src/mcp/mcp.c:cbm_popen:git ls-files count for auto-index (session_root validated)
|
|
src/mcp/mcp.c:cbm_popen:update check to api.github.com (hardcoded URL)
|
|
src/mcp/mcp.c:popen:via cbm_popen wrapper calls
|
|
|
|
# ── Pipeline: git history parsing (git log) ────────────────────────────────
|
|
src/pipeline/pass_githistory.c:cbm_popen:git log for file history (path validated)
|
|
src/pipeline/pass_githistory.c:popen:via cbm_popen wrapper call
|
|
|
|
# ── Pipeline: artifact persistence (git HEAD hash, merge driver config) ────
|
|
src/pipeline/artifact.c:cbm_popen:git rev-parse HEAD for artifact metadata (hardcoded cmd)
|
|
src/pipeline/artifact.c:cbm_popen:git config merge.ours.driver for gitattributes (hardcoded cmd)
|
|
src/pipeline/artifact.c:popen:via cbm_popen wrapper calls
|
|
|
|
# ── UI: HTTP server process management ─────────────────────────────────────
|
|
src/ui/http_server.c:popen:ps process listing for metrics endpoint
|
|
src/ui/http_server.c:fork:spawn indexing subprocess
|
|
src/ui/http_server.c:execl:exec indexing binary in child process
|
|
|
|
# ── Allowed URLs ───────────────────────────────────────────────────────────
|
|
# Format: URL:justification
|
|
URL:https://api.github.com/repos/DeusData/codebase-memory-mcp/releases/latest:update check
|
|
URL:https://github.com/DeusData/codebase-memory-mcp/releases/latest/download:binary download + checksums
|
|
URL:https://github.com/DeusData/codebase-memory-mcp/releases/latest:version check via redirect header
|
|
URL:http://127.0.0.1:UI server binding (localhost only)
|
|
URL:https://www.sqlite.org/c3ref/c_checkpoint_full.html:sqlite WAL checkpoint API doc reference (comment only, not a network call)
|
|
URL:https://github.com/DeusData/codebase-memory-mcp:project repository self-reference in update/star notice (src/mcp/mcp.c)
|
|
URL:https://%s:GitHub blob-URL construction in src/ui/http_server.c cbm_ui_git_web_base — https-forces the repo web base for frontend deep-links (not a network call)
|