Skip to content

fix: don't omit zero ruleIndex#97

Merged
owenrumney merged 1 commit intoowenrumney:mainfrom
scribe-security:patch/missing-rule-index
Mar 27, 2025
Merged

fix: don't omit zero ruleIndex#97
owenrumney merged 1 commit intoowenrumney:mainfrom
scribe-security:patch/missing-rule-index

Conversation

@cppvik
Copy link
Copy Markdown
Contributor

@cppvik cppvik commented Mar 27, 2025

Hi @owenrumney,

I found another issue in v3 and a potential bug in the code generator you mentioned in #93.

The ruleIndex property of a result is currently omitted when empty, even though 0 is a valid value and should be included in the SARIF JSON. A quick fix is to remove the omitempty tag from the Result struct field, but in v2 this was addressed by changing the type from int (uint) to *int (*uint), ensuring the field is omitted only when truly unset.

Some SARIF integer fields also default to -1 and are omitted when 0, similar to ruleIndex. I haven't fully investigated whether the same fix should be applied to them, but I'm fairly sure about result.rank, as it can also be 0.

Let me know what you think!

Copy link
Copy Markdown
Owner

@owenrumney owenrumney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thanks, seems I can't push to your branch so I'll follow this with the wider fix to all int/float64 where there is a non-pointer val

Thanks again

@owenrumney owenrumney merged commit 055fb7d into owenrumney:main Mar 27, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants