Skip to content

Commit 7891134

Browse files
author
Dave Bartolomeo
committed
Fix formatting
1 parent 47e364a commit 7891134

File tree

11 files changed

+58
-74
lines changed

11 files changed

+58
-74
lines changed

actions/ql/lib/codeql/actions/Cfg.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ private import codeql.actions.controlflow.internal.Cfg as CfgInternal
44
import CfgInternal::Completion
55
import CfgInternal::CfgScope
66
import CfgInternal::CfgImpl
7-
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
import DataFlow::DataFlow::Consistency
2-
3-

actions/ql/lib/codeql/actions/Violations Of Best Practices/DefaultableCodeQLInitiatlizeActionQuery.qll

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,26 @@ private import actions
77
* uses: github/codeql-action/init@v2
88
* with:
99
* languages: ruby, javascript
10-
*
1110
*/
12-
1311
class DefaultableCodeQLInitiatlizeActionQuery extends UsesStep {
1412
DefaultableCodeQLInitiatlizeActionQuery() {
1513
this.getCallee() = "github/codeql-action/init" and
1614
not customizedWorkflowStep(this)
1715
}
1816
}
1917

20-
/**
18+
/**
2119
* Holds if the with: part of the workflow step contains any arguments for with: other than "languages".
2220
* e.g.
2321
* - name: Initialize CodeQL
2422
* uses: github/codeql-action/init@v3
2523
* with:
2624
* languages: ${{ matrix.language }}
2725
* config-file: ./.github/codeql/${{ matrix.language }}/codeql-config.yml
28-
*
2926
*/
30-
3127
predicate customizedWorkflowStep(UsesStep codeQLInitStep) {
3228
exists(string arg |
3329
exists(codeQLInitStep.getArgument(arg)) and
3430
arg != "languages"
3531
)
36-
}
32+
}

actions/ql/lib/codeql/actions/config/Config.qll

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,7 @@ predicate vulnerableActionsDataModel(
124124
* Fields:
125125
* - action: action name
126126
*/
127-
predicate immutableActionsDataModel(
128-
string action
129-
) {
130-
Extensions::immutableActionsDataModel(action)
131-
}
127+
predicate immutableActionsDataModel(string action) { Extensions::immutableActionsDataModel(action) }
132128

133129
/**
134130
* MaD models for untrusted git commands

actions/ql/lib/codeql/actions/config/ConfigExtensions.qll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ extensible predicate vulnerableActionsDataModel(
6161
/**
6262
* Holds for actions that are known to be immutable.
6363
*/
64-
extensible predicate immutableActionsDataModel(
65-
string action
66-
);
64+
extensible predicate immutableActionsDataModel(string action);
6765

6866
/**
6967
* Holds for git commands that may introduce untrusted data when called on an attacker controlled branch.

actions/ql/lib/codeql/actions/ideContextual/IDEContextual.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ File getFileBySourceArchiveName(string name) {
1616
// We can handle 2 and 3 together by unconditionally adding a leading slash
1717
// before replacing double slashes.
1818
name = ("/" + result.getAbsolutePath().replaceAll(":", "_")).replaceAll("//", "/")
19-
}
19+
}

actions/ql/lib/codeql/actions/security/UseOfUnversionedImmutableAction.qll

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ class UnversionedImmutableAction extends UsesStep {
1212
bindingset[version]
1313
predicate isSemVer(string version) {
1414
// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string with optional v prefix
15-
version.regexpMatch("^v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$")
16-
15+
version
16+
.regexpMatch("^v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$") or
1717
// or N or N.x or N.N.x with optional v prefix
18-
or version.regexpMatch("^v?[1-9]\\d*$")
19-
or version.regexpMatch("^v?[1-9]\\d*\\.(x|0|([1-9]\\d*))$")
20-
or version.regexpMatch("^v?[1-9]\\d*\\.(0|([1-9]\\d*))\\.(x|0|([1-9]\\d*))$")
21-
18+
version.regexpMatch("^v?[1-9]\\d*$") or
19+
version.regexpMatch("^v?[1-9]\\d*\\.(x|0|([1-9]\\d*))$") or
20+
version.regexpMatch("^v?[1-9]\\d*\\.(0|([1-9]\\d*))\\.(x|0|([1-9]\\d*))$") or
2221
// or latest which will work
23-
or version = "latest"
22+
version = "latest"
2423
}
2524

2625
predicate isImmutableAction(UsesStep actionStep, string actionName) {

actions/ql/lib/ide-contextual-queries/printAst.ql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,3 @@ class Cfg extends PrintAstConfiguration {
2626
n.getLocation().getFile() = getFileBySourceArchiveName(selectedSourceFile())
2727
}
2828
}
29-

actions/ql/lib/ide-contextual-queries/printCfg.ql

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,47 @@
77
* @tags ide-contextual-queries/print-cfg
88
*/
99

10-
private import codeql.actions.Cfg
11-
private import codeql.actions.Cfg::TestOutput
12-
private import codeql.actions.ideContextual.IDEContextual
13-
private import codeql.Locations
14-
15-
/**
16-
* Gets the source file to generate a CFG from.
17-
*/
18-
external string selectedSourceFile();
19-
20-
external string selectedSourceLine();
21-
22-
external string selectedSourceColumn();
23-
24-
bindingset[file, line, column]
25-
private CfgScope smallestEnclosingScope(File file, int line, int column) {
26-
result =
27-
min(Location loc, CfgScope scope |
28-
loc = scope.getLocation() and
29-
(
30-
loc.getStartLine() < line
31-
or
32-
loc.getStartLine() = line and loc.getStartColumn() <= column
33-
) and
34-
(
35-
loc.getEndLine() > line
36-
or
37-
loc.getEndLine() = line and loc.getEndColumn() >= column
38-
) and
39-
loc.getFile() = file
40-
|
41-
scope
42-
order by
43-
loc.getStartLine() desc, loc.getStartColumn() desc, loc.getEndLine(), loc.getEndColumn()
44-
)
45-
}
46-
47-
class MyRelevantNode extends RelevantNode {
48-
MyRelevantNode() {
49-
this.getScope() =
50-
smallestEnclosingScope(getFileBySourceArchiveName(selectedSourceFile()),
51-
selectedSourceLine().toInt(), selectedSourceColumn().toInt())
52-
}
53-
}
10+
private import codeql.actions.Cfg
11+
private import codeql.actions.Cfg::TestOutput
12+
private import codeql.actions.ideContextual.IDEContextual
13+
private import codeql.Locations
14+
15+
/**
16+
* Gets the source file to generate a CFG from.
17+
*/
18+
external string selectedSourceFile();
19+
20+
external string selectedSourceLine();
21+
22+
external string selectedSourceColumn();
23+
24+
bindingset[file, line, column]
25+
private CfgScope smallestEnclosingScope(File file, int line, int column) {
26+
result =
27+
min(Location loc, CfgScope scope |
28+
loc = scope.getLocation() and
29+
(
30+
loc.getStartLine() < line
31+
or
32+
loc.getStartLine() = line and loc.getStartColumn() <= column
33+
) and
34+
(
35+
loc.getEndLine() > line
36+
or
37+
loc.getEndLine() = line and loc.getEndColumn() >= column
38+
) and
39+
loc.getFile() = file
40+
|
41+
scope
42+
order by
43+
loc.getStartLine() desc, loc.getStartColumn() desc, loc.getEndLine(), loc.getEndColumn()
44+
)
45+
}
46+
47+
class MyRelevantNode extends RelevantNode {
48+
MyRelevantNode() {
49+
this.getScope() =
50+
smallestEnclosingScope(getFileBySourceArchiveName(selectedSourceFile()),
51+
selectedSourceLine().toInt(), selectedSourceColumn().toInt())
52+
}
53+
}

actions/ql/src/Security/CWE-829/UnversionedImmutableAction.ql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@ import actions
1414
import codeql.actions.security.UseOfUnversionedImmutableAction
1515

1616
from UnversionedImmutableAction step
17-
select step,
18-
"The workflow is using an eligible immutable action ($@) without semantic versioning", step,
19-
step.getCallee()
17+
select step, "The workflow is using an eligible immutable action ($@) without semantic versioning",
18+
step, step.getCallee()

0 commit comments

Comments
 (0)