Skip to content

fix(api): restrict public sharing to unfiltered overview queries - #1117

Merged
izadoesdev merged 2 commits into
databuddy-analytics:stagingfrom
maskjelly:fix/public-overview
Oct 17, 2026
Merged

izadoesdev merged 2 commits into
databuddy-analytics:stagingfrom
maskjelly:fix/public-overview

Conversation

@maskjelly

@maskjelly maskjelly commented Oct 9, 2026 •

Copy link
Copy Markdown

Description

Public sharing exposed query types beyond the documented overview, including custom-event properties and error diagnostics. This limits anonymous access to unfiltered overview queries and keeps the public dashboard usable under that policy.

Slice

Changes

  • Publicly allow only the overview query types. Other builders require website permission.
  • Require website permission for any filter, including trait, identifier, and dimension filters. Apply the check to full batches and /v1/query/compile before query execution.
  • Keep the public dashboard unfiltered and remove row-click filter actions there, so visitors do not trigger rejected queries. Member dashboards keep those actions.
  • Correct the trait-filter test fixture to use the production trait: prefix and document the privacy limits of public aggregates.

Compatibility and privacy

Anonymous private or filtered requests now return 401; authenticated outsiders return 403. Public date ranges and fixed overview breakdowns remain available. Public aggregates can still describe small groups or contain application-provided labels; enabling sharing is an owner decision and does not guarantee statistical anonymity.

Validation

  • bun run lint: passed.
  • bun run check-types: 37/37 tasks passed.
  • bunx --bun vitest run src/routes/query-public-access.test.ts: 21 passed.
  • The public dashboard fix was type checked; browser interaction was not run in this follow-up.

Merge notes

This is an independent change based on current staging. Maintainer review and CI are still required.

Before merge

  • Maintainer applies the suggested labels and reviews the change.
  • Run the fork CI workflow (currently action_required with zero jobs).
  • Resolve the Vercel authorization check failures shown on the PR.

AI disclosure: implemented and tested with Codex. Source and local test results were reviewed during implementation; maintainer human review is required.

@vercel

vercel Bot commented Oct 9, 2026

Copy link
Copy Markdown

@maskjelly is attempting to deploy a commit to the Databuddy OSS Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
vercel Bot temporarily deployed to Preview – dashboard October 9, 2026 22:50 Inactive
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: e109565f-da70-4ece-881e-d344981be6c1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@vercel

vercel Bot commented Oct 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
dashboard Skipped Skipped Oct 9, 2026 10:50pm UTC

@maskjelly
maskjelly marked this pull request as ready for review October 9, 2026 22:50
@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Critical impact] Restricts public API access to unfiltered overview queries only.

The access changes appear sound, but the new test must satisfy the repository's explicit type and async-function requirements before merging.

Findings

  1. P2 Test helpers lack explicit types ▶
  2. P2 Tests use wrong trait prefix ▶
  3. P2 Async mocks omit required await ▶

Summary

This PR limits public website queries to an unfiltered overview.

  • Public website queries now stop at the unfiltered overview.

No runtime tests were run during this review.

Acknowledged limits: maskjelly explicitly describes denial of filtered public dashboard requests as intentional. maskjelly also acknowledges that small-group counts and application-provided labels remain public; this PR does not introduce that limit.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Execute or compile request] --> B[Check all query types and filters]
  B --> C{Public website and unfiltered overview?}
  C -->|Yes| D[Allow public access]
  C -->|No| E{Website permission?}
  E -->|Member or matching API key| F[Allow private access]
  E -->|No| G[Reject with 401 or 403]
  D --> H[Compile or execute]
  F --> H
Loading

Reviews (1) · Last reviewed commit: "fix(api): restrict public sharing to unf..." · Reviewed by Greptile

Comment thread apps/api/src/routes/query-public-access.test.ts Outdated
Comment thread apps/api/src/routes/query-public-access.test.ts Outdated
Comment thread apps/api/src/routes/query-public-access.test.ts Outdated
@izadoesdev
izadoesdev merged commit 4926ae7 into databuddy-analytics:staging Oct 17, 2026
9 of 12 checks passed
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.

2 participants