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
I am trying to figure out an issue that I am having when it comes to getting the same results as I have on my Windows machine on my Linux machine. This first started when I cloned my work over to my Linux machine and noticed that one of my queries that works just fine on my Windows machine was failing. Some of my queries also have different results.
This leads me to think there is an issue with how the CodeQL dependencies are being resolved across my two machines. Since my Windows version is working, I decided to look into the logs.
What sticks out to me is that all the versions in the logs have -dev at the end of them. So they are not using what is in these two files. I am unsure why. Due to the queries running just fine, with the -dev. I updated my qlpack.yml to use those versions instead. So that now it is
So, to see if I could get it to work on Linux, I used the updated qlpack.yml on that machine and got this
# cat qlpack.yml
name: custom-codeql-queries
version: 0.0.1
library: false
warnOnImplicitThis: false
dependencies:
codeql/java-all: 6.1.1-dev
codeql/dataflow: 1.1.10-dev
codeql/mad: 1.0.16-dev
codeql/rangeanalysis: 1.0.16-dev
codeql/regex: 1.0.16-dev
codeql/threat-models: 1.0.16-dev
codeql/tutorial: 1.0.16-dev
codeql/typeflow: 1.0.16-dev
codeql/typetracking: 1.0.16-dev
codeql/util: 2.0.3-dev
codeql/xml: 1.0.16-dev
codeql/ssa: 1.0.16-dev
libraries:
- name: SensitiveInfo
path: /SensitiveInfo
dataExtensions:
- SensitiveInfo/*.yml
# codeql pack install
ERROR: No valid pack solution found:
Because 'custom-codeql-queries' depends on 'codeql/[email protected]', which does not match any available versions of 'codeql/typeflow', version solving failed.
(/app/codeql/codeql-custom-queries-java/qlpack.yml:1,1-1)
A fatal error occurred: A 'codeql pack resolve-dependencies' operation failed with error code 2
This is telling me that that dependence doesn't exist, which confuses me because they both have the same ql lib files from the tree at the beginning of this post.
For reference, this query works fine on my Windows machine
/** * @name CWE-204: Observable discrepancies in sensitive error messages * @description Detects if statements within sensitive contexts that produce different error messages based on conditional branches, which could lead to observable discrepancies. * @kind problem * @problem.severity warning * @id java/error-message-discrepancies/204 * @tags security * external/cwe/cwe-204 * @cwe CWE-204 */import java
import semmle.code.java.dataflow.FlowSources
import semmle.code.java.security.SensitiveActions
import semmle.code.java.controlflow.Guards
// Class for String literals potentially used in observable discrepanciesclassSensitiveMessageLiteralextendsStringLiteral{SensitiveMessageLiteral(){this.getValue().regexpMatch(".*(Login Successful|Invalid password|Invalid username|Access (Granted|Denied)|Verification (Successful|Failed)|Authentication (Successful|Failed)|User not found|Password cannot be empty|Username cannot be empty|Input cannot be null|Input cannot be empty|'admin' is a reserved keyword|Verification Successful: Email found in system|Verification Failed: Email not registered|Access Granted: Admin has full access|Access Granted: User can access public files|Access Denied: User cannot access private files|Access Denied: Unknown role|Download Authorized|Download Denied: Insufficient privileges|Authentication Successful: Device recognized|Authentication Failed: Device not recognized in local network|Authentication Failed: Unknown device).*")}}fromIfStmtouterIf,IfStmtinnerIf,SensitiveMessageLiteralinnerVal,SensitiveMessageLiteralouterValwhere// Check if the innerIf is directly within the body of outerIfouterIf.getAChild*()=innerIfand// Check for specific message literals in the then and else branches of the inner if-statement and the else branch of the outer if-statementinnerIf.getElse().getBasicBlock().getANode().asExpr()=innerValandouterIf.getElse().getBasicBlock().getANode().asExpr()=outerValand// Ensure the innerIf and outerIf are not the sameinnerVal.getValue()!=outerVal.getValue()selectouterIf.getBasicBlock(),"CWE-204: Observable discrepancies due to different error messages in nested if-statements."
However, I get this on the Linux one ERROR: asExpr() cannot be resolved for type ControlFlowGraph::ControlFlowNode (/app/codeql/codeql-custom-queries-java/CWE-204/cwe204-nested-condition.ql:29,49-55)
I am thinking that because my Windows machine was my main development machine, that might be why things are different. As I have upgraded versions over time. I would appreciate any help with this, as getting the dependices for CodeQL correct is not my string suite. I can also send the full logs if that is needed as well. Thank you.
The text was updated successfully, but these errors were encountered:
These are the same across both machines
Codeql CLI Version: 2.20.3
Local Codeql Files: e27d8c16729588259f8143c7ed4569d517b0de10
Hello,
I am trying to figure out an issue that I am having when it comes to getting the same results as I have on my Windows machine on my Linux machine. This first started when I cloned my work over to my Linux machine and noticed that one of my queries that works just fine on my Windows machine was failing. Some of my queries also have different results.
This leads me to think there is an issue with how the CodeQL dependencies are being resolved across my two machines. Since my Windows version is working, I decided to look into the logs.
This is what I see
Now here is my
qlpack.yml
located atcodeql/codeql-custom-queries-java/qlpack.yml
Here is also my
codeql-pack.lock.yml
What sticks out to me is that all the versions in the logs have -dev at the end of them. So they are not using what is in these two files. I am unsure why. Due to the queries running just fine, with the -dev. I updated my
qlpack.yml
to use those versions instead. So that now it isHowever, when I do
codeql pack install
mycodeql-pack.lock.yml
becomesI believe this indicates that those versions can't be found.
For reference, here is what my Linux machine outputs
So, to see if I could get it to work on Linux, I used the updated
qlpack.yml
on that machine and got thisThis is telling me that that dependence doesn't exist, which confuses me because they both have the same ql lib files from the tree at the beginning of this post.
For reference, this query works fine on my Windows machine
However, I get this on the Linux one
ERROR: asExpr() cannot be resolved for type ControlFlowGraph::ControlFlowNode (/app/codeql/codeql-custom-queries-java/CWE-204/cwe204-nested-condition.ql:29,49-55)
I am thinking that because my Windows machine was my main development machine, that might be why things are different. As I have upgraded versions over time. I would appreciate any help with this, as getting the dependices for CodeQL correct is not my string suite. I can also send the full logs if that is needed as well. Thank you.
The text was updated successfully, but these errors were encountered: