File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
go/ql/src/experimental/CWE-321 Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -165,9 +165,15 @@ module HardcodedKeys {
165
165
}
166
166
}
167
167
168
- /** Mark an empty string returned with an error as a sanitizer */
169
- private class EmptyErrorSanitizer extends Sanitizer {
170
- EmptyErrorSanitizer ( ) {
168
+ /**
169
+ * Marks anything returned with an error as a sanitized.
170
+ *
171
+ * Typically this means contexts like `return "", errors.New("Oh no")`,
172
+ * where we can be reasonably confident downstream users won't mistake
173
+ * that empty string for a usable key.
174
+ */
175
+ private class ReturnedAlongsideErrorSanitizer extends Sanitizer {
176
+ ReturnedAlongsideErrorSanitizer ( ) {
171
177
exists ( ReturnStmt r , DataFlow:: CallNode c |
172
178
c .getTarget ( ) .hasQualifiedName ( "errors" , "New" ) and
173
179
r .getNumChild ( ) > 1 and
You can’t perform that action at this time.
0 commit comments