Skip to content

Commit 98dce32

Browse files
authored
Merge pull request #1 from GitHubSecurityLab/database
Add Database Support
2 parents 4bf262f + 6c14d38 commit 98dce32

File tree

24 files changed

+824
-5
lines changed

24 files changed

+824
-5
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ If you have an idea for a new feature or enhancement, [please open an issue on G
2828
3. Make your changes
2929
4. Write tests for your changes (if applicable)
3030
5. Run the tests to make sure everything is working
31+
6. Submit a [pull request][pr] with a clear description of your changes
3132

3233
### Requirements
3334

ql/lib/bicep.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@ import codeql.Locations
22
import codeql.files.FileSystem
33
// AST
44
import codeql.bicep.AST
5+
// CFG
6+
import codeql.bicep.CFG
57
// Frameworks
68
import codeql.bicep.Frameworks
9+
import codeql.bicep.Concepts

ql/lib/codeql/bicep/Concepts.qll

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
11
private import codeql.bicep.AST
22
private import codeql.bicep.CFG
3+
4+
/**
5+
* A Public Resource is a resource that is publicly accessible to the Internet.
6+
*/
7+
abstract class PublicResource extends Resource {
8+
/**
9+
* Returns the property that indicates public access.
10+
*/
11+
abstract Expr getPublicAccessProperty();
12+
}
13+
14+
module Cryptography {
15+
abstract class WeakTlsVersion extends Resource {
16+
abstract StringLiteral getWeakTlsVersionProperty();
17+
18+
/**
19+
* Returns true if the resource has a weak TLS version.
20+
*
21+
* 1.0 and 1.1 are considered weak TLS versions.
22+
*/
23+
predicate hasWeakTlsVersion() {
24+
exists(StringLiteral literal |
25+
literal = this.getWeakTlsVersionProperty() and
26+
literal.getValue().regexpMatch("^(1\\.0|1\\.1)$")
27+
)
28+
}
29+
}
30+
}

ql/lib/codeql/bicep/Frameworks.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import frameworks.Microsoft.Compute
22
import frameworks.Microsoft.Network
3-
import frameworks.Microsoft.Storage
3+
import frameworks.Microsoft.Storage
4+
import frameworks.Microsoft.Databases

ql/lib/codeql/bicep/ast/Resources.qll

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ private import codeql.Locations
33
private import Expr
44
private import Idents
55
private import Literals
6-
76
private import internal.ResourceDeclaration
87
private import internal.ObjectProperty
98
private import internal.Object
@@ -79,7 +78,6 @@ Resource resolveResource(Expr expr) {
7978
)
8079
}
8180

82-
8381
class Resource extends TResource {
8482
private ResourceDeclaration resource;
8583

@@ -89,10 +87,15 @@ class Resource extends TResource {
8987
exists(StringLiteral sl | sl = resource.getName() | result = sl.getValue())
9088
}
9189

92-
Expr getProperty(string name) {
93-
result = resource.getProperty(name)
90+
string getName() {
91+
exists(StringLiteral name |
92+
name = resource.getProperty("name") and
93+
result = name.getValue()
94+
)
9495
}
9596

97+
Expr getProperty(string name) { result = resource.getProperty(name) }
98+
9699
Resource getParent() { result = resolveResource(this.getProperty("parent")) }
97100

98101
string toString() { result = resource.toString() }

0 commit comments

Comments
 (0)