Repository navigation
Check the format of job IDs that go into request paths (GEO-5413) - #9
Merged
Merged
Conversation
Get a batch, Cancel a batch, Get a crawl, Cancel a crawl and Get an extraction job put the Job ID straight into the request path, so a value like ../statistics reached another API route, and for the cancel modules that was a DELETE. The Job ID field now accepts only letters, digits, - and _, so Make rejects such a value before the request. Real job IDs are UUIDs and still pass.
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.
Refs GEO-5413
Done when: "../statistics" in a Get status module is rejected by Make in the private app
Summary
Review finding before submission: five modules put the Job ID straight into the request path (
/batch/{{parameters.job_id}},/crawl/...,/extract/...). A value like../statisticsreached another API route; for Cancel a batch and Cancel a crawl that was a DELETE. The risk is low (the user's own key and data), but the field should not allow it.The
job_idfield in Get a batch, Cancel a batch, Get a crawl, Cancel a crawl and Get an extraction job now has"validate": { "pattern": "^[A-Za-z0-9_-]+$" }, the same syntax as the proxy country field. Real job IDs are UUIDs such as01a21393-fafa-75e6-a79a-df792e21ccaband still pass. The job ID filter in Search extraction jobs goes into the query string, not the path, so it is unchanged.Tests
test_job_ids_in_paths_are_checked: finds every module whose request path uses{{parameters.job_id}}(5), and checks that its pattern accepts a real job ID and rejects../statistics,a/b,a?b,a#band an empty value.test_client_header,test_publish_safety,test_review_rules: OK. 86 app files parse as JSON.After merge
dry_rununticked to update the private app.../statisticsand run that module: Make should reject the value. Then put the mapping back.