Accept Cloudflare cfut_/cfat_ API tokens#123
Conversation
|
It seems unlikely the token format will change again in the future, but to prevent this from happening again I feel like this sort of validation should produce a warning instead of failing entirely. Or, instead of strictly matching against the token format, simply check for the common mistakes mentioned in the log message: Line 50 in 6dc1fbb |
|
This is currently blocking me from setting up a Caddy instance with the Cloudflare DNS provider, as the only token's I can generate are the new ones so far that i know of, Whats the status on this being merged? |
I like this as well. In the end if it is an invalid token then it will fail when trying to authenticate and a warning will provide the feedback necessary to double check the format. Unless I am missing something I'm not sure a process-killing error just based on length is necessary. |
caddy-dns/cloudflareプラグインがcfut_プレフィックスのトークンを 不正と判断するバグを修正するため、PR #123のコミットを指定してビルドする 参考: caddy-dns/cloudflare#123 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: cfut_プレフィックスのCloudflare APIトークンに対応 caddy-dns/cloudflareプラグインがcfut_プレフィックスのトークンを 不正と判断するバグを修正するため、PR #123のコミットを指定してビルドする 参考: caddy-dns/cloudflare#123 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * fix: Dockerfile.caddy にARGを追加しコミットSHAの出典を明記 - ARG CLOUDFLARE_DNS_CLOUDFLARE_REF でコミットSHAを変数化 - コメントで出典(公式リポジトリの未マージPR digitaldemocracy2030#123)・内容・暫定理由を明記 - コミットSHA自体は公式リポジトリでHTTP 200確認済み Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@ItzDabbzz I'm using this in the meantime while I wait for this to be merged. Hope it helps you too. xcaddy build \
--with github.com/caddy-dns/cloudflare=github.com/ogerman/cloudflare@master |
|
@mholt thought you might want to know about this one - currently all new Cloudflare tokens are failing with caddy due to the new format. Fix in this PR is just a simple update to the format check. We've tested it and it seems to be working fine. |
+1 +1 +1 Maybe don't validate formats you don't own? |
I agree with you, but it’s possible this was designed with security in mind. Since these tokens originate from userland, blindly passing arbitrary strings through the code could introduce vulnerabilities. |
|
Thanks for the ping. Did Cloudflare just break every API client out there?? Any link to the change? |
|
We could just remove the validation if they can just change it instantly like that and break everything. The validation was deemed necessary after too many people had erroneous configs where their tokens weren't being set properly in the environment or whatever else, because Cloudflare's error messages were so bad, I think even misleading IIRC. The validation made it obvious and "proved" that it wasn't a problem with this code, it was something on their end, and was to compensate for Cloudflare's terrible error messages. But again, if it's going to break people, and Cloudflare is just going to change formats out of the blue, we can just remove the validation and leave users on their own. |
I can not find any news / blog post from Cloudflare regarding the new format. I have generated some keys in the past couple of months and started noticing this change since last week. At first I thought I made a mistake because the keys were prefixed "cfat_". But as we've all seen these are actually keys in a new format. |
I found 0 news about the change, Although I did notice that their docs for the create-token page was last updated at Feb 9, 2026. Although from the looks of it, they are preparing to deprecate Global API Key's & Origin CA Key's and transfer to Account API Tokens as the preferred method. As their docs recently added the legacy and deprecated tags next to the titles in the sidebar. CA-Keys was updated recently Mar 19, 2026 |
mholt
left a comment
There was a problem hiding this comment.
Thanks; let's go with this for now. But I might want to remove the validation in the near future knowing that Cloudflare may change this at any time without warning. It will leave users hanging, though, unless Cloudflare fixes their error messages.
@mholt Perhaps we can present a warning as a middle ground? That way users aren't left hanging, but it also won't cause things to break if the format changes. |
|
We could try a warning, but my worry is that the eventual error from Cloudflare will overshadow the warning earlier in the logs. But you're right, it could be a good middle ground. (And the point of warnings is to warn you of future errors.) |
Cloudflare introduced new token formats (user cfut_…, account cfat_…) alongside the existing legacy tokens. This PR extends provisioning validation so those shapes are accepted