Repository navigation
WKS-3614 - Escape worker API path elements and validate worker keys - #72
Merged
Merged
Conversation
vitaliil-jfrog
approved these changes
Nov 4, 2026
This branch is waiting to be deployed
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.
mainbranch.go vet ./....go fmt ./....What
Worker keys can no longer change which Platform endpoint a
jf workercommand calls.common.CallWorkerAPI, which builds every worker API URL, escapes each path element withurl.PathEscapeand rejects./..elements before sending anything. A key../x?ynow reaches/worker/api/v1/workers/..%2Fx%3Fy.common.ValidateWorkerKeyapplies the Workers service rule (platform-extensionworkerValidator.service.ts,assertWorkerKeyIsValid): 2 to 40 chars, starts with a letter,^[A-Za-z][A-Za-z0-9_\\-]+$, with the same messages. It runs on:ValidateManifest), which covers deploy, test-run, add-secret, add-property and edit-schedule;ExtractProjectAndKeyFromCommandContext), which covers undeploy, execute and show-execution-history.Why
The worker key, taken from
manifest.jsonor the command line, was joined into the request URL unescaped./,..,?and#in a key could send the user's bearer token to another path on the Platform host or tamper with the query string.Behaviour change
Keys the server would never accept are now rejected by the CLI before any request, e.g.
invalid worker key 'my.worker'. Every key the server accepts keeps working.Tests
TestValidateWorkerKey: length bounds, first letter, allowed characters, trailing newline.TestCallWorkerAPI_PathEscaping: checks the raw request line on anhttptestserver, including the..%2Fx%3Fycase;./..send no request.TestManifest_Validate,Test_extractProjectAndKeyFromCommandContextandTestRemoveCommand.--project-key.