Skip to content

Insufficient parameter validation in job_status method #1105

Description

@marc-vanderwal

When prodding around the JSON RPC API manually with curl, no clear error message is returned when the job_status method is called with a missing test_id parameter.

$ curl -s -H "Content-Type: application/json" -X POST \
    -d '{"jsonrpc": "2.0", "method": "test_progress", "params": {}, "id": "'`uuidgen`'"}' \
    http://localhost:5000/ | jq
{
  "result": null,
  "jsonrpc": "2.0",
  "id": "9c644caa-0a3c-45d9-8d25-e863c7cb4c44"
}

When a correct test/job ID is supplied, the behavior is correct:

$ curl -s -H "Content-Type: application/json" -X POST \
    -d '{"jsonrpc": "2.0", "method": "job_status", "params": {"test_id": "de1ccfc8308d05ec"}, "id": "'`uuidgen`'"}' \
    http://localhost:5000/ | jq
{
  "result": {
    "progress": 100
  },
  "id": "e83160e1-db7f-4027-9b43-7bb4024f1309",
  "jsonrpc": "2.0"
}

But no error is returned if the test_id parameter does not reference a valid job/test:

$ curl -s -H "Content-Type: application/json" -X POST \
    -d '{"jsonrpc": "2.0", "method": "job_status", "params": {"test_id": "definitelynonexistent"}, "id": "'`uuidgen`'"}' \
    http://localhost:5000/ | jq
{
  "result": {
    "progress": null
  },
  "jsonrpc": "2.0",
  "id": "77ae1f00-3e7e-4a9e-9541-4da69aff9505"
}

Metadata

Metadata

Labels

S-PRforIssueStatus: There is a PR that is meant to resolve the issueT-BugType: Bug in software or error in test case description

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions