Add Figma Personal Access Token v3 Detector#4790
Open
shahzadhaider1 wants to merge 7 commits intotrufflesecurity:mainfrom
Open
Add Figma Personal Access Token v3 Detector#4790shahzadhaider1 wants to merge 7 commits intotrufflesecurity:mainfrom
shahzadhaider1 wants to merge 7 commits intotrufflesecurity:mainfrom
Conversation
amanfcp
reviewed
Mar 31, 2026
5fcdefd to
ff9b319
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit ff9b319. Configure here.
|
|
||
| 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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
Medium Risk
Adds a new detector variant and changes verification behavior for existing Figma token detectors by centralizing the HTTP verification code path; mistakes here could impact verification results and outbound API calls.
Overview
Adds a new Figma Personal Access Token v3 detector to recognize the new
figp_token format (including keyword prefiltering) and registers it inpkg/engine/defaults/defaults.go.Refactors v1/v2 verification to call a shared
figmapersonalaccesstoken.VerifyMatchhelper (including draining/closing response bodies), and updates integration tests to expectAnalysisInfoon verified results and to ignore the newprimarySecretfield in result comparisons.Reviewed by Cursor Bugbot for commit 25d9bac. Bugbot is set up for automated code reviews on this repo. Configure here.