Skip to content

Commit 3e94a4c

Browse files
committed
Refactor trusted actions owner model
- use existing data extensions config and yml folder - rename from trustedActionsOwner to trustedActionsOwnerDataModel - update related predicates
1 parent 35587ed commit 3e94a4c

File tree

7 files changed

+16
-9
lines changed

7 files changed

+16
-9
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
category: feature
33
---
4-
* Trusted Action owner list can now be expanded using data extensions for `trustedActionsOwner` on the query `actions/unpinned-tag`
4+
* Trusted Action owner list can now be expanded using data extensions for `trustedActionsOwnerDataModel` on the query `actions/unpinned-tag`

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,13 @@ predicate vulnerableActionsDataModel(
126126
*/
127127
predicate immutableActionsDataModel(string action) { Extensions::immutableActionsDataModel(action) }
128128

129+
/**
130+
* MaD models for trusted actions owners
131+
* Fields:
132+
* - owner: owner name
133+
*/
134+
predicate trustedActionsOwnerDataModel(string owner) { Extensions::trustedActionsOwnerDataModel(owner) }
135+
129136
/**
130137
* MaD models for untrusted git commands
131138
* Fields:

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ extensible predicate vulnerableActionsDataModel(
6363
*/
6464
extensible predicate immutableActionsDataModel(string action);
6565

66+
67+
/**
68+
* Holds for trusted Actions owners.
69+
*/
70+
extensible predicate trustedActionsOwnerDataModel(string owner);
71+
6672
/**
6773
* Holds for git commands that may introduce untrusted data when called on an attacker controlled branch.
6874
*/

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ class UnversionedImmutableAction extends UsesStep {
99
}
1010
}
1111

12-
// The following predicate is extended in data extensions under actions/ql/lib/codeql/actions/security/owner/
13-
// and can be extended with custom model packs as necessary.
14-
/** Holds for actions owner defined in data extensions */
15-
extensible predicate trustedActionsOwner(string owner);
16-
1712
bindingset[version]
1813
predicate isSemVer(string version) {
1914
// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string with optional v prefix
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
extensions:
22
- addsTo:
33
pack: codeql/actions-all
4-
extensible: trustedActionsOwner
4+
extensible: trustedActionsOwnerDataModel
55
data:
66
- ["actions"]
77
- ["github"]

actions/ql/lib/qlpack.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ dataExtensions:
1414
- ext/manual/*.model.yml
1515
- ext/generated/**/*.model.yml
1616
- ext/config/*.yml
17-
- codeql/actions/security/owner/**/*.model.yml

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ private predicate isPinnedCommit(string version) { version.regexpMatch("^[A-Fa-f
2020
bindingset[nwo]
2121
private predicate isTrustedOwner(string nwo) {
2222
// Gets the segment before the first '/' in the name with owner(nwo) string
23-
trustedActionsOwner(nwo.substring(0, nwo.indexOf("/")))
23+
trustedActionsOwnerDataModel(nwo.substring(0, nwo.indexOf("/")))
2424
}
2525

2626
from UsesStep uses, string nwo, string version, Workflow workflow, string name

0 commit comments

Comments
 (0)