mirror of
https://github.com/github/codeql.git
synced 2025-12-28 22:56:32 +01:00
Merge pull request #35 from github/default_branch_name
This commit is contained in:
@@ -3,10 +3,16 @@ private import codeql.actions.DataFlow
|
||||
private import actions
|
||||
|
||||
predicate workflowDataModel(
|
||||
string path, string visibility, string job, string secrets_source, string permissions,
|
||||
string path, string trigger, string job, string secrets_source, string permissions,
|
||||
string runner
|
||||
) {
|
||||
Extensions::workflowDataModel(path, visibility, job, secrets_source, permissions, runner)
|
||||
Extensions::workflowDataModel(path, trigger, job, secrets_source, permissions, runner)
|
||||
}
|
||||
|
||||
predicate repositoryDataModel(
|
||||
string visibility, string default_branch_name
|
||||
) {
|
||||
Extensions::repositoryDataModel(visibility, default_branch_name)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,10 @@ extensible predicate sinkModel(
|
||||
);
|
||||
|
||||
extensible predicate workflowDataModel(
|
||||
string path, string visibility, string job, string secrets_source, string permissions,
|
||||
string path, string trigger, string job, string secrets_source, string permissions,
|
||||
string runner
|
||||
);
|
||||
|
||||
extensible predicate repositoryDataModel(
|
||||
string visibility, string default_branch_name
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import actions
|
||||
import codeql.actions.dataflow.ExternalFlow
|
||||
|
||||
string defaultBranchTriggerEvent() {
|
||||
result =
|
||||
@@ -10,7 +11,17 @@ string defaultBranchTriggerEvent() {
|
||||
]
|
||||
}
|
||||
|
||||
string defaultBranchNames() { result = ["main", "master", "default"] }
|
||||
string defaultBranchNames() {
|
||||
exists(string default_branch_name |
|
||||
repositoryDataModel(_, default_branch_name) and
|
||||
result = default_branch_name
|
||||
)
|
||||
or
|
||||
not exists(string default_branch_name |
|
||||
repositoryDataModel(_, default_branch_name)
|
||||
) and
|
||||
result = ["main", "master"]
|
||||
}
|
||||
|
||||
predicate runsOnDefaultBranch(Job j) {
|
||||
exists(Event e |
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
extensions:
|
||||
- addsTo:
|
||||
pack: githubsecuritylab/actions-all
|
||||
extensible: repositoryDataModel
|
||||
data: []
|
||||
- addsTo:
|
||||
pack: githubsecuritylab/actions-all
|
||||
extensible: workflowDataModel
|
||||
|
||||
@@ -2,7 +2,7 @@ import actions
|
||||
import codeql.actions.dataflow.internal.ExternalFlowExtensions as Extensions
|
||||
|
||||
from
|
||||
string path, string visibility, string job, string secrets_source, string permissions,
|
||||
string path, string trigger, string job, string secrets_source, string permissions,
|
||||
string runner
|
||||
where Extensions::workflowDataModel(path, visibility, job, secrets_source, permissions, runner)
|
||||
select visibility, path, job, secrets_source, permissions, runner
|
||||
where Extensions::workflowDataModel(path, trigger, job, secrets_source, permissions, runner)
|
||||
select trigger, path, job, secrets_source, permissions, runner
|
||||
|
||||
Reference in New Issue
Block a user