Design Permission-Aware Retrieval for Design Files
FigmaSoftware Engineer · OnsiteLast updated
Design a permission-aware search and retrieval system for collaborative design files and assets that enforces hierarchical access control, supports hybrid search, and prevents data leakage.
Scenario
In a collaborative design platform like Figma, users create, share, and organize millions of design files, canvases, components, and design tokens across organizations, teams, projects, and individual share links.
You are tasked with designing a Permission-Aware Search Retrieval Engine that allows users to find files, frames, and components via short text queries, structured filters (e.g., file type, date modified, creator), and hybrid semantic search, while guaranteeing that no unauthorized metadata or content is ever leaked.
Requirements
Functional Requirements
- Query & Filtering: Support keyword search (BM25/tokenized) and semantic retrieval (vector-based embeddings of frame titles/canvas contents) paired with metadata filters.
- Hierarchical Permissions: Access control is inherited hierarchically:
Org -> Team -> Project -> File -> Node/Frame. Direct grants, link-based access (e.g., "Anyone with link in org"), and explicit excludes can override inherited permissions. - Near Real-Time Updates: File edits, creation, renames, and permission mutations (grants/revocations) must reflect in search results within 2 seconds.
- Revocation Safety: A revoked user must never see the file or snippet in subsequent queries, and search result counts must not reveal the existence of forbidden files.
- Ranking Integration: Feed retrieved, permission-filtered candidates into a downstream scoring/ranking model while providing a deterministic fallback if the ranker degrades or times out.
Non-Functional Requirements & Scale
- Scale: 50 million total design files, 2 billion indexed components/frames, 10 million daily active users.
- Search Throughput: 15,000 queries per second (QPS) at peak.
- Latency: End-to-end p95 search latency < 150 ms (including candidate retrieval, authorization verification, and ranking).
- Observability: Metrics, traces, and logs must be strictly leakage-free (e.g., forbidden file IDs or title snippets must not appear in user query telemetry).
Key Architectural Questions to Address
- Index Architecture & ACL Storage: How do you index documents and structured permissions? Do you perform pre-filtering (filtering permissions inside the inverted/vector index) or post-filtering (filtering candidate hits after retrieval), and how do you handle deep pagination?
- Hierarchical ACL Resolution: How do you avoid traversing deep graph hierarchies on every candidate during high-throughput search queries?
- Index Invalidation & Revocation: How do you handle high-cardinality permission updates (e.g., moving a project containing 10,000 files to a different team)?
- Downstream Ranking & Fallback: How does candidate retrieval feed into the re-ranker, and how does the fallback operate under latency pressure?
- Auditability & Observability: How do you monitor precision, recall, and system latency without leaking private document metadata in metrics or distributed traces?
Hints
Hint 1
Consider modeling access control lists (ACLs) using read capability sets or flattened ancestor group tokens indexed alongside document vectors and tokens.
Hint 2
Evaluate the trade-offs of early permission pre-filtering vs. late candidate hydration, especially when combined with top-k vector nearest-neighbor search.
Hint 3
For bulk permission changes (e.g., moving a project to a new team), decouple the logical ACL version or group membership update from synchronous re-indexing of every child file.
Follow-up questions
- How does your index design handle vector Approximate Nearest Neighbor (ANN) search when pre-filtering eliminates 99% of candidates, leading to graph traversal disconnects?
- If a user is removed from a team with 50,000 files, how do you prevent stale search cache hits without invalidating the entire cluster cache?
- How do you design deterministic pagination (cursor-based) when real-time permission revocations cause candidates to disappear mid-scroll?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.