Skip to content

Commit

Permalink
fix: stop SeveritySlider from crashing if severity is null.
Browse files Browse the repository at this point in the history
Migrates existing null severity threats to 'low'. While it shouldn't be set if action_item is not marked, null severity is still allowed, but it will be treated as if set to 'low'.
  • Loading branch information
Tethik committed Nov 14, 2023
1 parent 49a2a6c commit 25f7654
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/src/components/model/modals/SeveritySlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function SeveritySlider({ severity, onChange, ...props }) {
onChangeCommitted={(value) => {
onChange(value);
}}
value={severity}
value={severity || "low"} // Default to low in the odd case where we get a null severity value, allowed by backend.
{...props}
/>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
UPDATE threats
SET severity = 'low' WHERE is_action_item = true and severity = null;

0 comments on commit 25f7654

Please sign in to comment.