django-DefectDojo icon indicating copy to clipboard operation
django-DefectDojo copied to clipboard

Finding verification through the API

Open stateandprove opened this issue 5 years ago • 4 comments

Is your feature request related to a problem? Please describe I have an active unverified finding. I'm trying to verify it using the PATCH request with payload {verified: True} to /api/v2/findings/{id}/, but getting the {"detail": "Not Found."} response.

Describe the solution you'd like I'd like to verify an active finding by sending PATCH request to /api/v2/findings/{id}/.

Describe alternatives you've considered n/a

Additional context n/a

stateandprove avatar Sep 09 '21 13:09 stateandprove

+1

sarosbacz avatar Sep 09 '21 13:09 sarosbacz

Can you provide more details and logs maybe. It works fine for me on latest dev:

curl -X 'PATCH' \
  'http://defectdojo-dev:8000/api/v2/findings/2810/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'X-CSRFToken: K0beO90HOsxzMa9PQp36D3kx5BXriruGlmkcNJzBYIDAolKy3K9gMnC3ijzZwO7t' \
  -d '{
  "verified": true
}'

{
  "id": 2810,
  "tags": [],
  "request_response": {
    "req_resp": []
  },
  "accepted_risks": [],
  "age": 892,
  "sla_days_remaining": -772,
  "finding_meta": [],
  "related_fields": null,
  "jira_creation": null,
  "jira_change": "2021-03-15T08:17:29.766348Z",
  "display_status": "Active, Verified",
  "finding_groups": [],
  "title": "Regular Expression Denial of Service - (Braces, <2.3.1)",
  "date": "2019-04-01",
  "sla_start_date": null,
  "cwe": 185,
  "cve": null,
  "cvssv3": null,
  "cvssv3_score": null,
  "url": "No url given",
  "severity": "Low",
  "description": "Version of `braces` prior to 2.3.1 are vulnerable to Regular Expression Denial of Service (ReDoS). Untrusted input may cause catastrophic backtracking while matching regular expressions. This can cause the application to be unresponsive leading to Denial of Service.\r\n Vulnerable Module: braces\r\n Vulnerable Versions: <2.3.1\r\n Patched Version: >=2.3.1\r\n Vulnerable Path: [u'braces']\r\n CWE: CWE-185\r\n Access: public",
  "mitigation": "Upgrade to version 2.3.1 or higher.",
  "impact": "No impact provided",
  "steps_to_reproduce": "",
  "severity_justification": "",
  "references": "https://npmjs.com/advisories/786",
  "is_template": false,
  "active": true,
  "verified": true,
  "false_p": false,
  "duplicate": false,
  "out_of_scope": false,
  "risk_accepted": false,
  "under_review": false,
  "last_status_update": "2019-04-04T15:36:22.479000+02:00",
  "under_defect_review": false,
  "is_mitigated": false,
  "thread_id": 0,
  "mitigated": null,
  "numerical_severity": "S3",
  "last_reviewed": "2019-04-04T15:36:22.479000+02:00",
  "line_number": null,
  "sourcefilepath": null,
  "sourcefile": null,
  "param": null,
  "payload": null,
  "hash_code": "d0d757dee8913d74ce12a1d4b0f85f5202c4ecc75aae9a28946b6f8a9a09349c",
  "line": null,
  "file_path": null,
  "component_name": null,
  "component_version": null,
  "static_finding": false,
  "dynamic_finding": true,
  "created": "2019-04-01T17:32:27.146000+02:00",
  "scanner_confidence": null,
  "unique_id_from_tool": null,
  "vuln_id_from_tool": null,
  "sast_source_object": null,
  "sast_sink_object": null,
  "sast_source_line": null,
  "sast_source_file_path": null,
  "nb_occurences": null,
  "publish_date": null,
  "test": 368,
  "duplicate_finding": null,
  "review_requested_by": null,
  "defect_review_requested_by": null,
  "mitigated_by": null,
  "reporter": 1,
  "last_reviewed_by": 5,
  "sonarqube_issue": null,
  "endpoints": [],
  "endpoint_status": [],
  "reviewers": [],
  "notes": [],
  "files": [],
  "found_by": [
    3
  ]
}

valentijnscholten avatar Sep 09 '21 20:09 valentijnscholten

We also have a unit test for Finding PATCH: https://github.com/valentijnscholten/django-DefectDojo/blob/66f5b7fae187b2607b8ddc841dea728df1ea7845/dojo/unittests/test_rest_framework.py#L764

valentijnscholten avatar Sep 09 '21 20:09 valentijnscholten

closing, no response and unable to reproduce without more information.

valentijnscholten avatar Sep 27 '21 15:09 valentijnscholten