Skip to content

Commit 421b39f

Browse files
authored
Merge branch 'main' into fix/875-alias-import-resolution
2 parents 89e1c47 + 20b1153 commit 421b39f

60 files changed

Lines changed: 4467 additions & 276 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/_build.yml‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@ on:
88
description: 'Version string (e.g. v0.8.0)'
99
type: string
1010
default: ''
11+
attest:
12+
description: 'Generate build provenance attestations for release artifacts'
13+
type: boolean
14+
default: false
1115

1216
permissions:
1317
contents: read
18+
id-token: write
19+
attestations: write
1420

1521
jobs:
1622
build-unix:
@@ -83,6 +89,12 @@ jobs:
8389
tar -czf "codebase-memory-mcp-${GOOS}-${GOARCH}.tar.gz" \
8490
-C build/c codebase-memory-mcp LICENSE install.sh THIRD_PARTY_NOTICES.md
8591
92+
- name: Attest standard binary provenance
93+
if: ${{ inputs.attest }}
94+
uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
95+
with:
96+
subject-path: codebase-memory-mcp-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz
97+
8698
- name: Build UI binary
8799
env:
88100
VERSION: ${{ inputs.version }}
@@ -113,6 +125,12 @@ jobs:
113125
tar -czf "codebase-memory-mcp-ui-${GOOS}-${GOARCH}.tar.gz" \
114126
-C build/c codebase-memory-mcp LICENSE install.sh THIRD_PARTY_NOTICES.md
115127
128+
- name: Attest UI binary provenance
129+
if: ${{ inputs.attest }}
130+
uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
131+
with:
132+
subject-path: codebase-memory-mcp-ui-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz
133+
116134
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
117135
with:
118136
name: binaries-${{ matrix.goos }}-${{ matrix.goarch }}
@@ -158,6 +176,12 @@ jobs:
158176
scripts/gen-third-party-notices.sh THIRD_PARTY_NOTICES.md
159177
zip codebase-memory-mcp-windows-amd64.zip codebase-memory-mcp.exe LICENSE install.ps1 THIRD_PARTY_NOTICES.md
160178
179+
- name: Attest standard binary provenance
180+
if: ${{ inputs.attest }}
181+
uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
182+
with:
183+
subject-path: codebase-memory-mcp-windows-amd64.zip
184+
161185
- name: Build UI binary
162186
shell: msys2 {0}
163187
env:
@@ -178,6 +202,12 @@ jobs:
178202
scripts/gen-third-party-notices.sh THIRD_PARTY_NOTICES.md
179203
zip codebase-memory-mcp-ui-windows-amd64.zip codebase-memory-mcp.exe LICENSE install.ps1 THIRD_PARTY_NOTICES.md
180204
205+
- name: Attest UI binary provenance
206+
if: ${{ inputs.attest }}
207+
uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
208+
with:
209+
subject-path: codebase-memory-mcp-ui-windows-amd64.zip
210+
181211
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
182212
with:
183213
name: binaries-windows-amd64
@@ -227,6 +257,12 @@ jobs:
227257
scripts/gen-third-party-notices.sh THIRD_PARTY_NOTICES.md
228258
zip codebase-memory-mcp-windows-arm64.zip codebase-memory-mcp.exe LICENSE install.ps1 THIRD_PARTY_NOTICES.md
229259
260+
- name: Attest standard binary provenance
261+
if: ${{ inputs.attest }}
262+
uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
263+
with:
264+
subject-path: codebase-memory-mcp-windows-arm64.zip
265+
230266
- name: Build UI binary
231267
shell: msys2 {0}
232268
env:
@@ -247,6 +283,12 @@ jobs:
247283
scripts/gen-third-party-notices.sh THIRD_PARTY_NOTICES.md
248284
zip codebase-memory-mcp-ui-windows-arm64.zip codebase-memory-mcp.exe LICENSE install.ps1 THIRD_PARTY_NOTICES.md
249285
286+
- name: Attest UI binary provenance
287+
if: ${{ inputs.attest }}
288+
uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
289+
with:
290+
subject-path: codebase-memory-mcp-ui-windows-arm64.zip
291+
250292
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
251293
with:
252294
name: binaries-windows-arm64
@@ -299,6 +341,12 @@ jobs:
299341
tar -czf "codebase-memory-mcp-linux-${ARCH}-portable.tar.gz" \
300342
-C build/c codebase-memory-mcp LICENSE install.sh THIRD_PARTY_NOTICES.md
301343
344+
- name: Attest standard binary provenance
345+
if: ${{ inputs.attest }}
346+
uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
347+
with:
348+
subject-path: codebase-memory-mcp-linux-${{ matrix.arch }}-portable.tar.gz
349+
302350
- name: Build UI binary (static)
303351
env:
304352
VERSION: ${{ inputs.version }}
@@ -318,6 +366,12 @@ jobs:
318366
tar -czf "codebase-memory-mcp-ui-linux-${ARCH}-portable.tar.gz" \
319367
-C build/c codebase-memory-mcp LICENSE install.sh THIRD_PARTY_NOTICES.md
320368
369+
- name: Attest UI binary provenance
370+
if: ${{ inputs.attest }}
371+
uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
372+
with:
373+
subject-path: codebase-memory-mcp-ui-linux-${{ matrix.arch }}-portable.tar.gz
374+
321375
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
322376
with:
323377
name: binaries-linux-${{ matrix.arch }}-portable

‎.github/workflows/dry-run.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,13 @@ jobs:
5656
build:
5757
if: ${{ inputs.skip_builds != true && !cancelled() && (needs.test.result == 'success' || needs.test.result == 'skipped') }}
5858
needs: [test]
59+
permissions:
60+
contents: read
61+
id-token: write
62+
attestations: write
5963
uses: ./.github/workflows/_build.yml
64+
with:
65+
attest: false
6066

6167
# ── Smoke test every binary ────────────────────────────────────
6268
# Run unless builds were skipped or a build leg FAILED. Every build leg

‎.github/workflows/release.yml‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,14 @@ jobs:
5656
# ── 3. Build all platforms ──────────────────────────────────────
5757
build:
5858
needs: [test]
59+
permissions:
60+
contents: read
61+
id-token: write
62+
attestations: write
5963
uses: ./.github/workflows/_build.yml
6064
with:
6165
version: ${{ inputs.version }}
66+
attest: true
6267

6368
# ── 4. Smoke test every binary ──────────────────────────────────
6469
smoke:
@@ -99,10 +104,10 @@ jobs:
99104
- name: Generate checksums
100105
run: sha256sum *.tar.gz *.zip > checksums.txt
101106

102-
- name: Attest build provenance
107+
- name: Attest checksum provenance
103108
uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
104109
with:
105-
subject-path: '*.tar.gz,*.zip,checksums.txt'
110+
subject-path: checksums.txt
106111

107112
- name: Generate SBOM
108113
run: |

‎Makefile.cbm‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ FOUNDATION_SRCS = \
112112
src/foundation/profile.c \
113113
src/foundation/dump_verify.c \
114114
src/foundation/limits.c \
115-
src/foundation/subprocess.c
115+
src/foundation/subprocess.c \
116+
src/foundation/sha256.c
116117

117118
# Existing extraction C code (compiled from current location)
118119
EXTRACTION_SRCS = \
@@ -316,6 +317,7 @@ TEST_EXTRACTION_SRCS = \
316317
tests/test_extraction.c \
317318
tests/test_extraction_inheritance.c \
318319
tests/test_extraction_imports.c \
320+
tests/test_parse_coverage.c \
319321
tests/test_grammar_regression.c \
320322
tests/test_grammar_labels.c \
321323
tests/test_grammar_imports.c \

‎README.md‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,14 @@ The `install` command auto-detects all installed coding agents and configures MC
104104

105105
### Graph Visualization UI
106106

107-
If you downloaded the `ui` variant:
107+
The UI ships as a separate `ui` build (it embeds the frontend). The default install on every channel is the lean, headless server; opt into the UI build with:
108+
109+
- **install.sh:** add `--ui` (see [Quick Start](#quick-start))
110+
- **npm:** `CBM_VARIANT=ui npm install -g codebase-memory-mcp`
111+
- **PyPI:** `CBM_VARIANT=ui pip install codebase-memory-mcp`
112+
- **Manual:** download the `codebase-memory-mcp-ui-<os>-<arch>` archive
113+
114+
Then run it:
108115

109116
```bash
110117
codebase-memory-mcp --ui=true --port=9749
@@ -476,6 +483,7 @@ codebase-memory-mcp config reset auto_index # reset to default
476483

477484
| Variable | Default | Description |
478485
|----------|---------|-------------|
486+
| `CBM_ALLOWED_ROOT` | *(unset)* | Restrict `index_repository` to paths within this directory. When set, a `repo_path` that resolves (after symlink / `..` resolution) outside this root is refused; unset imposes no restriction. Useful when the server may be driven by an untrusted caller, e.g. agentic or multi-tenant deployments. |
479487
| `CBM_CACHE_DIR` | `~/.cache/codebase-memory-mcp` | Override the database storage directory. All project indexes and config are stored here. |
480488
| `CBM_DIAGNOSTICS` | `false` | Set to `1` or `true` to enable periodic diagnostics output to `/tmp/cbm-diagnostics-<pid>.json`. |
481489
| `CBM_DOWNLOAD_URL` | *(GitHub releases)* | Override the download URL for updates. Used for testing or self-hosted deployments. |
@@ -591,7 +599,7 @@ internal/cbm/ Vendored tree-sitter grammars (158 languages) + AST extrac
591599
Every release binary is verified through a multi-layer pipeline before publication:
592600

593601
- **VirusTotal** — all binaries scanned by 70+ antivirus engines (zero detections required to publish)
594-
- **SLSA Level 3** — cryptographic build provenance generated by GitHub Actions; verify with `gh attestation verify <file> --repo DeusData/codebase-memory-mcp`
602+
- **SLSA Level 3** — cryptographic build provenance generated by the trusted GitHub Actions build workflow; verify with `gh attestation verify <file> --repo DeusData/codebase-memory-mcp --signer-workflow DeusData/codebase-memory-mcp/.github/workflows/_build.yml`
595603
- **Sigstore cosign** — keyless signatures on all artifacts; bundles included in every release
596604
- **SHA-256 checksums** — `checksums.txt` published with every release; verified by both install scripts before extraction
597605
- **CodeQL SAST** — blocks release pipeline if any open alerts remain

‎SECURITY.md‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
codebase-memory-mcp interacts deeply with your filesystem. It reads source files across your entire codebase, writes to agent configuration files, and spawns background processes. This is inherent to what it does — not a bug.
66

7-
**If you are uncomfortable with these access patterns**, please audit the source code before running. The full source is available in this repository. Every release binary is reproducibly built from this source and can be independently verified via SLSA provenance, Sigstore signatures, and SHA-256 checksums (see [Verification](#verification) below).
7+
**If you are uncomfortable with these access patterns**, please audit the source code before running. The full source is available in this repository. Release binaries produced by the current release pipeline are verifiably built from this source and can be independently verified via SLSA Build Level 3 provenance, Sigstore signatures, and SHA-256 checksums (see [Verification](#verification) below).
88

99
We are humans and can make mistakes. We take security seriously — it is Priority #1 for this project — but we cannot guarantee perfection. By using this software you accept responsibility for evaluating whether it meets your own security requirements.
1010

@@ -122,13 +122,21 @@ This project implements multiple layers of security verification. Every release
122122

123123
Releases are created as **drafts** (invisible to users) and only published after all verification passes:
124124

125-
1. **SLSA build provenance** — cryptographic attestation proving each binary was built by GitHub Actions from this repository
125+
1. **SLSA Build Level 3 provenance for release binaries** — cryptographic attestation generated inside the trusted GitHub Actions build workflow immediately after each release archive is produced
126126
2. **Sigstore cosign signing** — keyless digital signatures verifiable by anyone
127-
3. **SBOM** — Software Bill of Materials (CycloneDX) listing all vendored dependencies
127+
3. **SBOM** — Software Bill of Materials (SPDX) listing all vendored dependencies
128128
4. **SHA-256 checksums** — published with every release
129129
5. **VirusTotal scanning** — all binaries scanned by 70+ antivirus engines (zero-tolerance: any detection blocks the release)
130130
6. **OpenSSF Scorecard** — repository security health score
131131

132+
Scope of the SLSA claim: this is a build provenance claim for release
133+
artifacts. It proves the attested archive was produced by the repository's
134+
trusted GitHub-hosted build workflow from repository source. It is not
135+
third-party certification, it is not retroactive to older releases, and it does
136+
not mean the source code is vulnerability-free or that maintainers cannot change
137+
source. Consumers should verify the signer workflow, not only repository
138+
ownership.
139+
132140
If ANY antivirus engine flags ANY binary, the release stays as a draft and is not published until the issue is investigated and resolved.
133141

134142
### Code-Level Defenses
@@ -145,8 +153,10 @@ If ANY antivirus engine flags ANY binary, the release stays as a draft and is no
145153
Users can independently verify any release binary:
146154

147155
```bash
148-
# SLSA provenance (proves binary came from this repo's CI)
149-
gh attestation verify <downloaded-file> --repo DeusData/codebase-memory-mcp
156+
# SLSA Build Level 3 provenance for release binaries
157+
gh attestation verify <downloaded-file> \
158+
--repo DeusData/codebase-memory-mcp \
159+
--signer-workflow DeusData/codebase-memory-mcp/.github/workflows/_build.yml
150160

151161
# Sigstore cosign (keyless signature)
152162
cosign verify-blob --bundle <file>.bundle <file>

‎docs/CONFIGURATION.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ These environment variables affect runtime behavior:
110110

111111
| Variable | Default | Description |
112112
|---|---|---|
113+
| `CBM_ALLOWED_ROOT` | *(unset)* | Restrict `index_repository` to paths within this directory. When set, a `repo_path` that resolves (after symlink / `..` resolution) outside this root is refused; unset imposes no restriction. Useful when the server may be driven by an untrusted caller (agentic or multi-tenant deployments). |
113114
| `CBM_CACHE_DIR` | `~/.cache/codebase-memory-mcp` | Override the cache directory used for indexes, `_config.db`, and UI `config.json`. |
114115
| `CBM_DIAGNOSTICS` | `false` | Enable periodic diagnostics output to `/tmp/cbm-diagnostics-<pid>.json`. |
115116
| `CBM_DOWNLOAD_URL` | GitHub releases | Override the update download URL. |

0 commit comments

Comments
 (0)