Skip to content

fix(agents): keep Figma REST design fields and branch keys - #1043

Draft
cursor[bot] wants to merge 5 commits into
mainfrom
cursor/bc-88fdcdc4-d1c5-4cb7-806a-4f33bddc8336-b493
Draft

fix(agents): keep Figma REST design fields and branch keys#1043
cursor[bot] wants to merge 5 commits into
mainfrom
cursor/bc-88fdcdc4-d1c5-4cb7-806a-4f33bddc8336-b493

Conversation

@cursor

@cursor cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

#1034 closed the whoami-only gap from #1028 by adding figma_rest_file.py, then overclaimed the same way #1028 did: the default outline kept only id / name / type, so a Cloud Agent still could not implement a frame. This successor keeps the allowlisted REST path and fills the buyer-visible fields Figma already returns.

  • outline_node now keeps absoluteBoundingBox, SOLID fills, TEXT characters and type, auto-layout padding, and constraints.
  • Branch URLs (/design/<file_key>/branch/<branch_key>/...) GET the branch key, not main.
  • Instance ids (I12:34;56:78) are valid --node-id values and nodes map keys.
  • thumbnailUrl, bounded component/style names, and Figma/S3 image hosts pass through.
  • Tokens with control characters are rejected (CWE-113). Locators are parsed, never fetched (CWE-918). File-key allowlisting remains CWE-22.
  • Docs and changelog stop saying REST replaces Desktop/CLI get_design_context.

Prefer this head over #1028, #1032, and #1034. Keep those draft or unmerged.

Developer experience

  • Reconstructing agents get geometry, color, type, and text from the documented Cloud command instead of a name tree.
  • Semgrep dynamic-urllib-use-detected stays inapplicable (urllib.request.urlopen is not used).
  • Contract tests pin honesty (get_design_context), CWE-22/918, branch keys, and instance ids.

User experience

  • After FIGMA_ACCESS_TOKEN is stored, run python3 scripts/ci/figma_rest_auth.py then python3 scripts/ci/figma_rest_file.py '<figma-url>'.
  • Use the outline to implement the selected frame on Cloud. Use --images only when a PNG preview is needed (URLs expire in 30 days).
  • For get_design_context, continue on Desktop/CLI Figma MCP Connect.

Test plan

  • tests/test_figma_rest_auth.py and tests/test_figma_rest_file.py — control-character tokens, branch URLs, instance ids, design fields, host allowlist, live unauthenticated /v1/me and /v1/files
  • coverage run -m pytest tests/test_figma_rest_auth.py tests/test_figma_rest_file.py (100% on both helpers)
  • interrogate (100% on both helpers)
  • Changelog contract still pins the existing ignored-path inventory sentence
  • After FIGMA_ACCESS_TOKEN is added, run the two helpers against a real file and a branch URL
Open in Web View Automation 

cursoragent and others added 5 commits August 16, 2026 14:47
Cursor Cloud Agents cannot complete Figma MCP OAuth. Record the 401
challenge, the official Cloud-unsupported decision, and a REST
FIGMA_ACCESS_TOKEN whoami helper that never prints the secret.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Semgrep p/default flagged urllib.request.urlopen in figma_rest_auth.py
as dynamic-urllib-use-detected. Open api.figma.com over TLS with a
literal host and path, and refuse any other URL.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Whoami alone does not read a Figma file. Add a pinned
api.figma.com GET /v1/files helper with allowlisted keys and
node ids, and record the operator path in ADR, changelog, and
APA 7 doctoring so Cloud Agents can continue design-to-code.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Absorb the #1032 security extras: allow only X-Figma-Token, cap
whoami/file bodies, cite CWE-22 and plan tokens, and keep a live
unauthenticated /v1/me accuracy check. Prefer this head over #1032.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Cloud Agent file read now returns geometry, solid fills, text, and
auto-layout instead of name/type only, uses branch keys from branch
URLs, accepts instance node ids, and stops claiming MCP-equivalent
design-to-code.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
@cursor
cursor Bot requested a review from seonghobae August 16, 2026 15:59
Comment on lines +120 to +123
connection = http.client.HTTPSConnection(
"api.figma.com",
timeout=REQUEST_TIMEOUT_SECONDS,
)
Comment on lines +208 to +211
connection = http.client.HTTPSConnection(
FIGMA_API_HOST,
timeout=REQUEST_TIMEOUT_SECONDS,
)
@seonghobae

Copy link
Copy Markdown
Contributor

This branch is stale against current main and is superseded by the safe current-main successor PR #1146. The successor preserves the Figma REST security boundary, adds bounded component-set/style metadata and node style references for design-token recovery, and has focused 64-test plus 100% branch-coverage evidence. Please review #1146.

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.

3 participants