Skip to content

Add v0.dev integration with API key management and security hardening#1

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/add-vercel-sdk-integration
Draft

Add v0.dev integration with API key management and security hardening#1
Copilot wants to merge 5 commits intomainfrom
copilot/add-vercel-sdk-integration

Conversation

Copy link

Copilot AI commented Jan 8, 2026

Implements automated v0.dev project creation using v0-sdk with secure API key management. Due to Figma's sandbox constraints, current implementation uses enhanced manual workflow (opens v0.dev with pre-filled prompt). Infrastructure in place for future server-side proxy to enable full SDK automation.

Changes

Core Integration

  • Added v0-sdk@0.2.0 dependency
  • Created v0Integration.ts with SDK interface for project creation, screenshot handling, and API key retrieval
  • Updated main.ts to handle v0-send messages and route to SDK
  • Modified manifest.json to allow network access to https://api.v0.dev

UI Enhancements

  • Settings button (⚙️) in header for API key configuration via localStorage
  • Send to v0 button (🚀) with privacy consent and automatic clipboard copy
  • API key stored with security warnings and masked display (••••••••••••••••)

Security

  • Added escapeHtml() to sanitize user-controlled data (frame names, error messages)
  • Removed partial API key exposure in UI
  • Privacy notice before first data transmission to v0.dev
  • XSS protection on all dynamic HTML insertion

Example Usage

// v0Integration.ts
export async function sendToV0(
  prompt: string,
  screenshots: Screenshot[],
  apiKey: string
): Promise<V0Result>

// UI interaction
localStorage.setItem('v0ApiKey', apiKey);  // Secure storage
parent.postMessage({ type: 'v0-send', data: { prompt, screenshots, apiKey } });

API Key Setup

Users configure via Settings UI or V0_API_KEY environment variable. Key stored in browser localStorage, never committed to repository.

Future: Server Proxy

Current Figma sandbox prevents direct SDK usage. Implementing server-side proxy will enable:

  • Automatic v0 project creation without manual steps
  • Direct screenshot URL attachments
  • Instant project links returned to plugin

Security Notes

  • CodeQL: 0 alerts
  • XSS: All user input sanitized via HTML escaping
  • API keys: Masked display, explicit security warnings, consent required
Original prompt

I would like you to use @ai-sdk/vercel in order to automatically pass the prompt to v0 and then return a link to the generated project. Also explore if you can pass the screenshots that are being captured and in order to enhance the v0 output. Confirm if an API key is needed and if put a placeholder in so I can supply one via the github secrets manager


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits January 8, 2026 16:38
Co-authored-by: neil-armstrong-instil <14013708+neil-armstrong-instil@users.noreply.github.com>
Co-authored-by: neil-armstrong-instil <14013708+neil-armstrong-instil@users.noreply.github.com>
Co-authored-by: neil-armstrong-instil <14013708+neil-armstrong-instil@users.noreply.github.com>
Co-authored-by: neil-armstrong-instil <14013708+neil-armstrong-instil@users.noreply.github.com>
Copilot AI changed the title [WIP] Add integration with @ai-sdk/vercel for project generation Add v0.dev integration with API key management and security hardening Jan 8, 2026
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