-
Notifications
You must be signed in to change notification settings - Fork 68
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
Feat: allow suppression of rules from the reports page #4623
base: main
Are you sure you want to change the base?
Conversation
@sknep will you run |
hmm... I don't really want folks to be able to suppress without fully understanding the finding. Also that spot is already kind of busy/full, and keeping these reports scannable is important to me. But what do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of having this alongside the rule (not in the top summary) and we can test out whether folks notice/use it in the future. I think maybe it could be more noticable but 🤷 . It looks like the suppression toggle logic has 2 issues:
- I think it's reversed because of some react hook "stuff" going on
- If a user removes a suppression that had a
match
property, that would be removed when trying to re-enable it (maybe that's okay, we should just note)
api/controllers/build-task.js
Outdated
|
||
const type = appMatch(task.BuildTaskType); | ||
|
||
const fullJSON = { | ||
...taskJSON, report, type, siteId: task.Build.Site.id, | ||
...taskJSON, report, type, siteId: task.Build.Site.id, siteBuildTaskId: task.SiteBuildTask.id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
siteBuildTaskId
doesn't need to be added here now that it's been added to the serializer/json/include
const [customerRules, setCustomerRules] = useState(sbtCustomRules); | ||
const willBeSuppressed = customerRules.find(r => r.id === ruleId); | ||
|
||
useEffect(() => { | ||
setCustomerRules(sbtCustomRules); | ||
}, [sbtCustomRules]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm caveating this comment by saying we should probably investigate swapping in a consistent querying library like react-query
because I've also lost the plot a little on hook re-rending logic. But I think this might be the block that is causing you issues: I don't know that you need a useEffect
call because sbtCustomRules
are used to initialize the local state already. And they shouldn't change since we aren't refetching the report while on this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So i deleted the useEffect, but I am not sure that the set state for customer rules is working... it seems to issue at the same time as the update function, so I just passed in the new array as a param instead. Is that bad? I feel like it needs a promise somewhere, but I haven't seen a pattern like that in how we manage updates
ab8b159
to
786430f
Compare
786430f
to
3a29282
Compare
Changes proposed in this pull request:
Adds report suppression information to each finding
Allows the user to add or delete rules using the given rule id for each finding.
Cleans up use of "scanType" now that we have sbt, which has an id and a type
security considerations
none