Skip to content

Commit e194899

Browse files
author
Alvaro Muñoz
authored
Merge branch 'main' into improve_uricheck_java_query
2 parents 8837b3b + a183c21 commit e194899

File tree

89 files changed

+230
-122
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+230
-122
lines changed

README.md

Lines changed: 3 additions & 0 deletions
File renamed without changes.

cpp/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
library: false
22
name: githubsecuritylab/codeql-cpp-queries
3-
version: 0.0.2
3+
version: 0.0.3
44
suites: suites
55
defaultSuiteFile: suites/cpp.qls
66
dependencies:

cpp/src/suites/cpp.qls

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1-
- description: "GitHub's Community Packs Ruby Extended Suite"
1+
- description: "GitHub's Community Packs C/C++ Extended Suite"
22

3-
- qlpack: github-queries-ruby
3+
- queries: '.'
4+
from: githubsecuritylab/codeql-cpp-queries
45

5-
- import: codeql-suites/ruby-security-extended.qls
6-
from: codeql/ruby-queries
6+
- include:
7+
kind:
8+
- problem
9+
- path-problem
10+
precision:
11+
- very-high
12+
- high
13+
- medium
14+
- low
15+
16+
# Remove debugging, and audit queries
17+
- exclude:
18+
tags contain:
19+
- debugging
20+
- audit
21+
22+
# Remove local testing folders
723
- exclude:
8-
id:
9-
- rb/hardcoded-credentials
24+
query path:
25+
- /testing\/.*/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
lockVersion: 1.0.0
3+
dependencies: {}
4+
compiled: false

csharp/ext/codeql-pack.lock.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
lockVersion: 1.0.0
3+
dependencies: {}
4+
compiled: false
File renamed without changes.
File renamed without changes.

csharp/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
library: false
22
name: githubsecuritylab/codeql-csharp-queries
3-
version: 0.0.2
3+
version: 0.0.3
44
suites: suites
55
defaultSuiteFile: suites/csharp.qls
66
dependencies:

csharp/src/security/CWE-760/HardcodedSalt.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import csharp
1414
private import semmle.code.csharp.frameworks.Moq
1515
private import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
1616
// import semmle.code.csharp.frameworks.system.security.Cryptography
17-
private import github.Hardcoded
18-
private import github.Cryptography
17+
private import ghsl.Hardcoded
18+
private import ghsl.Cryptography
1919

2020
module HardcodedSalt {
2121
abstract class Source extends DataFlow::ExprNode { }

csharp/src/security/CWE-798/HardcodedCredentialsSymmetricSecurityKey.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import csharp
1616
private import DataFlow::PathGraph
17-
private import github.HardcodedCredentials
17+
private import ghsl.HardcodedCredentials
1818

1919
from DataFlow::PathNode source, DataFlow::PathNode sink, LiteralToSecurityKeyConfig config
2020
where config.hasFlowPath(source, sink)

csharp/src/suites/csharp.qls

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
- description: "GitHub's Community Packs CSharp Extended Suite"
22

33
- queries: '.'
4-
from: githubsecuritylab/codeql-csharp
4+
from: githubsecuritylab/codeql-csharp-queries
55

66
- include:
77
kind:
88
- problem
99
- path-problem
10-
- metric
11-
- diagnostic
1210
precision:
1311
- very-high
1412
- high
File renamed without changes.
File renamed without changes.

go/src/audit/CWE-089/SqlInjectionAudit.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import go
1515
import semmle.go.security.SqlInjection
1616
import DataFlow::PathGraph
17-
import github.Utils
17+
import ghsl.Utils
1818

1919
/**
2020
* A taint-tracking configuration for detecting SQL injection vulnerabilities.

go/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
library: false
22
name: githubsecuritylab/codeql-go-queries
3-
version: 0.0.2
3+
version: 0.0.3
44
suites: suites
55
defaultSuiteFile: suites/go.qls
66
dependencies:

go/src/security/CWE-078/CommandInjection.ql

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,27 @@
1313

1414
import go
1515
import semmle.go.security.CommandInjection
16-
import semmle.go.security.CommandInjectionCustomizations::CommandInjection
16+
import DataFlow::PathGraph
17+
import semmle.go.security.FlowSources
1718

1819
//Override CommandInjection::Configuration to use the in-use sources
19-
class InUseAsSource extends Source instanceof UntrustedFlowSource {
20-
InUseAsSource() {
20+
class InUseCommandInjectionConfiguration extends CommandInjection::Configuration {
21+
override predicate isSource(DataFlow::Node node) {
2122
exists(UntrustedFlowSource source, Function function, DataFlow::CallNode callNode |
22-
source.asExpr() = this.asExpr() and
23+
source.asExpr() = node.asExpr() and
24+
2325
source.(DataFlow::ExprNode).asExpr().getEnclosingFunction() = function.getFuncDecl() and
2426
(
2527
// function is called directly
2628
callNode.getACallee() = function.getFuncDecl()
27-
or
29+
2830
// function is passed to another function to be called
29-
callNode.getCall().getAnArgument().(Ident).refersTo(function) //NEW with 2.13.2: or c.getASyntacticArgument().asExpr().(Ident).refersTo(f)
30-
)
31+
or callNode.getCall().getAnArgument().(Ident).refersTo(function) //NEW with 2.13.2: or c.getASyntacticArgument().asExpr().(Ident).refersTo(f)
32+
)
3133
)
3234
}
3335
}
3436

35-
module Flow =
36-
DataFlow::MergePathGraph<CommandInjection::Flow::PathNode,
37-
CommandInjection::DoubleDashSanitizingFlow::PathNode, CommandInjection::Flow::PathGraph,
38-
CommandInjection::DoubleDashSanitizingFlow::PathGraph>;
39-
40-
import Flow::PathGraph
41-
42-
from Flow::PathNode source, Flow::PathNode sink
43-
where
44-
CommandInjection::Flow::flowPath(source.asPathNode1(), sink.asPathNode1()) or
45-
CommandInjection::DoubleDashSanitizingFlow::flowPath(source.asPathNode2(), sink.asPathNode2())
46-
select sink.getNode(), source, sink, "This command depends on a $@.", source.getNode(),
47-
"user-provided value"
37+
from InUseCommandInjectionConfiguration cfg, CommandInjection::DoubleDashSanitizingConfiguration cfg2, DataFlow::PathNode source, DataFlow::PathNode sink
38+
where (cfg.hasFlowPath(source, sink) or cfg2.hasFlowPath(source, sink))
39+
select sink.getNode(), source, sink, "This command depends on a $@.", source.getNode(), "user-provided value"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import go
2-
import github.Utils
2+
import ghsl.Utils
33

44
query predicate dynamicStrings(DataFlow::ExprNode node) { node instanceof DynamicStrings }
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
lockVersion: 1.0.0
3+
dependencies: {}
4+
compiled: false

java/ext/codeql-pack.lock.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
lockVersion: 1.0.0
3+
dependencies: {}
4+
compiled: false
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

java/src/CVEs/CVE-2022-22965.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import java
1212
import semmle.code.java.dataflow.FlowSources
1313
import Spring4ShellFlow::PathGraph
14-
import github.BeanManipulation
14+
import ghsl.BeanManipulation
1515

1616
private module Spring4ShellConfig implements DataFlow::ConfigSig {
1717
predicate isSource(DataFlow::Node source) {

java/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
library: false
22
name: githubsecuritylab/codeql-java-queries
3-
version: 0.0.2
3+
version: 0.0.3
44
suites: suites
55
defaultSuiteFile: suites/java.qls
66
dependencies:

java/src/security/CWE-078/CommandInjectionRuntimeExec.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313
import DataFlow::PathGraph
14-
import github.CommandInjectionRuntimeExec
14+
import ghsl.CommandInjectionRuntimeExec
1515

1616
class RemoteSource extends Source {
1717
RemoteSource() { this instanceof RemoteFlowSource }

java/src/security/CWE-078/CommandInjectionRuntimeExecLocal.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313

1414
import DataFlow::PathGraph
15-
import github.CommandInjectionRuntimeExec
15+
import ghsl.CommandInjectionRuntimeExec
1616

1717
class LocalSource extends Source {
1818
LocalSource() { this instanceof LocalUserInput }

java/src/security/CWE-078/CommandInjectionRuntimeExecTest.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* external/cwe/cwe-078
1313
*/
1414

15-
import github.CommandInjectionRuntimeExec
15+
import ghsl.CommandInjectionRuntimeExec
1616

1717
class DataSource extends Source {
1818
DataSource() { this instanceof RemoteFlowSource or this instanceof LocalUserInput }

java/src/security/CWE-078/CommandInjectionRuntimeExecTestPath.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414

1515
import DataFlow::PathGraph
16-
import github.CommandInjectionRuntimeExec
16+
import ghsl.CommandInjectionRuntimeExec
1717

1818
class DataSource extends Source {
1919
DataSource() { this instanceof RemoteFlowSource or this instanceof LocalUserInput }

java/src/security/CWE-326/Base64Encryption.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import semmle.code.java.dataflow.FlowSources
1717
import semmle.code.java.dataflow.TaintTracking2
1818
// import DataFlow::PathGraph
1919
// Internal
20-
import github.SensitiveInformation
20+
import ghsl.SensitiveInformation
2121

2222
class Base64Sinks extends DataFlow::Node {
2323
Base64Sinks() {

java/src/security/CWE-470/BeanManipulation.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import java
1414
import semmle.code.java.dataflow.FlowSources
1515
import BeanManipulationFlow::PathGraph
16-
import github.BeanManipulation
16+
import ghsl.BeanManipulation
1717

1818
private module BeanManipulationConfig implements DataFlow::ConfigSig {
1919
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }

java/src/security/CWE-532/SensitiveInformation.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import semmle.code.java.dataflow.FlowSources
1717
import semmle.code.java.dataflow.TaintTracking2
1818
//import DataFlow::PathGraph
1919
// Internal
20-
import github.Logging
21-
import github.SensitiveInformation
20+
import ghsl.Logging
21+
import ghsl.SensitiveInformation
2222

2323
module SensitiveInformationConfig implements DataFlow::ConfigSig {
2424
predicate isSource(DataFlow::Node source) { source instanceof SensitiveInformationSources }

java/src/security/CWE-611/XXELocal.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import semmle.code.java.security.XmlParsers
1818
import semmle.code.java.dataflow.FlowSources
1919
import semmle.code.java.dataflow.TaintTracking2
2020
//import DataFlow::PathGraph
21-
import github.LocalSources
21+
import ghsl.LocalSources
2222

2323
module SafeSAXSourceFlowConfig implements DataFlow::ConfigSig {
2424
predicate isSource(DataFlow::Node src) { src.asExpr() instanceof SafeSaxSource }

java/src/security/CWE-798/HardcodedBase64Usage.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import semmle.code.java.dataflow.FlowSources
1717
import semmle.code.java.dataflow.TaintTracking2
1818
import DataFlow::PathGraph
1919
// Internal
20-
import github.Encoding
21-
import github.Hardcoded
20+
import ghsl.Encoding
21+
import ghsl.Hardcoded
2222

2323
class HardcodedPasswordBase64 extends TaintTracking::Configuration {
2424
HardcodedPasswordBase64() { this = "HardcodedPasswordBase64" }

java/src/suites/java.qls

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
# https://codeql.github.com/docs/codeql-cli/creating-codeql-query-suites/
2-
31
- description: "GitHub's Community Packs Java/Kotlin Extended Suite"
42

53
- queries: '.'
6-
from: githubsecuritylab/java-queries
4+
from: githubsecuritylab/codeql-java-queries
75

8-
# GitHub's Community Packs Java/Kotlin Suite
96
- include:
107
kind:
118
- problem

java/test/security/CWE-798/base64/HardcodedBase64Usage.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import java
22
import semmle.code.java.security.HardcodedCredentials
3-
import github.Encoding
4-
import github.Hardcoded
3+
import ghsl.Encoding
4+
import ghsl.Hardcoded
55

66
query predicate sources(DataFlow::Node sources) {
77
sources instanceof Hardcoded

javascript/lib/github/InsecureIV.qll renamed to javascript/lib/ghsl/InsecureIV.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import semmle.javascript.dataflow.TaintTracking
22

3-
import github.CommandLine
3+
import ghsl.CommandLine
44

55
class RandomTaintsSourceConfiguration extends TaintTracking::Configuration {
66
RandomTaintsSourceConfiguration() { this = "RandomTaintsSourceConfiguration" }

javascript/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
library: false
22
name: githubsecuritylab/codeql-javascript-queries
3-
version: 0.0.2
3+
version: 0.0.4
44
suites: suites
55
defaultSuiteFile: suites/javascript.qls
66
dependencies:

javascript/src/security/CWE-328/WeakHashingAlgorithm.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* @kind problem
55
* @problem.severity error
66
* @security-severity 4.0
7+
* @precision medium
78
* @id githubsecuritylab/weak-hashing
89
* @tags security
910
* external/cwe/cwe-328

javascript/src/security/CWE-329/InsecureIV.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import javascript
1717
import semmle.javascript.dataflow.TaintTracking
1818
import DataFlow::PathGraph
19-
import github.InsecureIV
19+
import ghsl.InsecureIV
2020

2121
from InsecureIVConfiguration insecurecfg, DataFlow::PathNode source, DataFlow::PathNode sink
2222
where

javascript/src/suites/javascript.qls

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
kind:
88
- problem
99
- path-problem
10-
- metric
11-
- diagnostic
1210
precision:
1311
- very-high
1412
- high

python/lib/github/Helpers.qll renamed to python/lib/ghsl/Helpers.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ private import semmle.python.security.dataflow.ServerSideRequestForgeryCustomiza
88
private import semmle.python.security.dataflow.SqlInjectionCustomizations
99
private import semmle.python.security.dataflow.UnsafeDeserializationCustomizations
1010
// Fields Sinks
11-
private import github.HardcodedSecretSinks
12-
private import github.MassAssignment
11+
private import ghsl.HardcodedSecretSinks
12+
private import ghsl.MassAssignment
1313

1414
// Find Node at Location
1515
predicate findByLocation(DataFlow::Node node, string relative_path, int linenumber) {
File renamed without changes.
File renamed without changes.

python/lib/github/MassAssignment.qll renamed to python/lib/ghsl/MassAssignment.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import semmle.python.Concepts
55
import semmle.python.dataflow.new.RemoteFlowSources
66
import semmle.python.dataflow.new.BarrierGuards
77
import semmle.python.ApiGraphs
8-
import github.LocalSources
8+
import ghsl.LocalSources
99

1010
module MassAssignment {
1111
abstract class Sources extends DataFlow::Node { }
File renamed without changes.

python/lib/github/XMLLocalLib.qll renamed to python/lib/ghsl/XMLLocalLib.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ private import semmle.python.dataflow.new.RemoteFlowSources
66
private import semmle.python.dataflow.new.BarrierGuards
77
private import semmle.python.ApiGraphs
88

9-
private import github.LocalSources
9+
private import ghsl.LocalSources
1010

1111
class XmlParseStringCall extends DataFlow::CallCfgNode {
1212
XmlParseStringCall() {

0 commit comments

Comments
 (0)