Update Cloudflare detector patterns for 2026+ credential formats#4830
Open
nkcmr wants to merge 2 commits intotrufflesecurity:mainfrom
Open
Update Cloudflare detector patterns for 2026+ credential formats#4830nkcmr wants to merge 2 commits intotrufflesecurity:mainfrom
nkcmr wants to merge 2 commits intotrufflesecurity:mainfrom
Conversation
## Context/Background
Cloudflare is rolling out new prefixed credential formats in 2026.
The legacy patterns were too broad (wrong char classes, fixed lengths)
and the new formats (`cfk_`, `cfut_`, `cfat_`) are self-identifying
via prefix, so they do not need keyword proximity matching.
Additionally, CA keys (Service Keys) are now deprecated.
## Changes in this commit
- cloudflareglobalapikey: fix legacy pattern to lowercase hex
`[a-f0-9]{37,45}`, add `cfk_` v2 pattern and keyword
- cloudflareapitoken: add `cfut_`/`cfat_` v2 pattern with combined
regex `cf[ua]t_`, add keywords, route `cfat_` verification through
the account-scoped `/accounts/:id/tokens/verify` endpoint
(extracting account IDs from surrounding data)
- cloudflarecakey: add deprecation notice with changelog link
- Update tests for all changed detectors
Contributor
|
Hey @nkcmr can you also attach some doc links which state the mentioned credential format changes? |
amanfcp
requested changes
Mar 30, 2026
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.

Context/Background
Cloudflare is rolling out new prefixed credential formats in 2026. The legacy patterns were too broad (wrong char classes, fixed lengths) and the new formats (
cfk_,cfut_,cfat_) are self-identifying via prefix, so they do not need keyword proximity matching.Additionally, CA keys (Service Keys) are now deprecated.
Changes in this commit
[a-f0-9]{37,45}, addcfk_v2 pattern and keywordcfut_/cfat_v2 pattern with combined regexcf[ua]t_, add keywords, routecfat_verification through the account-scoped/accounts/:id/tokens/verifyendpoint (extracting account IDs from surrounding data)Description:
Explain the purpose of the PR.
Checklist:
make test-community)?make lintthis requires golangci-lint)?Note
Medium Risk
Updates secret-matching regexes and verification behavior for Cloudflare tokens/keys, which could change detection/verification outcomes and increase verification requests (especially for
cfat_tokens when many account IDs are present). Scope is limited to Cloudflare detectors and their tests.Overview
Updates Cloudflare detectors to recognize new 2026+ prefixed credentials and tighten legacy matching.
cloudflareapitokennow detectscfut_/cfat_tokens without keyword proximity and verifiescfat_tokens via account-scoped endpoints by pairing tokens with any 32-hex account IDs found in the surrounding data.cloudflareglobalapikeyrefines the legacy global API key regex to lowercase hex with variable length, addscfk_detection without keyword proximity, and expands keyword prefiltering accordingly.cloudflarecakeyadds a deprecation notice for Origin CA (Service) keys, and tests are updated to cover the new patterns.Written by Cursor Bugbot for commit 95c4210. This will update automatically on new commits. Configure here.