Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(template): Message field not escaped in asff.tpl #7400

Closed
2 tasks
DmitriyLewen opened this issue Aug 27, 2024 Discussed in #7391 · 1 comment · Fixed by #7401
Closed
2 tasks

bug(template): Message field not escaped in asff.tpl #7400

DmitriyLewen opened this issue Aug 27, 2024 Discussed in #7391 · 1 comment · Fixed by #7401
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@DmitriyLewen
Copy link
Contributor

Discussed in #7391

Originally posted by aliaksxssv August 26, 2024

Description

ASFF report contains a Message field with double quotes inside the value. This makes using jq impossible as it causes error:

parse error: Invalid numeric literal at line XXXX, column XXXX

We need jq to adjust report before submitting to the AWS SecurityHub:

$ cat trivy_raw.asff | jq '.Findings' > trivy_sechub.asff

ASFF report snippet:

"ProductFields": { "Product Name": "Trivy" }, "Resources": [ { "Type": "Other", "Id": "templates/cronjob.yaml", "Partition": "aws", "Region": "", "Details": { "Other": { "Message": "container "helm-cronjob" of cronjob "helm-cronjob" in "default" namespace should specify a seccomp profile", "Filename": "templates/cronjob.yaml", "StartLine": "0", "EndLine": "0" } } } ], "RecordState": "ACTIVE"

Desired Behavior

escape function should be applied as it was done before for the Title field

"Message": "{{ escapeString .Message }}"

Actual Behavior

No escape function

"Message": "{{ .Message }}"

Reproduction Steps

just create trivy report using asff template

Target

None

Scanner

None

Output Format

None

Mode

None

Debug Output

n/a

Operating System

any

Version

0.54.1

Checklist

@DmitriyLewen DmitriyLewen added the kind/bug Categorizes issue or PR as related to a bug. label Aug 27, 2024
@DmitriyLewen DmitriyLewen self-assigned this Aug 27, 2024
@aquasecurity aquasecurity deleted a comment Aug 27, 2024
@aquasecurity aquasecurity deleted a comment Aug 27, 2024
@aquasecurity aquasecurity deleted a comment Aug 27, 2024
@DmitriyLewen
Copy link
Contributor Author

We usually use '.
But it looks like KSV104 uses ".
@simar7 @nikpivkin you might want to change that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant