You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix risk-accepted findings not being closed when vulnerability is fixed (#14125)
Fixes#10769
When a finding is risk-accepted and the underlying vulnerability is subsequently fixed (no longer appears in scan reports), the import/reimport process was failing to properly close these findings. This occurred because:
1. DefaultImporter.close_old_findings() only queried for active=True findings, missing risk-accepted findings which have active=False
2. BaseImporter.mitigate_finding() did not remove the risk_accepted status when closing findings
Changes:
- Modified DefaultImporter.close_old_findings() to include risk-accepted findings in the query (Q(active=True) | Q(risk_accepted=True))
- Added risk_unaccept() call in BaseImporter.mitigate_finding() to remove risk acceptance when findings are closed
- Added comprehensive unit tests covering both scenarios:
* Risk-accepted findings that are no longer in scan reports (should be closed and risk acceptance removed)
* Risk-accepted findings that are still in scan reports (should remain risk-accepted)
The fix ensures that when a previously risk-accepted vulnerability is genuinely fixed, the finding status accurately reflects this by being mitigated and having the risk acceptance removed.
<desc>A cookie has been set without the secure flag, which means that the cookie can be accessed via unencrypted connections.</desc>
10
+
<instances>
11
+
<instance>
12
+
<uri>https://mainsite.com/dashboard</uri>
13
+
<method>GET</method>
14
+
<param>opvc</param>
15
+
<evidence>Set-Cookie: opvc</evidence>
16
+
</instance>
17
+
<instance>
18
+
<uri>https://mainsite.com/dashboard</uri>
19
+
<method>GET</method>
20
+
<param>dmid</param>
21
+
<evidence>Set-Cookie: dmid</evidence>
22
+
</instance>
23
+
<instance>
24
+
<uri>https://mainsite.com</uri>
25
+
<method>GET</method>
26
+
<param>sitevisitscookie</param>
27
+
<evidence>Set-Cookie: sitevisitscookie</evidence>
28
+
</instance>
29
+
</instances>
30
+
<count>3</count>
31
+
<solution>Whenever a cookie contains sensitive information or is a session token, then it should always be passed using an encrypted channel. Ensure that the secure flag is set for cookies containing such sensitive information.</solution>
<alert>zap2: Cookie Without SameSite Attribute</alert>
40
+
<name>Cookie Without SameSite Attribute</name>
41
+
<riskcode>1</riskcode>
42
+
<confidence>2</confidence>
43
+
<riskdesc>Low (Medium)</riskdesc>
44
+
<desc>A cookie has been set without the SameSite attribute, which means that the cookie can be sent as a result of a 'cross-site' request. The SameSite attribute is an effective counter measure to cross-site request forgery, cross-site script inclusion, and timing attacks.</desc>
45
+
<instances>
46
+
<instance>
47
+
<uri>https://mainsite.com</uri>
48
+
<method>GET</method>
49
+
<param>sitevisitscookie</param>
50
+
<evidence>Set-Cookie: sitevisitscookie</evidence>
51
+
</instance>
52
+
<instance>
53
+
<uri>https://mainsite.com/dashboard</uri>
54
+
<method>GET</method>
55
+
<param>dmid</param>
56
+
<evidence>Set-Cookie: dmid</evidence>
57
+
</instance>
58
+
<instance>
59
+
<uri>https://mainsite.com</uri>
60
+
<method>GET</method>
61
+
<param>JSESSIONID</param>
62
+
<evidence>Set-Cookie: JSESSIONID</evidence>
63
+
</instance>
64
+
<instance>
65
+
<uri>https://mainsite.com/dashboard</uri>
66
+
<method>GET</method>
67
+
<param>opvc</param>
68
+
<evidence>Set-Cookie: opvc</evidence>
69
+
</instance>
70
+
</instances>
71
+
<count>4</count>
72
+
<solution>Ensure that the SameSite attribute is set to either 'lax' or ideally 'strict' for all cookies.</solution>
<solution>Ensure that your web server, application server, load balancer, etc. is properly configured to set the Content-Security-Policy header.</solution>
<desc>A cookie has been set without the HttpOnly flag, which means that the cookie can be accessed by JavaScript. If a malicious script can be run on this page then the cookie will be accessible and can be transmitted to another site. If this is a session cookie then session hijacking may be possible.</desc>
109
+
<instances>
110
+
<instance>
111
+
<uri>https://mainsite.com</uri>
112
+
<method>GET</method>
113
+
<param>opvc</param>
114
+
<evidence>Set-Cookie: opvc</evidence>
115
+
</instance>
116
+
<instance>
117
+
<uri>https://mainsite.com</uri>
118
+
<method>GET</method>
119
+
<param>dmid</param>
120
+
<evidence>Set-Cookie: dmid</evidence>
121
+
</instance>
122
+
<instance>
123
+
<uri>https://mainsite.com</uri>
124
+
<method>GET</method>
125
+
<param>sitevisitscookie</param>
126
+
<evidence>Set-Cookie: sitevisitscookie</evidence>
127
+
</instance>
128
+
</instances>
129
+
<count>3</count>
130
+
<solution>Ensure that the HttpOnly flag is set for all cookies.</solution>
<desc>A timestamp was disclosed by the application/web server - Unix</desc>
144
+
<instances>
145
+
<instance>
146
+
<uri>https://mainsite.com</uri>
147
+
<method>GET</method>
148
+
<evidence>265151019</evidence>
149
+
</instance>
150
+
<instance>
151
+
<uri>https://mainsite.com</uri>
152
+
<method>GET</method>
153
+
<evidence>398525181</evidence>
154
+
</instance>
155
+
<instance>
156
+
<uri>https://mainsite.com</uri>
157
+
<method>GET</method>
158
+
<evidence>153792000</evidence>
159
+
</instance>
160
+
<instance>
161
+
<uri>https://mainsite.com/dashboard</uri>
162
+
<method>GET</method>
163
+
<evidence>1028274645</evidence>
164
+
</instance>
165
+
</instances>
166
+
<count>4</count>
167
+
<solution>Manually confirm that the timestamp data is not sensitive, and that the data cannot be aggregated to disclose exploitable patterns.</solution>
168
+
<otherinfo>265151019, which evaluates to: 1978-05-27 22:03:39</otherinfo>
0 commit comments