Skip to content

Commit 55ba842

Browse files
committed
Fix some violations of ql/could-be-cast.
1 parent 4df95b7 commit 55ba842

File tree

6 files changed

+13
-17
lines changed

6 files changed

+13
-17
lines changed

actions/ql/src/experimental/Security/CWE-829/ArtifactPoisoningPathTraversal.ql

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ where
3737
)
3838
or
3939
// upload artifact is not used in the same workflow
40-
not exists(UsesStep upload |
41-
download.getEnclosingWorkflow().getAJob().(LocalJob).getAStep() = upload
42-
)
40+
not download.getEnclosingWorkflow().getAJob().(LocalJob).getAStep() instanceof UsesStep
4341
)
4442
select download, "Potential artifact poisoning"

cpp/ql/src/experimental/Security/CWE/CWE-416/UseAfterExpiredLifetime.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ class LifetimePointerType extends LifetimeIndirectionType {
266266
class FullExpr extends Expr {
267267
FullExpr() {
268268
// A full-expression is not a subexpression
269-
not exists(Expr p | this.getParent() = p)
269+
not this.getParent() instanceof Expr
270270
or
271271
// A sub-expression that is an unevaluated operand
272272
this.isUnevaluated()

cpp/ql/src/jsf/4.10 Classes/AV Rule 96.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ where
2828
exists(FunctionCall c, int i, Function f |
2929
c.getArgument(i) = e and
3030
c.getTarget() = f and
31-
exists(Parameter p | f.getParameter(i) = p) and // varargs
31+
exists(f.getParameter(i)) and // varargs
3232
baseElement(e.getType(), cl) and // only interested in arrays with classes
3333
not compatible(f.getParameter(i).getUnspecifiedType(), e.getUnspecifiedType())
3434
)

csharp/ql/src/Telemetry/DatabaseQuality.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module CallTargetStats implements StatsSig {
1212
private predicate isNoSetterPropertyCallInConstructor(PropertyCall c) {
1313
exists(Property p, Constructor ctor |
1414
p = c.getProperty() and
15-
not exists(Setter a | a = p.getAnAccessor()) and
15+
not p.getAnAccessor() instanceof Setter and
1616
c.getEnclosingCallable() = ctor and
1717
(
1818
c.hasThisQualifier()
@@ -25,7 +25,7 @@ module CallTargetStats implements StatsSig {
2525
private predicate isNoSetterPropertyInitialization(PropertyCall c) {
2626
exists(Property p, AssignExpr assign |
2727
p = c.getProperty() and
28-
not exists(Setter a | a = p.getAnAccessor()) and
28+
not p.getAnAccessor() instanceof Setter and
2929
assign = c.getParent() and
3030
assign.getLValue() = c and
3131
assign.getParent() instanceof Property

java/ql/src/experimental/quantum/Analysis/ArtifactReuse.qll

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ import experimental.quantum.Language
1010
*/
1111
private module WrapperConfig implements DataFlow::ConfigSig {
1212
predicate isSource(DataFlow::Node source) {
13-
exists(Call c |
14-
c = source.asExpr()
15-
// not handling references yet, I think we want to flat say references are only ok
16-
// if I know the source, otherwise, it has to be through an additional flow step, which
17-
// we filter as a source, i.e., references are only allowed as sources only,
18-
// no inferrece? Not sure if that would work
19-
//or
20-
// source.(DataFlow::PostUpdateNode).getPreUpdateNode().asExpr() = c.getAnArgument()
21-
) and
13+
source.asExpr() instanceof Call and
14+
// not handling references yet, I think we want to flat say references are only ok
15+
// if I know the source, otherwise, it has to be through an additional flow step, which
16+
// we filter as a source, i.e., references are only allowed as sources only,
17+
// no inferrece? Not sure if that would work
18+
//or
19+
// source.(DataFlow::PostUpdateNode).getPreUpdateNode().asExpr() = c.getAnArgument()
2220
// Filter out sources that are known additional flow steps, as these are likely not the
2321
// kind of wrapper source we are looking for.
2422
not exists(AdditionalFlowInputStep s | s.getOutput() = source)

python/ql/src/experimental/Security/CWE-022bis/TarSlipImprov.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private module TarSlipImprovConfig implements DataFlow::ConfigSig {
6363
// For a call to `file.extractall` without `members` argument, `file` is considered a sink.
6464
exists(MethodCallNode call, AllTarfileOpens atfo |
6565
call = atfo.getReturn().getMember("extractall").getACall() and
66-
not exists(Node arg | arg = call.getArgByName("members")) and
66+
not exists(call.getArgByName("members")) and
6767
sink = call.getObject()
6868
)
6969
or

0 commit comments

Comments
 (0)