Send scanner findings into a register
Turn each issue a scanner reports into a row of a list register, once, however often the scanner runs.
What you'll do
After each scan, send every issue the scanner reports into a list register, one row per issue. An issue already sent is never added again.
Before you start
- A list register for the issues, with the columns Issue, Severity, Asset and Scanner id. The names are examples; match them to your register.
- An API key with
registers:rows:add. See Create and manage API keys. - The scanner saves its results as JSON, and
curlandjqare installed where it runs.
Steps
- Open the issues register in Alchex and note its name and column names.
- Save this script as send-issues.sh where the scanner runs. Change the field names after
.to match your scanner's JSON.
- Run it once by hand after a scan.
- Open the register in Alchex and check one row per issue.
- Add the same command as the last step of your scanner's scheduled job.
What happens next
Each new issue answers 201 with its rowIds. An issue sent before answers 200 with "replayed": true, because its Idempotency-Key is the scanner's own id for it. The rows count at once, under the key's name.
The script sends one request per issue. A key may make 60 a minute; --retry makes curl wait and try again when it is told to slow down.
If something goes wrong
400 unknown_field. A name under cells is not a column of the register. The message lists the columns.
A choice column stays empty. The scanner's value is not one of the column's choices. Add the choice in Alchex, or map the value in the script.
402 AI_ALLOWANCE_EXCEEDED. The workspace has no AI credit left. See Add AI credit.