Skip to content

Commit 3155771

Browse files
committed
Rename empty-string sanitizer to reflect what it actually does.
1 parent bfbc1d4 commit 3155771

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

go/ql/src/experimental/CWE-321/HardcodedKeysLib.qll

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,15 @@ module HardcodedKeys {
165165
}
166166
}
167167

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() {
171177
exists(ReturnStmt r, DataFlow::CallNode c |
172178
c.getTarget().hasQualifiedName("errors", "New") and
173179
r.getNumChild() > 1 and

0 commit comments

Comments
 (0)