Skip to content

fix: community fix wave — 9 PRs, 8 contributors (v0.6.1)#38

Merged
garrytan merged 11 commits intomasterfrom
garrytan/fix-wave-1
Apr 11, 2026
Merged

fix: community fix wave — 9 PRs, 8 contributors (v0.6.1)#38
garrytan merged 11 commits intomasterfrom
garrytan/fix-wave-1

Conversation

@garrytan
Copy link
Copy Markdown
Owner

Summary

Community fix wave: re-implemented 9 community PR fixes on a collector branch with full test coverage.

Bug Fixes:

Improvements:

Process:

  • Community PR wave workflow documented in CLAUDE.md

Test Coverage

70 unit tests pass (slug validation + sync tests), including:

  • 11 new ellipsis/traversal regression tests
  • 2 new .mdx sync tests
  • 1 new .mdx slugify test

Reviews

  • CEO Review: CLEAN (selective expansion, 3/3 proposals accepted)
  • Eng Review: CLEAN (2 issues from outside voice, both fixed)
  • Outside Voice: regex security gap caught and fixed, .mdx slug bug caught and fixed

Test plan

  • bun test — 264 pass, 0 fail (with deps installed)
  • Slug validation: ellipsis accepted, real traversal rejected
  • Import walker: node_modules skipped, .mdx included
  • Sync: .mdx files syncable, slugifyPath strips .mdx extension
  • E2E tests (require DATABASE_URL, run in CI)

🤖 Generated with Claude Code

garrytan and others added 7 commits April 10, 2026 18:48
…traversal

Changed regex from /\.\./ to /(^|\/)\.\.($|\/)/ so filenames with "..." (like
YouTube transcripts, TED talks, podcast titles) are no longer falsely rejected.
The old regex matched ".." anywhere as a substring. The new one only matches ".."
as a complete path component (e.g., ../foo, foo/../bar, bare ..).

Fixes 1.2% silent data loss on real-world import corpora.

Co-Authored-By: orendi84 <orendi84@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rts .mdx

Three improvements to the file walker:
- Skip node_modules directories (prevents crashes importing JS/TS projects)
- try/catch around statSync for broken symlinks (warns and continues)
- Accept .mdx files alongside .md (extends to slugifyPath and isSyncable)

Co-Authored-By: mattbratos <mattbratos@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three init improvements:
- process.stdin.pause() after reading URL input (prevents event loop hang)
- Auto-run CREATE EXTENSION IF NOT EXISTS vector with fallback message
- Update Supabase session pooler navigation hint to match current dashboard UI

Co-Authored-By: changergosum <changergosum@users.noreply.github.com>
Co-Authored-By: eric-hth <eric-hth@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Run keyword search concurrently with the embed+vector pipeline instead of
sequentially. Keyword search has no embedding dependency so it can overlap
with the OpenAI API call, saving ~200-500ms per search.

Co-Authored-By: irresi <irresi@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: howardpen9 <howardpen9@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Documents the fix wave workflow: categorize, deduplicate, collector branch,
test, close with context, ship as one PR with attribution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Community fix wave: 9 PRs re-implemented with full test coverage.
6 bug fixes, 1 perf improvement, 2 feature additions, 8 contributors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
garrytan and others added 4 commits April 10, 2026 19:00
Remove vendored .claude/skills/gstack/ from git tracking. The global install
at ~/.claude/skills/gstack/ is the source of truth. Each developer runs
`cd ~/.claude/skills/gstack && ./setup` to set up symlink stubs locally.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
These are generated locally by gstack's ./setup script. Not project code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
openclaw.com is a parked page. openclaw.ai is the real product.

Co-Authored-By: joshua-morris <joshua-morris@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@garrytan garrytan merged commit 8de04d3 into master Apr 11, 2026
4 checks passed
garagon added a commit to garagon/gbrain that referenced this pull request Apr 11, 2026
The recursive markdown walker in `src/commands/import.ts` used
statSync, which follows symlinks. Combined with the `.md` extension
filter, that lets a contributor to a shared brain plant a symlink
at `notes/innocent.md` pointing at `~/.gbrain/config.json`,
`~/.aws/credentials`, `/etc/passwd`, `~/.zshrc`, `.env`, or any
other file the importing user can read. On the next `gbrain import`,
the walker treats the symlink as a regular file, `readFileSync`
follows the link to its target, and the secret ends up chunked,
embedded via OpenAI, and indexed in Postgres — at which point a
bearer-token holder can exfiltrate it via `search` / `get_page`.

Circular symlinks are a separate variant of the same bug: walking
into a symlinked directory that ultimately points back into the
brain root causes unbounded recursion and an OOM crash during
import.

PR garrytan#26 / garrytan#38 already added `node_modules` skipping and a try/catch
around `statSync` so broken symlinks wouldn't crash the walker, but
left the symlink-following behavior intact — a valid symlink was
still silently read.

Fix:

- Replace `statSync` with `lstatSync`. `lstatSync` describes the
  link itself, not the target, so we can identify symlinks before
  we commit to following them.
- Add an explicit `stat.isSymbolicLink()` branch that logs a skip
  warning and continues. No realpath containment, no depth cap, no
  visited-set — skipping all symlinks entirely is the simplest
  defense and is strictly stronger than any of those alternatives.
  Hard links are out of scope (a hard link is indistinguishable
  from the original file; any fix would break legitimate use).
- Export `collectMarkdownFiles` so it can be unit-tested in
  isolation instead of being reachable only through `runImport`.

Tests added in `test/import-walker.test.ts`:

- `includes real markdown files inside the root` — baseline: a
  normal brain dir with a top-level and a nested .md file produces
  both paths.
- `skips a symlink file pointing outside the brain root` — the
  core security test. Plants a symlink at `innocent.md` pointing
  at a secret in a sibling tmpdir, asserts the walker output
  contains neither the symlink nor the canonical secret path.
- `does not descend into a symlinked directory` — ensures the
  fix also blocks the directory-symlink variant, which is what
  lets circular symlinks become a DoS primitive.
- `skips broken symlinks without crashing` — pins the invariant
  that PR garrytan#26 / garrytan#38 already established (dangling symlinks don't
  throw), so that regression can't reappear. `lstatSync` actually
  succeeds on a dangling link since it stats the link inode, so
  we reach the `isSymbolicLink()` branch and skip cleanly.

Refs: report/evidence/poc-l002-symlink-import.ts
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