-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13276 from geoffw0/sqlpathinject
Swift: Add path injection sinks for sqlite3 and SQLite.swift
- Loading branch information
Showing
7 changed files
with
246 additions
and
89 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
swift/ql/lib/codeql/swift/elements/decl/EnumElementDecl.qll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,37 @@ | ||
private import codeql.swift.generated.decl.EnumElementDecl | ||
private import codeql.swift.elements.decl.EnumDecl | ||
|
||
/** | ||
* An enum element declaration, for example `enumElement` and `anotherEnumElement` in: | ||
* ``` | ||
* enum MyEnum { | ||
* case enumElement | ||
* case anotherEnumElement(Int) | ||
* } | ||
* ``` | ||
*/ | ||
class EnumElementDecl extends Generated::EnumElementDecl { | ||
override string toString() { result = this.getName() } | ||
|
||
/** | ||
* Holds if this enum element declaration is called `enumElementName` and is a member of an | ||
* enum called `enumName`. | ||
*/ | ||
cached | ||
predicate hasQualifiedName(string enumName, string enumElementName) { | ||
this.getName() = enumElementName and | ||
exists(EnumDecl d | | ||
d.getFullName() = enumName and | ||
d.getAMember() = this | ||
) | ||
} | ||
|
||
/** | ||
* Holds if this enum element declaration is called `enumElementName` and is a member of an | ||
* enumcalled `enumName` in a module called `moduleName`. | ||
*/ | ||
predicate hasQualifiedName(string moduleName, string enumName, string enumElementName) { | ||
this.hasQualifiedName(enumName, enumElementName) and | ||
this.getModule().getFullName() = moduleName | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
category: minorAnalysis | ||
--- | ||
* Added sqlite3 and SQLite.swift path injection sinks for the `swift/path-injection` query. |
Oops, something went wrong.