bitwarden_workflow_linter 0.5.7__tar.gz → 0.7.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/.github/CODEOWNERS +3 -0
- bitwarden_workflow_linter-0.5.7/.github/workflows/update_actions.yml → bitwarden_workflow_linter-0.7.1/.github/workflows/bwwl_operations.yml +47 -26
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/.github/workflows/enforce-labels.yml +1 -1
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/PKG-INFO +17 -9
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/README.md +16 -8
- bitwarden_workflow_linter-0.7.1/settings.yaml +21 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/__about__.py +1 -1
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/default_actions.json +9 -4
- bitwarden_workflow_linter-0.7.1/src/bitwarden_workflow_linter/default_settings.yaml +21 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/load.py +23 -4
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/rules/check_pr_target.py +11 -11
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/rules/job_environment_prefix.py +4 -2
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/rules/name_capitalized.py +4 -2
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/rules/name_exists.py +4 -2
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/rules/pinned_job_runner.py +4 -2
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/rules/run_actionlint.py +2 -2
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/rules/step_approved.py +4 -2
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/rules/step_pinned.py +4 -2
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/rules/underscore_outputs.py +4 -2
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/utils.py +2 -2
- bitwarden_workflow_linter-0.5.7/settings.yaml +0 -12
- bitwarden_workflow_linter-0.5.7/src/bitwarden_workflow_linter/default_settings.yaml +0 -12
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/.editorconfig +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/.gitattributes +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/.github/renovate.json +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/.github/workflows/_version_type.yml +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/.github/workflows/cd.yml +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/.github/workflows/ci.yml +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/.github/workflows/scan.yml +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/.gitignore +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/.husky/pre-commit +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/.python-version +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/CONTRIBUTING.md +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/LICENSE.txt +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/Pipfile +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/Pipfile.lock +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/SECURITY.md +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/Taskfile.yml +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/package-lock.json +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/package.json +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/pylintrc +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/pyproject.toml +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/pyproject.toml.tpl +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/__init__.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/actions.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/cli.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/lint.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/models/__init__.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/models/job.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/models/step.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/models/workflow.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/rule.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/src/bitwarden_workflow_linter/rules/__init__.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/__init__.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/conftest.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/fixtures/test-alt.yml +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/fixtures/test-min-incorrect.yaml +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/fixtures/test-min.yaml +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/fixtures/test-outputs-incorrect.yml +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/fixtures/test.yml +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/fixtures/test_a.yaml +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/fixtures/test_workflow.yaml +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/fixtures/test_workflow_incorrect.yaml +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/rules/__init__.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/rules/test_check_pr_target.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/rules/test_job_environment_prefix.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/rules/test_name_capitalized.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/rules/test_name_exists.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/rules/test_pinned_job_runner.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/rules/test_run_actionlint.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/rules/test_step_approved.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/rules/test_step_pinned.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/rules/test_underscore_output.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/test_job.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/test_lint.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/test_load.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/test_rule.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/test_step.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/test_utils.py +0 -0
- {bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/test_workflow.py +0 -0
@@ -1,14 +1,30 @@
|
|
1
|
-
name:
|
1
|
+
name: Approved actions operations
|
2
2
|
|
3
3
|
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
inputs:
|
6
|
+
operation:
|
7
|
+
description: 'Operation to perform. ex: update, add'
|
8
|
+
required: true
|
9
|
+
type: string
|
10
|
+
action:
|
11
|
+
description: 'Single action to add. ex: actions/checkout'
|
12
|
+
required: false
|
13
|
+
type: string
|
4
14
|
schedule:
|
5
|
-
- cron: '0 0
|
15
|
+
- cron: '0 0 1 * *'
|
6
16
|
|
7
17
|
jobs:
|
8
|
-
actions-
|
9
|
-
name: "
|
18
|
+
actions-operation:
|
19
|
+
name: "Approved actions operations"
|
10
20
|
runs-on: ubuntu-24.04
|
21
|
+
env:
|
22
|
+
_ACTION: ${{ inputs.action }}
|
11
23
|
steps:
|
24
|
+
- name: Check for action input
|
25
|
+
if: ${{ inputs.operation == 'add' && !env._ACTION }}
|
26
|
+
run: echo "Action input is required for operation 'add'" && exit 1
|
27
|
+
|
12
28
|
- name: Login to Azure - CI Subscription
|
13
29
|
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
|
14
30
|
with:
|
@@ -22,6 +38,9 @@ jobs:
|
|
22
38
|
secrets: "github-gpg-private-key,
|
23
39
|
github-gpg-private-key-passphrase"
|
24
40
|
|
41
|
+
- name: Checkout Branch
|
42
|
+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
43
|
+
|
25
44
|
- name: Import GPG key
|
26
45
|
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 # v6.2.0
|
27
46
|
with:
|
@@ -35,9 +54,6 @@ jobs:
|
|
35
54
|
git config --local user.email "106330231+bitwarden-devops-bot@users.noreply.github.com"
|
36
55
|
git config --local user.name "bitwarden-devops-bot"
|
37
56
|
|
38
|
-
- name: Checkout Branch
|
39
|
-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
40
|
-
|
41
57
|
- name: Set up Python 3.11
|
42
58
|
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
|
43
59
|
with:
|
@@ -47,16 +63,30 @@ jobs:
|
|
47
63
|
run: python -m pip install --upgrade bitwarden_workflow_linter
|
48
64
|
|
49
65
|
- name: Create Branch
|
66
|
+
if: ${{ github.events_name == 'schedule' }} || ${{ inputs.operation == 'update' }}
|
50
67
|
id: create-branch
|
51
68
|
run: |
|
52
69
|
NAME="update-actions-$(date +'%Y%m%d-%H%M%S')"
|
53
70
|
git switch -c $NAME
|
54
71
|
echo "name=$NAME" >> $GITHUB_OUTPUT
|
55
72
|
|
73
|
+
- name: Create Branch
|
74
|
+
if: ${{ inputs.operation == 'add' }}
|
75
|
+
id: create-branch
|
76
|
+
run: |
|
77
|
+
NAME= "add-action-$_ACTION"
|
78
|
+
git switch -c $NAME
|
79
|
+
echo "name=$NAME" >> $GITHUB_OUTPUT
|
80
|
+
|
56
81
|
- name: Run bwwl update
|
82
|
+
if: ${{ github.events_name == 'schedule' }} || ${{ inputs.operation == 'update' }}
|
57
83
|
run: bwwl actions update -o src/bitwarden_workflow_linter/default_actions.json
|
58
84
|
|
59
|
-
- name:
|
85
|
+
- name: Run bwwl add
|
86
|
+
if: ${{ inputs.operation == 'add' }}
|
87
|
+
run: bwwl actions add -o src/bitwarden_workflow_linter/default_actions.json "$_ACTION"
|
88
|
+
|
89
|
+
- name: Check for changes to commit
|
60
90
|
id: new-changes
|
61
91
|
run: |
|
62
92
|
if [ -n "$(git status --porcelain)" ]; then
|
@@ -67,15 +97,15 @@ jobs:
|
|
67
97
|
fi
|
68
98
|
|
69
99
|
- name: Commit changes
|
70
|
-
if: steps.new-changes.outputs.new_changes == 'TRUE'
|
100
|
+
if: ${{ steps.new-changes.outputs.new_changes == 'TRUE' }}
|
71
101
|
env:
|
72
|
-
|
102
|
+
_PR_BRANCH: ${{ steps.create-branch.outputs.name }}
|
73
103
|
run: |
|
74
104
|
git commit -m "Update approved actions" -a
|
75
|
-
git push origin $
|
105
|
+
git push origin "$_PR_BRANCH"
|
76
106
|
|
77
107
|
- name: Generate GH App token
|
78
|
-
if: steps.new-changes.outputs.new_changes == 'TRUE'
|
108
|
+
if: ${{ steps.new-changes.outputs.new_changes == 'TRUE' }}
|
79
109
|
uses: actions/create-github-app-token@67e27a7eb7db372a1c61a7f9bdab8699e9ee57f7 # v1.11.3
|
80
110
|
id: app-token
|
81
111
|
with:
|
@@ -84,16 +114,16 @@ jobs:
|
|
84
114
|
owner: ${{ github.repository_owner }}
|
85
115
|
|
86
116
|
- name: Create PR
|
87
|
-
if: steps.new-changes.outputs.new_changes == 'TRUE'
|
117
|
+
if: ${{ steps.new-changes.outputs.new_changes == 'TRUE' }}
|
88
118
|
id: create-pr
|
89
119
|
env:
|
90
120
|
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
91
|
-
|
92
|
-
|
121
|
+
_PR_BRANCH: ${{ steps.create-branch.outputs.name }}
|
122
|
+
_TITLE: "Update/Add bwwl approved actions"
|
93
123
|
run: |
|
94
|
-
PR_URL=$(gh pr create --title "$
|
124
|
+
PR_URL=$(gh pr create --title "$_TITLE" \
|
95
125
|
--base "main" \
|
96
|
-
--head "$
|
126
|
+
--head "$_PR_BRANCH" \
|
97
127
|
--label "version:patch" \
|
98
128
|
--label "automated pr" \
|
99
129
|
--body "
|
@@ -107,12 +137,3 @@ jobs:
|
|
107
137
|
## Description
|
108
138
|
- This PR updates the approved actions for the Bitwarden Workflow Linter.")
|
109
139
|
echo "pr_number=${PR_URL##*/}" >> $GITHUB_OUTPUT
|
110
|
-
|
111
|
-
- name: Approve and Merge PR
|
112
|
-
if: ${{ steps.create-pr.outcome == 'success' }}
|
113
|
-
env:
|
114
|
-
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
115
|
-
PR_NUMBER: ${{ steps.create-pr.outputs.pr_number }}
|
116
|
-
run: |
|
117
|
-
gh pr review $PR_NUMBER --approve
|
118
|
-
gh pr merge $PR_NUMBER --squash --auto --delete-branch
|
@@ -9,7 +9,7 @@ jobs:
|
|
9
9
|
uses: bitwarden/gh-actions/.github/workflows/_enforce-labels.yml@main
|
10
10
|
|
11
11
|
enforce-version-label:
|
12
|
-
if: "!(contains(github.event.pull_request.labels.*.name, 'version:major') || contains(github.event.pull_request.labels.*.name, 'version:minor') || contains(github.event.pull_request.labels.*.name, 'version:patch')
|
12
|
+
if: "!(contains(github.event.pull_request.labels.*.name, 'version:major') || contains(github.event.pull_request.labels.*.name, 'version:minor') || contains(github.event.pull_request.labels.*.name, 'version:patch') || contains(github.event.pull_request.labels.*.name, 'version:skip'))"
|
13
13
|
name: Enforce version label
|
14
14
|
runs-on: ubuntu-22.04
|
15
15
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: bitwarden_workflow_linter
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.7.1
|
4
4
|
Summary: Custom GitHub Action Workflow Linter
|
5
5
|
Project-URL: Homepage, https://github.com/bitwarden/workflow-linter
|
6
6
|
Project-URL: Issues, https://github.com/bitwarden/workflow-linter/issues
|
@@ -60,12 +60,20 @@ the below and create a `settings.yaml` in the directory that `bwwl` will be runn
|
|
60
60
|
|
61
61
|
```yaml
|
62
62
|
enabled_rules:
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
63
|
+
- id: bitwarden_workflow_linter.rules.name_exists.RuleNameExists
|
64
|
+
level: error
|
65
|
+
- id: bitwarden_workflow_linter.rules.name_capitalized.RuleNameCapitalized
|
66
|
+
level: error
|
67
|
+
- id: bitwarden_workflow_linter.rules.pinned_job_runner.RuleJobRunnerVersionPinned
|
68
|
+
level: error
|
69
|
+
- id: bitwarden_workflow_linter.rules.job_environment_prefix.RuleJobEnvironmentPrefix
|
70
|
+
level: error
|
71
|
+
- id: bitwarden_workflow_linter.rules.step_pinned.RuleStepUsesPinned
|
72
|
+
level: error
|
73
|
+
- id: bitwarden_workflow_linter.rules.underscore_outputs.RuleUnderscoreOutputs
|
74
|
+
level: warning
|
75
|
+
- id: bitwarden_workflow_linter.rules.run_actionlint.RunActionlint
|
76
|
+
level: warning
|
69
77
|
|
70
78
|
approved_actions_path: default_actions.json
|
71
79
|
```
|
@@ -151,9 +159,9 @@ from ..utils import LintLevels, Settings
|
|
151
159
|
|
152
160
|
|
153
161
|
class RuleJobNameExists(Rule):
|
154
|
-
def __init__(self, settings: Settings = None) -> None:
|
162
|
+
def __init__(self, settings: Settings = None, lint_level: Optional[LintLevels] = LintLevels.ERROR) -> None:
|
155
163
|
self.message = "name must exist"
|
156
|
-
self.on_fail: LintLevels =
|
164
|
+
self.on_fail: LintLevels = lint_level
|
157
165
|
self.compatibility: List[Union[Workflow, Job, Step]] = [Job]
|
158
166
|
self.settings: Settings = settings
|
159
167
|
|
@@ -34,12 +34,20 @@ the below and create a `settings.yaml` in the directory that `bwwl` will be runn
|
|
34
34
|
|
35
35
|
```yaml
|
36
36
|
enabled_rules:
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
37
|
+
- id: bitwarden_workflow_linter.rules.name_exists.RuleNameExists
|
38
|
+
level: error
|
39
|
+
- id: bitwarden_workflow_linter.rules.name_capitalized.RuleNameCapitalized
|
40
|
+
level: error
|
41
|
+
- id: bitwarden_workflow_linter.rules.pinned_job_runner.RuleJobRunnerVersionPinned
|
42
|
+
level: error
|
43
|
+
- id: bitwarden_workflow_linter.rules.job_environment_prefix.RuleJobEnvironmentPrefix
|
44
|
+
level: error
|
45
|
+
- id: bitwarden_workflow_linter.rules.step_pinned.RuleStepUsesPinned
|
46
|
+
level: error
|
47
|
+
- id: bitwarden_workflow_linter.rules.underscore_outputs.RuleUnderscoreOutputs
|
48
|
+
level: warning
|
49
|
+
- id: bitwarden_workflow_linter.rules.run_actionlint.RunActionlint
|
50
|
+
level: warning
|
43
51
|
|
44
52
|
approved_actions_path: default_actions.json
|
45
53
|
```
|
@@ -125,9 +133,9 @@ from ..utils import LintLevels, Settings
|
|
125
133
|
|
126
134
|
|
127
135
|
class RuleJobNameExists(Rule):
|
128
|
-
def __init__(self, settings: Settings = None) -> None:
|
136
|
+
def __init__(self, settings: Settings = None, lint_level: Optional[LintLevels] = LintLevels.ERROR) -> None:
|
129
137
|
self.message = "name must exist"
|
130
|
-
self.on_fail: LintLevels =
|
138
|
+
self.on_fail: LintLevels = lint_level
|
131
139
|
self.compatibility: List[Union[Workflow, Job, Step]] = [Job]
|
132
140
|
self.settings: Settings = settings
|
133
141
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
enabled_rules:
|
2
|
+
- id: bitwarden_workflow_linter.rules.name_exists.RuleNameExists
|
3
|
+
level: error
|
4
|
+
- id: bitwarden_workflow_linter.rules.name_capitalized.RuleNameCapitalized
|
5
|
+
level: error
|
6
|
+
- id: bitwarden_workflow_linter.rules.pinned_job_runner.RuleJobRunnerVersionPinned
|
7
|
+
level: error
|
8
|
+
- id: bitwarden_workflow_linter.rules.job_environment_prefix.RuleJobEnvironmentPrefix
|
9
|
+
level: error
|
10
|
+
# - id: bitwarden_workflow_linter.rules.step_approved.RuleStepUsesApproved
|
11
|
+
# level: error
|
12
|
+
- id: bitwarden_workflow_linter.rules.step_pinned.RuleStepUsesPinned
|
13
|
+
level: error
|
14
|
+
- id: bitwarden_workflow_linter.rules.underscore_outputs.RuleUnderscoreOutputs
|
15
|
+
level: warning
|
16
|
+
- id: bitwarden_workflow_linter.rules.run_actionlint.RunActionlint
|
17
|
+
level: warning
|
18
|
+
- id: bitwarden_workflow_linter.rules.check_pr_target.RuleCheckPrTarget
|
19
|
+
level: warning
|
20
|
+
|
21
|
+
approved_actions_path: default_actions.json
|
@@ -121,8 +121,8 @@
|
|
121
121
|
},
|
122
122
|
"actions/upload-artifact": {
|
123
123
|
"name": "actions/upload-artifact",
|
124
|
-
"sha": "
|
125
|
-
"version": "v4.
|
124
|
+
"sha": "65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08",
|
125
|
+
"version": "v4.6.0"
|
126
126
|
},
|
127
127
|
"actions/upload-pages-artifact": {
|
128
128
|
"name": "actions/upload-pages-artifact",
|
@@ -221,8 +221,8 @@
|
|
221
221
|
},
|
222
222
|
"docker/build-push-action": {
|
223
223
|
"name": "docker/build-push-action",
|
224
|
-
"sha": "
|
225
|
-
"version": "v6.
|
224
|
+
"sha": "67a2d409c0a876cbe6b11854e3e25193efe4e62d",
|
225
|
+
"version": "v6.12.0"
|
226
226
|
},
|
227
227
|
"docker/login-action": {
|
228
228
|
"name": "docker/login-action",
|
@@ -274,6 +274,11 @@
|
|
274
274
|
"sha": "cc4fc85e6b35bafd578d5ffbc76a5518407e1af0",
|
275
275
|
"version": "v4.2.1"
|
276
276
|
},
|
277
|
+
"gradle/wrapper-validation-action": {
|
278
|
+
"name": "gradle/wrapper-validation-action",
|
279
|
+
"sha": "f9c9c575b8b21b6485636a91ffecd10e558c62f6",
|
280
|
+
"version": "v3.5.0"
|
281
|
+
},
|
277
282
|
"hashicorp/setup-packer": {
|
278
283
|
"name": "hashicorp/setup-packer",
|
279
284
|
"sha": "1aa358be5cf73883762b302a3a03abd66e75b232",
|
@@ -0,0 +1,21 @@
|
|
1
|
+
enabled_rules:
|
2
|
+
- id: bitwarden_workflow_linter.rules.name_exists.RuleNameExists
|
3
|
+
level: error
|
4
|
+
- id: bitwarden_workflow_linter.rules.name_capitalized.RuleNameCapitalized
|
5
|
+
level: error
|
6
|
+
- id: bitwarden_workflow_linter.rules.pinned_job_runner.RuleJobRunnerVersionPinned
|
7
|
+
level: error
|
8
|
+
- id: bitwarden_workflow_linter.rules.job_environment_prefix.RuleJobEnvironmentPrefix
|
9
|
+
level: error
|
10
|
+
# - id: bitwarden_workflow_linter.rules.step_approved.RuleStepUsesApproved
|
11
|
+
# level: error
|
12
|
+
- id: bitwarden_workflow_linter.rules.step_pinned.RuleStepUsesPinned
|
13
|
+
level: error
|
14
|
+
- id: bitwarden_workflow_linter.rules.underscore_outputs.RuleUnderscoreOutputs
|
15
|
+
level: warning
|
16
|
+
- id: bitwarden_workflow_linter.rules.run_actionlint.RunActionlint
|
17
|
+
level: warning
|
18
|
+
- id: bitwarden_workflow_linter.rules.check_pr_target.RuleCheckPrTarget
|
19
|
+
level: warning
|
20
|
+
|
21
|
+
approved_actions_path: default_actions.json
|
@@ -11,7 +11,7 @@ from .models.job import Job
|
|
11
11
|
from .models.step import Step
|
12
12
|
from .models.workflow import Workflow
|
13
13
|
from .rule import Rule
|
14
|
-
from .utils import Settings
|
14
|
+
from .utils import Settings, LintLevels
|
15
15
|
|
16
16
|
yaml = YAML()
|
17
17
|
|
@@ -127,13 +127,14 @@ class Rules:
|
|
127
127
|
"""
|
128
128
|
# [TODO]: data resiliency
|
129
129
|
for rule in settings.enabled_rules:
|
130
|
-
|
130
|
+
rule_id = rule["id"]
|
131
|
+
module_name = rule_id.split(".")
|
131
132
|
module_name = ".".join(module_name[:-1])
|
132
|
-
rule_name =
|
133
|
+
rule_name = rule_id.split(".")[-1]
|
133
134
|
|
134
135
|
try:
|
135
136
|
rule_class = getattr(importlib.import_module(module_name), rule_name)
|
136
|
-
rule_inst = rule_class(settings=settings)
|
137
|
+
rule_inst = rule_class(settings=settings, lint_level=lint_level(rule["level"]))
|
137
138
|
|
138
139
|
if Workflow in rule_inst.compatibility:
|
139
140
|
self.workflow.append(rule_inst)
|
@@ -157,3 +158,21 @@ class Rules:
|
|
157
158
|
for rule in self.step:
|
158
159
|
print(f" - {type(rule).__name__}")
|
159
160
|
print("========================\n")
|
161
|
+
|
162
|
+
|
163
|
+
def lint_level(level: str) -> LintLevels:
|
164
|
+
"""Convert a string to a LintLevels enum.
|
165
|
+
|
166
|
+
Args:
|
167
|
+
level:
|
168
|
+
The string representation of the LintLevels enum
|
169
|
+
|
170
|
+
Returns:
|
171
|
+
The LintLevels enum value
|
172
|
+
"""
|
173
|
+
if level == "error":
|
174
|
+
return LintLevels.ERROR
|
175
|
+
elif level == "warning":
|
176
|
+
return LintLevels.WARNING
|
177
|
+
else:
|
178
|
+
return LintLevels.NONE
|
@@ -8,25 +8,25 @@ from ..utils import LintLevels, Settings
|
|
8
8
|
|
9
9
|
|
10
10
|
class RuleCheckPrTarget(Rule):
|
11
|
-
def __init__(self, settings: Optional[Settings] = None) -> None:
|
11
|
+
def __init__(self, settings: Optional[Settings] = None, lint_level: Optional[LintLevels] = LintLevels.NONE) -> None:
|
12
12
|
"""
|
13
|
-
To ensure pull_request_target is safe to use, the check-run step is added
|
13
|
+
To ensure pull_request_target is safe to use, the check-run step is added
|
14
14
|
to all jobs as a dependency.
|
15
15
|
|
16
|
-
Once a branch is pushed to Github, it already opens up a vulnerability
|
17
|
-
even if the check-run scan fails to detect this.
|
18
|
-
|
19
|
-
In order to prevent a vulnerable branch from being used for an attack
|
20
|
-
prior to being caught through vetting, all pull_request_target workflows
|
21
|
-
should only be run by users with appropriate permissions.
|
16
|
+
Once a branch is pushed to Github, it already opens up a vulnerability
|
17
|
+
even if the check-run scan fails to detect this.
|
18
|
+
|
19
|
+
In order to prevent a vulnerable branch from being used for an attack
|
20
|
+
prior to being caught through vetting, all pull_request_target workflows
|
21
|
+
should only be run by users with appropriate permissions.
|
22
22
|
|
23
23
|
This greatly reduces the risk as community contributors can't use a fork to run a compromised workflow that uses pull_request_target.
|
24
24
|
"""
|
25
25
|
self.message = "A check-run job must be included as a direct job dependency when pull_request_target is used and the workflow may only apply to runs on the main branch"
|
26
|
-
self.on_fail =
|
26
|
+
self.on_fail = lint_level
|
27
27
|
self.compatibility = [Workflow]
|
28
28
|
self.settings = settings
|
29
|
-
|
29
|
+
|
30
30
|
def targets_main_branch(self, obj:Workflow) -> bool:
|
31
31
|
if obj.on["pull_request_target"].get("branches"):
|
32
32
|
branches_list = obj.on["pull_request_target"].get("branches")
|
@@ -43,7 +43,7 @@ class RuleCheckPrTarget(Rule):
|
|
43
43
|
if job.uses == "bitwarden/gh-actions/.github/workflows/check-run.yml@main":
|
44
44
|
return True, name
|
45
45
|
return False, ""
|
46
|
-
|
46
|
+
|
47
47
|
def check_run_required(self, obj:Workflow, check_job:str) -> list:
|
48
48
|
missing_jobs = []
|
49
49
|
for job in list(obj.jobs.keys()):
|
@@ -22,16 +22,18 @@ class RuleJobEnvironmentPrefix(Rule):
|
|
22
22
|
visible when debugging a shell Step.
|
23
23
|
"""
|
24
24
|
|
25
|
-
def __init__(self, settings: Optional[Settings] = None) -> None:
|
25
|
+
def __init__(self, settings: Optional[Settings] = None, lint_level: Optional[LintLevels] = LintLevels.NONE) -> None:
|
26
26
|
"""RuleJobEnvironmentPrefix constructor to override the Rule class.
|
27
27
|
|
28
28
|
Args:
|
29
29
|
settings:
|
30
30
|
A Settings object that contains any default, overridden, or custom settings
|
31
31
|
required anywhere in the application.
|
32
|
+
lint_level:
|
33
|
+
The LintLevels enum value to determine the severity of the rule.
|
32
34
|
"""
|
33
35
|
self.message = "Job environment vars should start with an underscore:"
|
34
|
-
self.on_fail =
|
36
|
+
self.on_fail = lint_level
|
35
37
|
self.compatibility = [Job]
|
36
38
|
self.settings = settings
|
37
39
|
|
@@ -16,16 +16,18 @@ class RuleNameCapitalized(Rule):
|
|
16
16
|
A simple standard to help keep uniformity in naming.
|
17
17
|
"""
|
18
18
|
|
19
|
-
def __init__(self, settings: Optional[Settings] = None) -> None:
|
19
|
+
def __init__(self, settings: Optional[Settings] = None, lint_level: Optional[LintLevels] = LintLevels.NONE) -> None:
|
20
20
|
"""Constructor for RuleNameCapitalized to override the Rule class.
|
21
21
|
|
22
22
|
Args:
|
23
23
|
settings:
|
24
24
|
A Settings object that contains any default, overridden, or custom settings
|
25
25
|
required anywhere in the application.
|
26
|
+
lint_level:
|
27
|
+
The LintLevels enum value to determine the severity of the rule.
|
26
28
|
"""
|
27
29
|
self.message = "name must capitalized"
|
28
|
-
self.on_fail =
|
30
|
+
self.on_fail = lint_level
|
29
31
|
self.settings = settings
|
30
32
|
|
31
33
|
def fn(self, obj: Union[Workflow, Job, Step]) -> Tuple[bool, str]:
|
@@ -19,16 +19,18 @@ class RuleNameExists(Rule):
|
|
19
19
|
It also helps with uniformity of runs.
|
20
20
|
"""
|
21
21
|
|
22
|
-
def __init__(self, settings: Optional[Settings] = None) -> None:
|
22
|
+
def __init__(self, settings: Optional[Settings] = None, lint_level: Optional[LintLevels] = LintLevels.NONE) -> None:
|
23
23
|
"""Constructor for RuleNameCapitalized to override Rule class.
|
24
24
|
|
25
25
|
Args:
|
26
26
|
settings:
|
27
27
|
A Settings object that contains any default, overridden, or custom settings
|
28
28
|
required anywhere in the application.
|
29
|
+
lint_level:
|
30
|
+
The LintLevels enum value to determine the severity of the rule.
|
29
31
|
"""
|
30
32
|
self.message = "name must exist"
|
31
|
-
self.on_fail =
|
33
|
+
self.on_fail = lint_level
|
32
34
|
self.settings = settings
|
33
35
|
|
34
36
|
def fn(self, obj: Union[Workflow, Job, Step]) -> Tuple[bool, str]:
|
@@ -15,16 +15,18 @@ class RuleJobRunnerVersionPinned(Rule):
|
|
15
15
|
breaking the majority of our pipelines, we pin the versions.
|
16
16
|
"""
|
17
17
|
|
18
|
-
def __init__(self, settings: Optional[Settings] = None) -> None:
|
18
|
+
def __init__(self, settings: Optional[Settings] = None, lint_level: Optional[LintLevels] = LintLevels.NONE) -> None:
|
19
19
|
"""Constructor for RuleJobRunnerVersionPinned to override Rule class.
|
20
20
|
|
21
21
|
Args:
|
22
22
|
settings:
|
23
23
|
A Settings object that contains any default, overridden, or custom settings
|
24
24
|
required anywhere in the application.
|
25
|
+
lint_level:
|
26
|
+
The LintLevels enum value to determine the severity of the rule.
|
25
27
|
"""
|
26
28
|
self.message = "Workflow runner must be pinned"
|
27
|
-
self.on_fail =
|
29
|
+
self.on_fail = lint_level
|
28
30
|
self.compatibility = [Job]
|
29
31
|
self.settings = settings
|
30
32
|
|
@@ -71,9 +71,9 @@ please check your package installer or manually install it",
|
|
71
71
|
class RunActionlint(Rule):
|
72
72
|
"""Rule to run actionlint as part of workflow linter V2."""
|
73
73
|
|
74
|
-
def __init__(self, settings: Optional[Settings] = None) -> None:
|
74
|
+
def __init__(self, settings: Optional[Settings] = None, lint_level: Optional[LintLevels] = LintLevels.NONE) -> None:
|
75
75
|
self.message = "Actionlint must pass without errors"
|
76
|
-
self.on_fail =
|
76
|
+
self.on_fail = lint_level
|
77
77
|
self.compatibility = [Workflow]
|
78
78
|
self.settings = settings
|
79
79
|
|
@@ -15,15 +15,17 @@ class RuleStepUsesApproved(Rule):
|
|
15
15
|
check against.
|
16
16
|
"""
|
17
17
|
|
18
|
-
def __init__(self, settings: Optional[Settings] = None) -> None:
|
18
|
+
def __init__(self, settings: Optional[Settings] = None, lint_level: Optional[LintLevels] = LintLevels.NONE) -> None:
|
19
19
|
"""Constructor for RuleStepUsesApproved to override Rule class.
|
20
20
|
|
21
21
|
Args:
|
22
22
|
settings:
|
23
23
|
A Settings object that contains any default, overridden, or custom settings
|
24
24
|
required anywhere in the application.
|
25
|
+
lint_level:
|
26
|
+
The LintLevels enum value to determine the severity of the rule.
|
25
27
|
"""
|
26
|
-
self.on_fail =
|
28
|
+
self.on_fail = lint_level
|
27
29
|
self.compatibility = [Step]
|
28
30
|
self.settings = settings
|
29
31
|
|
@@ -23,15 +23,17 @@ class RuleStepUsesPinned(Rule):
|
|
23
23
|
updated.
|
24
24
|
"""
|
25
25
|
|
26
|
-
def __init__(self, settings: Optional[Settings] = None) -> None:
|
26
|
+
def __init__(self, settings: Optional[Settings] = None, lint_level: Optional[LintLevels] = LintLevels.ERROR) -> None:
|
27
27
|
"""Constructor for RuleStepUsesPinned to override base Rule.
|
28
28
|
|
29
29
|
Args:
|
30
30
|
settings:
|
31
31
|
A Settings object that contains any default, overridden, or custom settings
|
32
32
|
required anywhere in the application.
|
33
|
+
lint_level:
|
34
|
+
The LintLevels enum value to determine the severity of the rule.
|
33
35
|
"""
|
34
|
-
self.on_fail =
|
36
|
+
self.on_fail = lint_level
|
35
37
|
self.compatibility = [Step]
|
36
38
|
self.settings = settings
|
37
39
|
|
@@ -17,16 +17,18 @@ class RuleUnderscoreOutputs(Rule):
|
|
17
17
|
A simple standard to ensure uniformity in naming.
|
18
18
|
"""
|
19
19
|
|
20
|
-
def __init__(self, settings: Optional[Settings] = None) -> None:
|
20
|
+
def __init__(self, settings: Optional[Settings] = None, lint_level: Optional[LintLevels] = LintLevels.ERROR) -> None:
|
21
21
|
"""Constructor for RuleUnderscoreOutputs to override the Rule class.
|
22
22
|
|
23
23
|
Args:
|
24
24
|
settings:
|
25
25
|
A Settings object that contains any default, overridden, or custom settings
|
26
26
|
required anywhere in the application.
|
27
|
+
lint_level:
|
28
|
+
The LintLevels enum value to determine the severity of the rule.
|
27
29
|
"""
|
28
30
|
self.message = "outputs with more than one word should use an underscore"
|
29
|
-
self.on_fail =
|
31
|
+
self.on_fail = lint_level
|
30
32
|
self.compatibility = [Workflow, Job, Step]
|
31
33
|
self.settings = settings
|
32
34
|
|
@@ -111,12 +111,12 @@ SettingsFromFactory = TypeVar("SettingsFromFactory", bound="Settings")
|
|
111
111
|
class Settings:
|
112
112
|
"""Class that contains configuration-as-code for any portion of the app."""
|
113
113
|
|
114
|
-
enabled_rules: list[str]
|
114
|
+
enabled_rules: list[dict[str, str]]
|
115
115
|
approved_actions: dict[str, Action]
|
116
116
|
|
117
117
|
def __init__(
|
118
118
|
self,
|
119
|
-
enabled_rules: Optional[list[str]] = None,
|
119
|
+
enabled_rules: Optional[list[dict[str, str]]] = None,
|
120
120
|
approved_actions: Optional[dict[str, dict[str, str]]] = None,
|
121
121
|
) -> None:
|
122
122
|
"""Settings object that can be overridden in settings.py.
|
@@ -1,12 +0,0 @@
|
|
1
|
-
enabled_rules:
|
2
|
-
- bitwarden_workflow_linter.rules.name_exists.RuleNameExists
|
3
|
-
- bitwarden_workflow_linter.rules.name_capitalized.RuleNameCapitalized
|
4
|
-
- bitwarden_workflow_linter.rules.pinned_job_runner.RuleJobRunnerVersionPinned
|
5
|
-
- bitwarden_workflow_linter.rules.job_environment_prefix.RuleJobEnvironmentPrefix
|
6
|
-
# - bitwarden_workflow_linter.rules.step_approved.RuleStepUsesApproved
|
7
|
-
- bitwarden_workflow_linter.rules.step_pinned.RuleStepUsesPinned
|
8
|
-
- bitwarden_workflow_linter.rules.underscore_outputs.RuleUnderscoreOutputs
|
9
|
-
- bitwarden_workflow_linter.rules.run_actionlint.RunActionlint
|
10
|
-
- bitwarden_workflow_linter.rules.check_pr_target.RuleCheckPrTarget
|
11
|
-
|
12
|
-
approved_actions_path: default_actions.json
|
@@ -1,12 +0,0 @@
|
|
1
|
-
enabled_rules:
|
2
|
-
- bitwarden_workflow_linter.rules.name_exists.RuleNameExists
|
3
|
-
- bitwarden_workflow_linter.rules.name_capitalized.RuleNameCapitalized
|
4
|
-
- bitwarden_workflow_linter.rules.pinned_job_runner.RuleJobRunnerVersionPinned
|
5
|
-
- bitwarden_workflow_linter.rules.job_environment_prefix.RuleJobEnvironmentPrefix
|
6
|
-
# - bitwarden_workflow_linter.rules.step_approved.RuleStepUsesApproved
|
7
|
-
- bitwarden_workflow_linter.rules.step_pinned.RuleStepUsesPinned
|
8
|
-
- bitwarden_workflow_linter.rules.underscore_outputs.RuleUnderscoreOutputs
|
9
|
-
- bitwarden_workflow_linter.rules.run_actionlint.RunActionlint
|
10
|
-
- bitwarden_workflow_linter.rules.check_pr_target.RuleCheckPrTarget
|
11
|
-
|
12
|
-
approved_actions_path: default_actions.json
|
File without changes
|
File without changes
|
File without changes
|
{bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/.github/PULL_REQUEST_TEMPLATE.md
RENAMED
File without changes
|
File without changes
|
File without changes
|
{bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/.github/workflows/cd.yml
RENAMED
File without changes
|
{bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/.github/workflows/ci.yml
RENAMED
File without changes
|
{bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/.github/workflows/scan.yml
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/fixtures/test-alt.yml
RENAMED
File without changes
|
File without changes
|
{bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/fixtures/test-min.yaml
RENAMED
File without changes
|
File without changes
|
File without changes
|
{bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/fixtures/test_a.yaml
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/rules/test_name_exists.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{bitwarden_workflow_linter-0.5.7 → bitwarden_workflow_linter-0.7.1}/tests/rules/test_step_pinned.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|