Containers: an authorized_keys public_key with a space in its comment passes config validation, then wrangler deploy fails with a 400
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- cloud, typescript
Research direction
The authorized_keys check lives in packages/workers-utils/src/config/validation.ts, where it confirms the value starts with ssh-ed25519 but never counts the fields after it. Start by reading that function, then run the new cases in packages/workers-utils/tests/config/validation/normalize-and-validate-config.test.ts. Done means a key whose comment contains a space fails validation with an error naming containers.authorized_keys[n].public_key, while keys with no comment, a one-word comment, or a tab in the comment still pass.
Written by the indexing model from the issue text.
Description
What versions & operating system are you using?
System:
OS: macOS 27.2
CPU: (16) arm64 Apple M4 Max
Binaries:
Node: 24.22.1
pnpm: 12.16.1
npmPackages:
wrangler: 4.153.0 (used for the four deploys below)
Please provide a link to a minimal reproduction
That branch adds two tests to packages/workers-utils/tests/config/validation/normalize-and-validate-config.test.ts. On main the first one fails: the config check reports no error for the key below.
Config that reproduces it. Replace the shortened key with the .pub line from ssh-keygen -t ed25519 -C "my laptop":
{
"containers": [
{
"class_name": "MyContainer",
"image": "./Dockerfile",
"authorized_keys": [
{ "name": "laptop", "public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI... my laptop" }
]
}
]
}
Describe the Bug
An authorized_keys entry whose public_key comment contains a space (here my laptop, which is what ssh-keygen -C "my laptop" gives you) passes Wrangler's local config check, and wrangler deploy then fails with a 400 from the API. The error does not say which entry or field is wrong.
We checked this with one real ED25519 key deployed four times to a test Worker, changing only the comment:
- no comment: deployed
probe: deployedmy<TAB>probe(a tab, not a space): deployedmy probe: rejected, error below
Expected: Wrangler rejects the key before deploying, with an error that names containers.authorized_keys[n].public_key and says the comment must not contain spaces.
The check in packages/workers-utils/src/config/validation.ts confirms the value is a string starting with ssh-ed25519 but does not check how many fields follow. We have a five-line fix on the branch above: it reports a config error when the key splits into more than three space-separated fields, which matches the four results. Keys with no comment, a one-word comment or a tab in the comment are unchanged, and a second test covers those. trusted_user_ca_keys uses the same validator, so the check would apply there too; we did not test the API with CA keys.
Happy to open a PR from that branch if you'd like one.
Please provide any relevant error logs
Invalid input: Invalid Authorized Key format. Syntax is space-separated: keytype, base64-encoded key, comment(optional).
(400 from the API during wrangler deploy, for the my probe case.)
[!NOTE]
This issue was written by an AI agent: Claude (Anthropic), on behalf of tlq5l.
- Dominant language
- TypeScript
- Stars
- 4.7k
- Forks
- 1.6k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 257
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cloudflare/workers-sdk
-
bug feature:local-explorer
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
cloudflare/workers-sdk#16763 · 1 comment ·
Maintainers usually reply within 1 day
-
[workers-auth] Reject misleading Cloudflare Access 302 redirectsPossibly taken @akhil9tiet claimed this today. Openbug package:workers-auth
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cloudflare/workers-sdk#16755 · 2 comments ·
Maintainers usually reply within 1 day
-
wrangler preview: require an explicit previews block only when needed (empty {} should be implied)Openpackage:wrangler product:previews
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
cloudflare/workers-sdk#16754 · 1 comment ·
Maintainers usually reply within 1 day
-
bug feature:workers-assets package:deploy-helpers package:wrangler
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
cloudflare/workers-sdk#16713 · 1 comment ·
Maintainers usually reply within 1 day
-
bug package:vite-plugin
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
cloudflare/workers-sdk#16605 · 2 comments ·
Maintainers usually reply within 1 day
All issues in cloudflare/workers-sdk
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Yeraze/meshmonitor#6239 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
better-auth/better-auth#12292 · 1 reaction ·
Maintainers usually reply within 1 day
-
The sample email preview's ResizeObserver is never disconnected and keeps raising errors after leaving SettingsPossibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
area:ui bug effort:S priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Typo in WSL project description on Projects pagePossibly taken @akhil9tiet claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 75/100
microsoft/opensource.microsoft.com#1066 · 1 comment ·