mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Reduce FPs in IncorrectPrivilegeAssignment.ql
Implements suggestions from https://github.com/github/codeql/pull/6949#issuecomment-976482965
This commit is contained in:
committed by
GitHub
parent
be0c26f83d
commit
92f5a5f893
@@ -53,7 +53,13 @@ where
|
||||
fctmp.getTarget().hasGlobalOrStdName("fopen") or
|
||||
fctmp.getTarget().hasGlobalOrStdName("open")
|
||||
) and
|
||||
not fctmp.getArgument(1).getValue().matches("r%") and
|
||||
(
|
||||
fctmp.getArgument(1).getValue().matches("%a%") or
|
||||
// unfortunately cannot use numeric value here because // O_APPEND is defined differently on different OSes:
|
||||
// https://github.com/red/red/blob/92feb0c0d5f91e087ab35fface6906afbf99b603/runtime/definitions.reds#L477-L491
|
||||
// this may introduce false negatives
|
||||
fctmp.getArgument(1).getValueText().matches("%O_APPEND%")
|
||||
) and
|
||||
fctmp.getNumberOfArguments() = 2 and
|
||||
not fctmp.getArgument(0).getValue() = "/dev/null" and
|
||||
fcsnd = fctmp
|
||||
|
||||
Reference in New Issue
Block a user