Skip to content

Commit 4fe2d8e

Browse files
stremovskyclaude
andcommitted
Add Semgrep SAST workflow, pin CI actions, document security
- Add semgrep.yml caller for the shared reusable SAST workflow - Pin checkout/setup-python (@v2 -> v4/v5 SHAs) across all jobs - Add Security section and Features bullet to README Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 87f3da7 commit 4fe2d8e

3 files changed

Lines changed: 49 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
python-version: [3.9, '3.10']
1616

1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
1919

2020
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v2
21+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
2222
with:
2323
python-version: ${{ matrix.python-version }}
2424

@@ -38,10 +38,10 @@ jobs:
3838
lint:
3939
runs-on: ubuntu-latest
4040
steps:
41-
- uses: actions/checkout@v2
41+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
4242

4343
- name: Set up Python
44-
uses: actions/setup-python@v2
44+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
4545
with:
4646
python-version: '3.10'
4747

@@ -64,10 +64,10 @@ jobs:
6464
if: github.ref == 'refs/heads/main'
6565
runs-on: ubuntu-latest
6666
steps:
67-
- uses: actions/checkout@v2
67+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
6868

6969
- name: Set up Python
70-
uses: actions/setup-python@v2
70+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
7171
with:
7272
python-version: '3.10'
7373

.github/workflows/semgrep.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Caller: scans THIS repo using the shared reusable Semgrep workflow in databunker-devops.
2+
# Ruleset = Python language pack + the common security packs (see semgrep-reusable.yml).
3+
name: semgrep
4+
5+
on:
6+
workflow_dispatch: # manual "Run workflow" button in the Actions tab
7+
pull_request:
8+
push:
9+
branches: [main]
10+
schedule:
11+
- cron: "13 7 * * 1" # weekly full sweep (Mon 07:13 UTC) — offset from gitleaks (06:27)
12+
13+
permissions:
14+
contents: read
15+
security-events: write
16+
17+
jobs:
18+
sast:
19+
name: sast # display + required-check name
20+
uses: securitybunker/databunker-devops/.github/workflows/semgrep-reusable.yml@main
21+
with:
22+
config: "p/python p/secrets p/security-audit p/owasp-top-ten"

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ print(f"Created token in uuid format: {token_result['tokenuuid']}")
6262
- System Statistics
6363
- Type hints and comprehensive documentation
6464
- Error handling and validation
65+
- Continuous security scanning (Semgrep SAST, pinned CI actions)
6566

6667
## Development
6768

@@ -83,6 +84,26 @@ pip install -e ".[dev]"
8384
pytest
8485
```
8586

87+
## Security
88+
89+
This library is scanned on every push and pull request, with a weekly scheduled sweep to catch drift:
90+
91+
- **SAST (Semgrep):** static analysis using the `p/python`, `p/secrets`, `p/security-audit`, and `p/owasp-top-ten` rulesets. A finding fails the check, and results are published to the repository's **Code Scanning** tab. See [`.github/workflows/semgrep.yml`](.github/workflows/semgrep.yml).
92+
- **Supply-chain hardening:** every GitHub Action is pinned to a full commit SHA, so a mutable tag (`@v4`) cannot be silently repointed to malicious code.
93+
94+
Reproduce the SAST scan locally:
95+
96+
```bash
97+
pip install semgrep
98+
semgrep scan \
99+
--config p/python \
100+
--config p/secrets \
101+
--config p/security-audit \
102+
--config p/owasp-top-ten
103+
```
104+
105+
To report a security vulnerability, please email hello@databunker.org rather than opening a public issue.
106+
86107
## Contributing
87108

88109
Contributions are welcome! Please feel free to submit a Pull Request.

0 commit comments

Comments
 (0)