Preventing sensitive data exposure programmatically is among the harder problems in security engineering. In distributed systems, data moves along intricate paths—across services, through serialization layers, into contexts where its presence isn't obvious. The failures tend to be subtle: an endpoint returning more data than intended, a legacy code path skipping a permission check, a missing validation that lets users see resources they shouldn't. These amount to authorization flaws or inadvertent overexposure, and at scale the privacy and trust impact is outsized.

Figma's answer is Response Sampling, a lightweight real-time control that watches outbound responses, validates access, and serves as an early warning system across its products. The system is meant to catch exposures in staging before they reach production and to keep watching for regressions once deployed—precise enough to trust, broad enough to be useful across many parts of the product. The team approached it with a platform-security mindset: treating application surfaces like infrastructure and layering continuous monitoring and detection on top, borrowing techniques usually reserved for lower-level systems without slowing development.

Why preventive controls need a detection layer

Figma's existing defenses are substantial: PermissionsV2, its fine-grained authorization framework, plus negative unit tests, end-to-end testing in staging and production, security review programs, a bug bounty, and regular penetration testing. Those systems underpin how the company prevents exposure. But prevention and testing cannot cover every edge case, and as products and infrastructure grow more complex, the risk of subtle oversights and unexpected data flows rises. Services interacting in new ways, or existing paths behaving unexpectedly, produce surprises even in well-designed systems.

The added layer is therefore about detection and observability, continuously validating that preventive controls work as intended and surfacing anomalies early. The requirements were explicit:

  • Monitor continuously for potential exposure, wherever in the product it occurs.
  • Produce actionable findings so problems can be fixed early, ideally before production.
  • Stay active in production as an additional defense against real-time regressions.

Those goals drove the trade-offs among detection breadth, performance cost, and operational maintainability.

Phase one: file identifiers as a tractable starting point

Detection first required a definition of "sensitive." Rather than attempt that everywhere at once, the team started with one well-defined type: file identifiers. These are the unique tokens embedded in each Figma file's URL and tied to its access controls; because they are high-entropy capability tokens with a known character set and consistent length, they are easy to find in text streams. That made them practical both for catching authorization bugs and for building infrastructure that could later generalize once a systematic definition of sensitive data existed.

Sampling is uniform at random at a configurable rate across request paths, which bounds coverage and overhead while still yielding representative results.

Diagram of a data request processing pipeline with labeled components for analysis, auditing, and reporting.
An architecture diagram of our Response Sampling system. The Permission Auditor (explained in this section) validates file-identifier access; the Sensitive Data Analyzer (explained in the next section) expands detection to any sensitive fields tagged by FigTag.

The implementation lives as middleware in the Ruby application server, chosen because it has direct access to the authenticated user object, the full API response body, and PermissionsV2. Inspecting response data and evaluating permissions in one place is straightforward there; doing the same at a proxy layer such as Envoy would make user-context-aware permission evaluation significantly harder.

Response Sampling is implemented with an after block and async jobs. The built-in after filter runs automatically once each request completes, giving a consistent point to inspect responses before they return to the client. It checks eligible responses against configured sampling rates and parses JSON bodies for file identifiers; when one is found, asynchronous jobs verify permissions. Verification logic applies rules covering known safe cases to reduce false positives, so only unexpected results surface for review. The whole path is non-blocking: if sampling or verification fails, the request completes normally and errors are logged for monitoring.

Other services can reuse the pipeline through an internal endpoint. LiveGraph, the real-time data-fetching service behind collaboration sync, makes a lightweight API call to that endpoint after producing a response, gaining the benefit without adding overhead to its real-time flow; its sampling is gated by configuration and rate limiting. Findings from every source share the same schema and logging path, so results land in a unified analytics warehouse and triage dashboards and on-call engineers interpret alerts the same way regardless of origin.

The logic runs on both staging and production traffic, with sampling rates tuned for meaningful coverage without noticeable latency, all checks asynchronous, and rate limiting in place so the processing pipeline isn't overloaded and resources aren't consumed excessively.

Results came quickly. Within days of rollout, Response Sampling surfaced cases where file-related identifiers appeared unnecessarily in certain responses, prompting better data filtering, and exposed paths where some files bypassed permission checks entirely. Those gaps were closed and access controls strengthened. The scope, however, was still one data type.

Phase two: generalizing with FigTag

Expanded Response Sampling—"fancy Response Sampling" internally—applied the same principles to all sensitive data by integrating with FigTag, Figma's internal data categorization tool.

Colored objects move through angled blue lanes that intersect a yellow elliptical sieve filtering green, red, and gray particles.

FigTag annotates every database column with a category describing its sensitivity and intended use. Annotations are stored in a central schema and propagated to the data warehouse, so a column's sensitivity is known at query time. The banned_from_clients category is the sensitivity signal: it flags fields that must not appear in API responses under normal circumstances, including security-related identifiers, billing details, and other PII.

Through FigTag, a subset of responses containing any sensitive fields is sampled across all application server API endpoints. When a record with a banned_from_clients column loads into the application—via an ActiveRecord model in the Ruby app—a callback records its value into request-local storage, so for sampled requests only values actually accessed during that request are tracked, avoiding unnecessary overhead. After the response is generated, an after filter inspects the serialized JSON and compares it against the recorded values; any match produces a finding, which flows into the same warehouse and dashboards.

A flexible allowlisting process lets endpoints with intentional, safe exposure opt out without losing detection of genuinely unexpected data. An OAuth client secret, for instance, may legitimately be returned by a dedicated credential management endpoint to authorized users—but its presence in unrelated API responses would be a serious issue.

What early detection has caught

The expanded system now serves as a detection layer for issues that code review or manual QA would be hard-pressed to find, spotting risks in staging and catching production regressions quickly. Examples so far:

  • A long-unused data field unexpectedly reaching certain responses; the team confirmed and categorized the finding and shipped a targeted fix quickly.
  • Data from related resources included in responses without clear need, leading to targeted clean-up work.
  • Resource lists returned without verifying access for each item individually, prompting enhancements to permission checks.

What the build taught the team

Response Sampling was a joint effort across Figma's security, product and platform groups. The operational lessons the team drew from it are practical rather than architectural:

  • Design for latency from the start. Even light monitoring can add overhead if it is bolted on carelessly. Tuning sampling rates and running checks asynchronously let the system keep user-facing performance intact while still producing useful traffic visibility.
  • Keep false positives in check. A noisy detector erodes trust in alerts and buries teams. Dynamic allowlisting and structured triage workflows let known-safe cases be filtered quickly so engineers can concentrate on genuinely risky findings.
  • Treat context as a first-class input. Exposures are not all equally serious. Dynamic configuration lets detection rules be retuned without redeploying services, so legitimate usage can be accommodated while abnormal or unexpected scenarios still trigger.
  • Run more than one layer. Deploying in both staging and production gives two lines of defense: detection before code ships and ongoing monitoring that catches regressions afterward. That defense-in-depth setup has been central to keeping the system resilient over time.
Layers of red elliptical sieves filter yellow, green, and gray particles traveling along blue diagonal lanes.

Where the framework goes next

The broader aim is a platform-security model applied to product security: continuous monitoring and detection layered onto application surfaces so problems surface early without slowing development.

Coverage is being expanded in several directions. More services and additional user-facing touch points are being brought into the framework so potential exposure can be spotted across all major interaction channels. The team also intends to cover more sensitive data categories, including broader classes of PII and regulated data, so detection keeps pace with compliance requirements.

Making the system more adaptive is the other focus. Specific areas under investigation include finer-grained sampling controls to better trade resources against visibility, automated triage to shorten investigations, and richer reporting that surfaces trends over time. The underlying objective is unchanged: protect user data while keeping every Figma experience fast, reliable and secure.

It is uncommon for AppSec teams to borrow from infrastructure security, but Response Sampling suggests the transfer works. Moving continuous detection closer to the application layer helped the team find issues and respond to them sooner — an approach the authors believe other teams could adopt.

Abstract composition with colorful geometric shapes surrounding a gray clover-like form, connected to a vertical panel displaying the characters “877A7A” on a green background.

Dave Martin works on Figma's Product Security team, focusing on vulnerability management and building AI-based automation that scales the security program.