Skip to content

fix(portal): restrict similar posts to public boards#32

Open
BunsDev wants to merge 1 commit into
mainfrom
codex/fix-vulnerability-exposing-private-post-metadata
Open

fix(portal): restrict similar posts to public boards#32
BunsDev wants to merge 1 commit into
mainfrom
codex/fix-vulnerability-exposing-private-post-metadata

Conversation

@BunsDev
Copy link
Copy Markdown
Member

@BunsDev BunsDev commented Jun 5, 2026

Motivation

  • The public SimilarPostsSection called an unauthenticated findSimilarPostsFn that queried posts without requiring the parent board to be public, which could expose private-board post metadata on public post pages.
  • The intent is to prevent information disclosure by ensuring similar-posts results only reference posts from public boards.

Description

  • Updated apps/web/src/lib/server/functions/public-posts.ts in findSimilarPostsFn to import eq and join boards in the full-text search path and require eq(boards.isPublic, true) before returning matches.
  • Applied the same innerJoin(boards, eq(posts.boardId, boards.id)) + eq(boards.isPublic, true) guard to the vector-search path so both search branches are constrained to public boards.
  • Added the public-board filter when resolving board slugs for matched posts by changing the boards lookup to where(and(inArray(boards.id, boardIds), eq(boards.isPublic, true))).

Testing

  • Ran git diff --check to validate no whitespace/format issues and it passed.
  • Ran typecheck with bun run typecheck which could not complete in this environment because project dependencies/type definitions are not installed, producing missing @testing-library/jest-dom and bun type definition errors.

Codex Task

Copilot AI review requested due to automatic review settings June 5, 2026 23:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR closes an information-disclosure gap in the public findSimilarPostsFn by ensuring “similar posts” results only come from posts whose parent board is public, preventing private-board post metadata from appearing on public post pages.

Changes:

  • Added boards joins + eq(boards.isPublic, true) guard to the full-text search query branch.
  • Applied the same public-board constraint to the vector-search query branch.
  • Filtered the board-slug lookup to public boards when hydrating result metadata.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@BunsDev BunsDev self-assigned this Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants