Skip to content

v0.42.37.0 fix(security,ingest): source-isolation grant enforcement + non-string frontmatter guard + papercuts#1999

Merged
garrytan merged 5 commits into
masterfrom
garrytan/triage-gbrain-issues
Jun 9, 2026
Merged

v0.42.37.0 fix(security,ingest): source-isolation grant enforcement + non-string frontmatter guard + papercuts#1999
garrytan merged 5 commits into
masterfrom
garrytan/triage-gbrain-issues

Conversation

@garrytan

@garrytan garrytan commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary

A backlog-triage wave: the highest-impact open issues, fixed and shipped together. Eng-reviewed (plan-eng-review CLEAR) with a Codex adversarial outside-voice pass; all findings folded in.

Security — source isolation (functional description per responsible disclosure)

  • One shared, fail-closed trust+grant resolver now governs every source-scoped read op (query, code_callers/callees, search_by_image, code_blast/flow, get_page). A remote caller's "all sources" request is bounded to its grant; an out-of-grant source is refused. (gbrain#1924, OAuth source scope bypass via explicit source_id in query #1371)
  • get_page's exact-slug path honors a federated grant via getPage(sourceIds[]) in both engines (pglite + postgres). (gbrain#1393)
  • Legacy bearer tokens carry their operator-stored source grant instead of being pinned to default. (gbrain#1336)
  • The Codex outside-voice pass caught two read ops the first pass missed (search_by_image, code_blast/code_flow); both now route through the resolver.

Ingest — frontmatter robustness

Papercuts

  • embed --catch-up no longer arms an overflowed 32-bit budget timer (which aborted after one batch); surfaces un-embeddable chunks at the end. (gbrain#1946)
  • Frontmatter pre-commit hook ships a correct .md/.mdx matcher instead of a silent no-op. (gbrain#1840)
  • Skill catalog parses YAML block-scalar (description: |) descriptions. (gbrain#1711)
  • getConfig retries on a transient connection blip instead of silently falling back to defaults. (gbrain#1603)

Test Coverage

Six new test files (resolver trust+grant matrix, get_page federated leak, frontmatter coercion + lint surfacing, skill-catalog block-scalar, install-hook regex, legacy-token grant) plus extensions to existing suites. All new code paths covered; engine-parity pinned for getPage(sourceIds[]).

Pre-Landing Review

Diff was eng-reviewed via /plan-eng-review (CLEAR, 0 unresolved) with a Codex adversarial outside-voice pass. Findings (2 missed leak surfaces + 2 correctness tensions) were all addressed before this PR.

Eval Results

No prompt-related files changed — evals skipped.

Plan Completion

Plan at ~/.claude/plans/...iridescent-island.md. All 9 issues implemented; OV3a slug/type policy superseded by master's landed #1939 coercion during merge (documented in CHANGELOG + tests updated to match).

Verification Results

Managed unit suite: 12,853 pass. 10 failures are all non-blocking and not caused by this diff: 7 pre-existing env-key tests (assert "no API key" behavior; this workspace has provider creds — stash-verified pre-existing) + 3 cold-start load timeouts (bootstrap.test.ts confirmed green in isolation). Typecheck clean. CI guards (batch-audit-site, jsonb, operations-filter-bypass, progress-to-stdout) green.

TODOS

No TODO items mapped to these issues.

Documentation

Docs audited against the wave. The non-string-frontmatter fix added an eighth frontmatter validation class (NON_STRING_FIELD / lint code frontmatter-non-string-field); skills/frontmatter-guard/SKILL.md and docs/integrations/pre-commit.md updated to match. No other docs drifted. CHANGELOG authored for 0.42.37.0; CLAUDE.md unchanged.

Test plan

  • Typecheck clean
  • Managed unit suite: 12,853 pass; 10 non-blocking (pre-existing env-key + load timeouts), 0 in-branch
  • 6 new test files green; engine-parity pinned
  • CI guards green

🤖 Generated with Claude Code

garrytan and others added 5 commits June 8, 2026 06:19
…t_page exact-path leak

One shared resolveRequestedScope() routes every source-scoped read op
(query, code_callers/callees, search_by_image, code_blast/flow, get_page)
through a single fail-closed trust+grant ladder: a remote caller's __all__
collapses to its granted sources (never the whole brain) and an explicit
out-of-grant source_id is rejected. get_page's exact-match path now honors a
federated grant via getPage(sourceIds[]) in both engines. Legacy bearer tokens
carry their stored permissions.source_id grant (bounded, never widened). Also
retries getConfig on transient connection loss.

Closes #1924, #1371, #1393, #1336, #1603.
…/hook/catalog papercuts

Parser coerces a non-string title to a string and falls back to inference for
slug/type (never fabricating a "123" slug), with a lint NON_STRING_FIELD finding
surfacing the malformed frontmatter; a defensive guard in content-sanity stops a
non-string title from crashing the whole lint/sync run brain-wide. Plus: embed
--catch-up no longer arms the overflowed 32-bit budget timer (and surfaces
unembeddable chunks); the frontmatter pre-commit hook ships a correct .md/.mdx
regex; and the skill catalog parses YAML block-scalar descriptions.

Closes #1883, #1658, #1556, #1948, #1946, #1840, #1711.
…ain-issues

# Conflicts:
#	src/core/content-sanity.ts
#	src/core/markdown.ts
… non-string frontmatter guard + papercuts

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…0.42.37.0

The v0.42.37.0 non-string-frontmatter fix added an eighth validation
class (NON_STRING_FIELD / lint code frontmatter-non-string-field). Update
the two current-state docs that enumerate the validation classes:
- skills/frontmatter-guard/SKILL.md (seven->eight + table row)
- docs/integrations/pre-commit.md (seven->eight + table row)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@garrytan garrytan merged commit 1eb430a into master Jun 9, 2026
16 of 17 checks passed
mgunnin added a commit to mgunnin/gbrain that referenced this pull request Jun 9, 2026
* upstream/master:
  v0.42.37.0 fix(security,ingest): source-isolation grant enforcement + non-string frontmatter guard + papercuts (garrytan#1999)
  v0.42.36.0 fix(sync): resumable, durable, single-flight sync — converges under pool exhaustion + repeated kills (garrytan#1794) (garrytan#1980)
  v0.42.35.0 fix(sync): recover from unreachable last_commit instead of full-walking forever (garrytan#1970) (garrytan#1975)
  v0.42.34.0 feat(search): typed-edge relational retrieval — relationship questions get relationship answers (garrytan#1959)
  docs(designs): add COMMUNITY_IDEAS ledger from open-PR backlog triage (garrytan#1969)
  v0.42.33.0 fix(sources): confine sync re-clone to gbrain-owned clones; never delete a user working tree (garrytan#1881) (garrytan#1960)

# Conflicts:
#	src/core/operations.ts
brentyates-swx added a commit to swxtchio/gbrain that referenced this pull request Jun 9, 2026
Single consolidated patch carrying the swxtch customizations whose goals are
still valid against current upstream. Re-implemented against today's code (the
original per-commit history is discarded); verified each goal, dropped the ones
upstream now solves. Cross-model reviewed (Gemini + Codex).

Still-valid goals, re-implemented:
- Multi-domain: index.md is a syncable folder entry page (removed from
  SYNC_SKIP_FILES). (src/core/sync.ts + 2 tests)
- GBRAIN_TOP_DIRS: scope a multi-repo brain root to an allowlist of top-level
  dirs — ported once into the now-central collectSyncableFiles walker.
- N-segment slug resolver: accept domain/docs/page (3-segment) slugs, not just
  upstream's 2-segment shape; getPage()/allSlugs.has() decide existence.
  (src/core/link-extraction.ts, src/commands/extract.ts)
- C/C++ chunker: extract symbols instead of falling back to text —
  collectSemanticNodes recursion through header guards / extern "C" / namespaces
  / templates (PASSTHROUGH_TYPES); type_definition/enum/union top-level types;
  declarator-chain name extraction; C/C++-scoped symbol-preserving merge.
  Surfaces functions, prototypes, typedefs, struct/union/enum, object- and
  function-like macros, namespace members, and templated fn/class.
  (src/core/chunkers/code.ts)
- code-def: accept the C/C++ symbol_types the patched chunker emits.
  (src/commands/code-def.ts)
- gbrain-safe-update: the non-destructive fork-preserving upgrade wrapper.
  (scripts/gbrain-safe-update)

Dropped — already handled by upstream (verified):
- source_id cross-source slug scoping → upstream source-isolation (all engine
  slug subqueries are source-scoped; federated grants, garrytan#1999/garrytan#1881/garrytan#996).
- gbrain doctor OPENCLAW_WORKSPACE → upstream uses autoDetectSkillsDirReadOnly.
- cli.ts executable bit → upstream ships src/cli.ts mode 100755.

Cross-model review (Gemini + Codex) caught and fixed: C++ namespace/template
members were collapsed into one opaque chunk (moved to PASSTHROUGH so the walker
recurses to the inner symbol); C++/function-like macros weren't extracted (added
preproc_def/preproc_function_def to the C/C++ top-level sets); a second stale
index.md skip-test (test/sync.test.ts).

Verified: tsc --noEmit clean; sync/sync-isSyncable/chunkers/code-def-refs/
edge-extractor/parent-scope suites green; C/C++ symbol extraction confirmed
empirically (functions, prototypes, typedefs, macros, namespace members,
templated fn/class) while TS small-sibling merging is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant