Commit 47f1ac3
fix(cartridges): drop unchecked @ptrCast from all cartridge shims (CWE-704) (#89)
Closes the Hypatia `code_safety/zig_ptr_cast` alert
([#550](https://github.com/hyperpolymath/boj-server-cartridges/security/code-scanning/550))
raised on #85, which reported 8 unchecked pointer conversions (CWE-704)
in `bug-filing-mcp/ffi/cartridge_shim.zig`.
#85 merged before the alert was addressed, so the flagged code is now on
`main` and the alert is still open. This fixes it there.
## Why 115 files
`cartridge_shim.zig` is vendored byte-identical into 116 cartridges, so
the same latent flaw sat in every copy — the alert only named
`bug-filing-mcp` because that was the file #85 touched. Each other copy
would raise the identical alert as soon as a PR touched it. Fixing them
together also stops the vendored copies drifting apart.
## The fix
The 8 casts were **redundant, not unsafe** — no behaviour change:
- `std.mem.sliceTo(ptr, 0)` accepts a `[*c]const u8` directly and scans
to the NUL, so neither the `@ptrCast` nor the `[*:0]` re-typing was ever
needed.
- Typing the test locals as `[*c]const u8` removes the cast at the call
sites.
The non-null precondition documented on `toolIs` is unchanged and still
enforced by `invokeArgsNull`.
`local-coord-mcp` **already carried exactly this fix** (post-#146). This
adopts that as the canonical form rather than inventing a second one,
which collapses the shim from three divergent variants to two. `npc-mcp`
keeps its trimmed layout and takes the same transform.
## Verification
Run against the **CI toolchain (zig 0.15.2)**, not my local default:
- All **116/116** shims pass `zig test`.
- **115/116** cartridges `zig build` clean. `database-mcp` fails only on
a missing local `libsqlite3` — it fails identically on pristine `main`,
so it is environmental and unrelated to this change.
- No `@ptrCast` remains in any shim.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent d1454f7 commit 47f1ac3
115 files changed
Lines changed: 1837 additions & 1149 deletions
File tree
- cartridges
- cross-cutting
- agentic
- agent-mcp/ffi
- claude-agents-power-mcp/ffi
- claude-ai-mcp/ffi
- model-router-mcp/ffi
- build/bsp-mcp/ffi
- debug/dap-mcp/ffi
- fleet/fleet-mcp/ffi
- health/boj-health-mcp/ffi
- nesy
- ml-mcp/ffi
- nesy-mcp/ffi
- domains
- automation/browser-mcp/ffi
- bioinformatics/origene-mcp/ffi
- ci-cd
- buildkite-mcp/ffi
- circleci-mcp/ffi
- github-actions-mcp/ffi
- hypatia-mcp/ffi
- laminar-mcp/ffi
- cloud
- aws-mcp/ffi
- cloud-mcp/ffi
- cloudflare-mcp/ffi
- digitalocean-mcp/ffi
- fly-mcp/ffi
- gcp-mcp/ffi
- hetzner-mcp/ffi
- linode-mcp/ffi
- railway-mcp/ffi
- render-mcp/ffi
- code-quality
- coderag-mcp/ffi
- sanctify-mcp/ffi
- communications
- burble-admin-mcp/ffi
- comms-mcp/ffi
- discord-mcp/ffi
- matrix-mcp/ffi
- notifyhub-mcp/ffi
- slack-mcp/ffi
- telegram-mcp/ffi
- community
- civic-connect-mcp/ffi
- feedback-mcp/ffi
- config
- conflow-mcp/ffi
- k9iser-mcp/ffi
- container
- container-mcp/ffi
- docker-hub-mcp/ffi
- k8s-mcp/ffi
- stapeln-mcp/ffi
- database
- arango-mcp/ffi
- clickhouse-mcp/ffi
- database-mcp/ffi
- duckdb-mcp/ffi
- mongodb-mcp/ffi
- neo4j-mcp/ffi
- neon-mcp/ffi
- postgresql-mcp/ffi
- redis-mcp/ffi
- supabase-mcp/ffi
- turso-mcp/ffi
- verisimdb-mcp/ffi
- development
- bug-filing-mcp/ffi
- codeseeker-mcp/ffi
- fireflag-mcp/ffi
- git-mcp/ffi
- github-api-mcp/ffi
- gitlab-api-mcp/ffi
- education/kategoria-mcp/ffi
- formal-verification
- ephapax-mcp/ffi
- proof-mcp/ffi
- gaming
- game-admin-mcp/ffi
- idaptik-admin-mcp/ffi
- npc-mcp/ffi
- ums-mcp/ffi
- infrastructure
- aerie-mcp/ffi
- hesiod-mcp/ffi
- iac-mcp/ffi
- knowledge
- local-memory-mcp/ffi
- obsidian-mcp/ffi
- languages
- affinescript-mcp/ffi
- lang-mcp/ffi
- lsp-mcp/ffi
- toolchain-mcp/ffi
- typed-wasm-mcp/ffi
- legal/pmpl-mcp/ffi
- messaging/queues-mcp/ffi
- observability
- grafana-mcp/ffi
- observe-mcp/ffi
- prometheus-mcp/ffi
- sentry-mcp/ffi
- open-data/opendata-mcp/ffi
- productivity
- airtable-mcp/ffi
- google-docs-mcp/ffi
- google-sheets-mcp/ffi
- notion-mcp/ffi
- todoist-mcp/ffi
- project-management
- jira-mcp/ffi
- linear-mcp/ffi
- registry
- crates-mcp/ffi
- hackage-mcp/ffi
- hex-mcp/ffi
- npm-registry-mcp/ffi
- opam-mcp/ffi
- opsm-mcp/ffi
- pypi-mcp/ffi
- repository-management/reposystem-mcp/ffi
- research
- academic-workflow-mcp/ffi
- bofig-mcp/ffi
- research-mcp/ffi
- zotero-mcp/ffi
- security
- dns-shield-mcp/ffi
- panic-attack-mcp/ffi
- rokur-mcp/ffi
- secrets-mcp/ffi
- vault-mcp/ffi
- vext-mcp/ffi
- vordr-mcp/ffi
- utilities/textkit-mcp/ffi
- web/ssg-mcp/ffi
- templates/gossamer-mcp/ffi
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 16 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | | - | |
| 68 | + | |
63 | 69 | | |
64 | 70 | | |
65 | 71 | | |
| |||
124 | 130 | | |
125 | 131 | | |
126 | 132 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
136 | 142 | | |
137 | | - | |
138 | | - | |
| 143 | + | |
| 144 | + | |
139 | 145 | | |
140 | | - | |
141 | | - | |
| 146 | + | |
| 147 | + | |
142 | 148 | | |
Lines changed: 16 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | | - | |
| 68 | + | |
63 | 69 | | |
64 | 70 | | |
65 | 71 | | |
| |||
124 | 130 | | |
125 | 131 | | |
126 | 132 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
136 | 142 | | |
137 | | - | |
138 | | - | |
| 143 | + | |
| 144 | + | |
139 | 145 | | |
140 | | - | |
141 | | - | |
| 146 | + | |
| 147 | + | |
142 | 148 | | |
Lines changed: 16 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | | - | |
| 68 | + | |
63 | 69 | | |
64 | 70 | | |
65 | 71 | | |
| |||
124 | 130 | | |
125 | 131 | | |
126 | 132 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
136 | 142 | | |
137 | | - | |
138 | | - | |
| 143 | + | |
| 144 | + | |
139 | 145 | | |
140 | | - | |
141 | | - | |
| 146 | + | |
| 147 | + | |
142 | 148 | | |
Lines changed: 16 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | | - | |
| 68 | + | |
63 | 69 | | |
64 | 70 | | |
65 | 71 | | |
| |||
124 | 130 | | |
125 | 131 | | |
126 | 132 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
136 | 142 | | |
137 | | - | |
138 | | - | |
| 143 | + | |
| 144 | + | |
139 | 145 | | |
140 | | - | |
141 | | - | |
| 146 | + | |
| 147 | + | |
142 | 148 | | |
Lines changed: 16 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | | - | |
| 68 | + | |
63 | 69 | | |
64 | 70 | | |
65 | 71 | | |
| |||
124 | 130 | | |
125 | 131 | | |
126 | 132 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
136 | 142 | | |
137 | | - | |
138 | | - | |
| 143 | + | |
| 144 | + | |
139 | 145 | | |
140 | | - | |
141 | | - | |
| 146 | + | |
| 147 | + | |
142 | 148 | | |
Lines changed: 16 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | | - | |
| 68 | + | |
63 | 69 | | |
64 | 70 | | |
65 | 71 | | |
| |||
124 | 130 | | |
125 | 131 | | |
126 | 132 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
136 | 142 | | |
137 | | - | |
138 | | - | |
| 143 | + | |
| 144 | + | |
139 | 145 | | |
140 | | - | |
141 | | - | |
| 146 | + | |
| 147 | + | |
142 | 148 | | |
Lines changed: 16 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | | - | |
| 68 | + | |
63 | 69 | | |
64 | 70 | | |
65 | 71 | | |
| |||
124 | 130 | | |
125 | 131 | | |
126 | 132 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
136 | 142 | | |
137 | | - | |
138 | | - | |
| 143 | + | |
| 144 | + | |
139 | 145 | | |
140 | | - | |
141 | | - | |
| 146 | + | |
| 147 | + | |
142 | 148 | | |
Lines changed: 16 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | | - | |
| 68 | + | |
63 | 69 | | |
64 | 70 | | |
65 | 71 | | |
| |||
124 | 130 | | |
125 | 131 | | |
126 | 132 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
136 | 142 | | |
137 | | - | |
138 | | - | |
| 143 | + | |
| 144 | + | |
139 | 145 | | |
140 | | - | |
141 | | - | |
| 146 | + | |
| 147 | + | |
142 | 148 | | |
0 commit comments