Missing access checks on caller-supplied video/space IDs (4 endpoints, PRs open)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- next.js, typescript
- Domain
- api, authorization, security
Research direction
Review PRs #2029–#2032 before starting, then read VideosPolicy.canView, getSpaceAccess, /api/analytics/route.ts, and Analytics.tsx to understand the existing checks. Done means the four listed entry points enforce appropriate access checks and return not-found responses on denial, without duplicating work already covered by the open PRs.
Written by the indexing model from the issue text.
Description
While working on #1982 I audited every entry point in apps/web that accepts a caller-supplied resource ID, since that advisory looked like an instance of a pattern rather than a one-off. It was — I found four, and opened a PR for each.
The pattern
Cap has a solid access-control primitive in VideosPolicy.canView, and most code uses it. The failures all have the same shape: a second entry point to the same data that skips the check. Server actions are the main way this happens, because a "use server" function is independently callable by any client and does not inherit whatever gating its usual API route does.
What I found
| PR | Entry point | State before | Impact |
|---|---|---|---|
| #2029 | newComment action |
authenticated only | write comments/reactions into anyone's private video, notifying the owner |
| #2030 | getVideoAnalytics action |
no auth at all | read view counts of any private video |
| #2031 | getSpaceVideoIds / getFolderVideoIds |
authenticated only | enumerate video IDs in spaces of orgs you aren't in |
| #2032 | /api/video/transcribe/status |
authenticated only | read transcription status of anyone's private video |
Two are worth calling out specifically:
#2030 is the sharpest. /api/analytics/route.ts does gate on canView, with a comment stating it exists so private view counts aren't disclosed. But getVideoAnalytics is a server action with zero auth of any kind — no getCurrentUser, no policy — and a "use client" component (Analytics.tsx) already calls it directly. The route's protection is bypassable by calling the action the same way the app's own client code does.
#2031 leaks IDs, which are the key to everything else. Video IDs are what /s/{videoId} and the other video endpoints take, so enumerating a private space's ID set is useful to an attacker even before any per-video check runs.
Sweep result
After these four, I re-swept: no remaining videoId-taking server action or API route in apps/web lacks an access check. Two files still show up in a naive grep but are fine on inspection — /api/notifications takes no ID and only returns the caller's own rows, and /api/tools/loom-download takes a Loom video ID, not a Cap resource.
Notes on the fixes
- Every fix reuses an existing primitive (
VideosPolicy.canView, orgetSpaceAccessfor the space paths) rather than introducing new logic, so they inherit the full existing model — owner, org, space, public, password, email-domain restrictions. - For #2031 I used
getSpaceAccessand notrequireSpaceManager: these are read paths, and requiring manager would have locked out ordinary members. - Denials return "not found" rather than "denied" throughout, so none of them become an oracle for which IDs exist.
- Each PR is 1–2 files. They're independent and can be merged in any order.
Happy to consolidate them into a single PR if you'd prefer to review it that way.
cc @richiemcilroy
- Dominant language
- Rust
- Stars
- 25k
- Forks
- 2.4k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 676
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CapSoftware/Cap
-
Captions panel does not offer to show an existing transcriptPossibly taken @thedavidweng claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
CapSoftware/Cap#4276 · 1 comment ·
Maintainers usually reply within 1 day
-
Download, FAQ, privacy and terms pages have no meta descriptionPossibly taken @patrickballard claimed this 13 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
CapSoftware/Cap#3675 · 1 comment ·
Maintainers usually reply within 1 day
-
self hosting
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
CapSoftware/Cap#2384 · 3 comments ·
Maintainers usually reply within 1 day
-
Dashboard pagination causes full page reloads on self-hosted CapPossibly taken @DipanshuAmbilkar03 claimed this 11 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
CapSoftware/Cap#2305 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
CapSoftware/Cap#1714 · 3 comments ·
Maintainers usually reply within 1 day
Similar issues
-
benchmark-review
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
Maintainers usually reply within 1 day
-
area:filesystem bug need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
libracoder/kiri#364 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
matrix-org/matrix-rust-sdk#7495 ·
Maintainers usually reply within 1 day