Add Figma Personal Access Token v3 Detector#4790
Add Figma Personal Access Token v3 Detector#4790shahzadhaider1 wants to merge 10 commits intotrufflesecurity:mainfrom
Conversation
5fcdefd to
ff9b319
Compare
|
|
||
| switch res.StatusCode { | ||
| case http.StatusOK: | ||
| return true, nil |
There was a problem hiding this comment.
Refactored verification narrows accepted success status codes
Low Severity
The shared VerifyMatch function only treats http.StatusOK (200) as verified, but the original v1 and v2 inline logic treated the entire 2xx range (StatusCode >= 200 && StatusCode < 300) as verified. Any non-200 success response (e.g., 201, 204) now falls into the default case and is reported as an unexpected error instead of being marked as verified. This is a behavioral regression introduced during the refactoring.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit ff9b319. Configure here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Reviewed by Cursor Bugbot for commit 864d266. Configure here.


Summary
Adds a v3 detector for Figma Personal Access Tokens to support the new
figp_prefixed token format. Also refactors the shared verification logic across all three detector versions to eliminate code duplication.Changes
New v3 detector (
figp_prefix)figp_[a-zA-Z0-9_=-]{40,54}as specified by Figmafigp_for efficient chunk matching\b) assertions used since the token character set includes non-word characters (=,-) which are incompatible with\bVerification logic refactored into shared
VerifyMatchfunctionVerifyMatchfunction in the v1 packagev1.VerifyMatchinstead of duplicating the HTTP verification inlineVerification details
GET https://api.figma.com/v1/mewithX-Figma-TokenheaderTesting
figp_token format is not yet available for generation in Figma. Tests will be unskipped once v3 secrets are provisioned in GCP.Checklist:
make test-community)?make lintthis requires golangci-lint)?Note
Low Risk
Adds a new detector and consolidates existing verification code without changing external APIs. Main risk is minor behavioral drift in verification error handling for v1/v2 due to the refactor.
Overview
Adds a new v3 Figma Personal Access Token detector to recognize the
figp_token format, including keyword prefiltering, regex matching, and (skipped) integration + unit test coverage.Refactors v1/v2 verification to call a shared
figmapersonalaccesstoken.VerifyMatchhelper (handlesGET https://api.figma.com/v1/meand status mapping) and updates integration test expectations/field ignores accordingly. Registers the v3 scanner indefaultsso it runs by default.Reviewed by Cursor Bugbot for commit 90b6ac1. Bugbot is set up for automated code reviews on this repo. Configure here.