Skip to content

Commit 5601c8e

Browse files
committed
security: pin all actions to SHAs, fix token permissions, add repo governance
- Pin all GitHub Actions to commit SHAs across 8 workflows (resolves Scorecard PinnedDependencies) - Set top-level permissions: read-all on docker, binaries, release workflows (resolves Scorecard Token-Permissions) - Pin Dockerfile base image to sha256 digest - Add issue templates (bug report, feature request) - Add PR template with checklist - Add CODEOWNERS (@kirankotari) - Set GitHub repo description, topics, and homepage - Update CHANGELOG.md with security hardening entries
1 parent 191e48a commit 5601c8e

14 files changed

Lines changed: 176 additions & 48 deletions

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Default owner for all files
2+
* @kirankotari
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Bug Report
2+
description: Report a bug in OSSGuard
3+
labels: ["bug"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: Thanks for reporting a bug! Please fill out the details below.
8+
- type: input
9+
id: version
10+
attributes:
11+
label: OSSGuard Version
12+
description: Output of `ossguard version`
13+
placeholder: "0.1.0"
14+
validations:
15+
required: true
16+
- type: input
17+
id: python-version
18+
attributes:
19+
label: Python Version
20+
description: Output of `python --version`
21+
placeholder: "3.12.0"
22+
validations:
23+
required: true
24+
- type: input
25+
id: os
26+
attributes:
27+
label: Operating System
28+
placeholder: "macOS 14.0 / Ubuntu 24.04 / Windows 11"
29+
validations:
30+
required: true
31+
- type: textarea
32+
id: command
33+
attributes:
34+
label: Command Run
35+
description: The exact command that caused the issue
36+
placeholder: "ossguard scan --json"
37+
validations:
38+
required: true
39+
- type: textarea
40+
id: expected
41+
attributes:
42+
label: Expected Behavior
43+
description: What you expected to happen
44+
validations:
45+
required: true
46+
- type: textarea
47+
id: actual
48+
attributes:
49+
label: Actual Behavior
50+
description: What actually happened (include error output if any)
51+
validations:
52+
required: true
53+
- type: textarea
54+
id: additional
55+
attributes:
56+
label: Additional Context
57+
description: Any other context, screenshots, or logs
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Feature Request
2+
description: Suggest a new feature or improvement
3+
labels: ["enhancement"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: Thanks for suggesting a feature! Please describe your idea below.
8+
- type: textarea
9+
id: problem
10+
attributes:
11+
label: Problem
12+
description: What problem does this feature solve?
13+
validations:
14+
required: true
15+
- type: textarea
16+
id: solution
17+
attributes:
18+
label: Proposed Solution
19+
description: How would you like this to work?
20+
validations:
21+
required: true
22+
- type: dropdown
23+
id: category
24+
attributes:
25+
label: Category
26+
options:
27+
- New analyzer/command
28+
- Existing command improvement
29+
- Output/reporting
30+
- CI/CD integration
31+
- Documentation
32+
- Other
33+
validations:
34+
required: true
35+
- type: textarea
36+
id: alternatives
37+
attributes:
38+
label: Alternatives Considered
39+
description: Any alternative solutions or workarounds you've considered

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Description
2+
3+
<!-- Brief description of what this PR does -->
4+
5+
## Type of Change
6+
7+
- [ ] Bug fix
8+
- [ ] New feature / command
9+
- [ ] Documentation update
10+
- [ ] CI/workflow change
11+
- [ ] Refactor (no functional change)
12+
13+
## Checklist
14+
15+
- [ ] Tests added/updated and passing (`pytest`)
16+
- [ ] Linting passes (`ruff check src/ tests/` and `ruff format --check src/ tests/`)
17+
- [ ] CHANGELOG.md updated (if user-facing change)
18+
- [ ] README.md updated (if new command or changed behavior)
19+
20+
## Related Issues
21+
22+
<!-- Link any related issues: Fixes #123, Relates to #456 -->

.github/workflows/binaries.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ on:
44
push:
55
tags: ["v*"]
66

7-
permissions:
8-
contents: write
7+
permissions: read-all
98

109
jobs:
1110
build:
@@ -25,9 +24,9 @@ jobs:
2524
runs-on: ${{ matrix.os }}
2625

2726
steps:
28-
- uses: actions/checkout@v6
27+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2928

30-
- uses: actions/setup-python@v6
29+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
3130
with:
3231
python-version: "3.12"
3332

@@ -57,7 +56,7 @@ jobs:
5756
shell: bash
5857

5958
- name: Upload artifact
60-
uses: actions/upload-artifact@v7
59+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
6160
with:
6261
name: ${{ matrix.artifact }}
6362
path: dist/${{ matrix.artifact }}
@@ -69,7 +68,7 @@ jobs:
6968
contents: write
7069
steps:
7170
- name: Download all artifacts
72-
uses: actions/download-artifact@v8
71+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
7372

7473
- name: Generate checksums
7574
run: |
@@ -81,7 +80,7 @@ jobs:
8180
sha256sum * > checksums-sha256.txt
8281
8382
- name: Upload to GitHub Release
84-
uses: softprops/action-gh-release@v2
83+
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
8584
with:
8685
files: release/*
8786
fail_on_unmatched_files: false

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
python-version: ["3.9", "3.10", "3.11", "3.12"]
1818

1919
steps:
20-
- uses: actions/checkout@v6
20+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2121
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v6
22+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525
- name: Install dependencies
@@ -34,8 +34,8 @@ jobs:
3434
lint:
3535
runs-on: ubuntu-latest
3636
steps:
37-
- uses: actions/checkout@v6
38-
- uses: actions/setup-python@v6
37+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
38+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
3939
with:
4040
python-version: "3.12"
4141
- run: pip install ruff

.github/workflows/codeql.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,19 @@ jobs:
3232

3333
steps:
3434
- name: Checkout repository
35-
uses: actions/checkout@v6
35+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3636

3737
- name: Initialize CodeQL
38-
uses: github/codeql-action/init@v3
38+
uses: github/codeql-action/init@f35333b910470a5408cb081b68f0701254a7d27b # v3.28.18
3939
with:
4040
languages: ${{ matrix.language }}
4141
# Use extended queries for more thorough analysis
4242
queries: security-extended
4343

4444
- name: Autobuild
45-
uses: github/codeql-action/autobuild@v3
45+
uses: github/codeql-action/autobuild@f35333b910470a5408cb081b68f0701254a7d27b # v3.28.18
4646

4747
- name: Perform CodeQL Analysis
48-
uses: github/codeql-action/analyze@v3
48+
uses: github/codeql-action/analyze@f35333b910470a5408cb081b68f0701254a7d27b # v3.28.18
4949
with:
5050
category: "/language:${{ matrix.language }}"

.github/workflows/docker.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,31 @@ on:
77
pull_request:
88
branches: [main]
99

10-
permissions:
11-
contents: read
12-
packages: write
10+
permissions: read-all
1311

1412
jobs:
1513
build-and-push:
1614
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
1718
steps:
18-
- uses: actions/checkout@v6
19+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1920

2021
- name: Set up Docker Buildx
21-
uses: docker/setup-buildx-action@v3
22+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
2223

2324
- name: Log in to GitHub Container Registry
2425
if: github.event_name != 'pull_request'
25-
uses: docker/login-action@v3
26+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
2627
with:
2728
registry: ghcr.io
2829
username: ${{ github.actor }}
2930
password: ${{ secrets.GITHUB_TOKEN }}
3031

3132
- name: Extract metadata
3233
id: meta
33-
uses: docker/metadata-action@v5
34+
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
3435
with:
3536
images: ghcr.io/${{ github.repository }}
3637
tags: |
@@ -40,7 +41,7 @@ jobs:
4041
type=sha
4142
4243
- name: Build and push
43-
uses: docker/build-push-action@v6
44+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
4445
with:
4546
context: .
4647
push: ${{ github.event_name != 'pull_request' }}

.github/workflows/release.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@ on:
55
tags:
66
- "v*"
77

8-
permissions:
9-
contents: write
10-
id-token: write
8+
permissions: read-all
119

1210
jobs:
1311
test:
1412
runs-on: ubuntu-latest
1513
steps:
16-
- uses: actions/checkout@v6
17-
- uses: actions/setup-python@v6
14+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
15+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
1816
with:
1917
python-version: "3.12"
2018
- run: pip install -e ".[dev]"
@@ -24,13 +22,13 @@ jobs:
2422
needs: test
2523
runs-on: ubuntu-latest
2624
steps:
27-
- uses: actions/checkout@v6
28-
- uses: actions/setup-python@v6
25+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2927
with:
3028
python-version: "3.12"
3129
- run: pip install build
3230
- run: python -m build
33-
- uses: actions/upload-artifact@v7
31+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
3432
with:
3533
name: dist
3634
path: dist/
@@ -42,19 +40,19 @@ jobs:
4240
permissions:
4341
id-token: write
4442
steps:
45-
- uses: actions/download-artifact@v8
43+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
4644
with:
4745
name: dist
4846
path: dist/
49-
- uses: pypa/gh-action-pypi-publish@release/v1
47+
- uses: pypa/gh-action-pypi-publish@6733eb7d741f0b11ec6a39b58540dab7590f9b7d # v1.14.0
5048

5149
github-release:
5250
needs: publish
5351
runs-on: ubuntu-latest
5452
permissions:
5553
contents: write
5654
steps:
57-
- uses: actions/checkout@v6
55+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5856
- name: Create GitHub Release
5957
env:
6058
GH_TOKEN: ${{ github.token }}

.github/workflows/sbom.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@ jobs:
2121

2222
steps:
2323
- name: Checkout code
24-
uses: actions/checkout@v6
24+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2525

2626
- name: Generate SBOM (SPDX)
27-
uses: anchore/sbom-action@v0
27+
uses: anchore/sbom-action@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0
2828
with:
2929
format: spdx-json
3030
output-file: sbom-spdx.json
3131

3232
- name: Generate SBOM (CycloneDX)
33-
uses: anchore/sbom-action@v0
33+
uses: anchore/sbom-action@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0
3434
with:
3535
format: cyclonedx-json
3636
output-file: sbom-cyclonedx.json
3737

3838
- name: Upload SBOMs as artifacts
39-
uses: actions/upload-artifact@v7
39+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
4040
with:
4141
name: sbom
4242
path: |
@@ -45,7 +45,7 @@ jobs:
4545
4646
- name: Attach SBOMs to release
4747
if: github.event_name == 'release'
48-
uses: softprops/action-gh-release@v2
48+
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
4949
with:
5050
files: |
5151
sbom-spdx.json

0 commit comments

Comments
 (0)