Skip to content

Commit 378e6a0

Browse files
committed
fix: linting
- ensure credentials are not persisted past checkout of code - add zizmor.yml file to linters to allow pull_request_target in actions for auto-labeler to work on fork pull requests - add trivy.yml file to linters to ignore mypy_cache directory - add HEALTHCHECK and non-root user to Dockerfile Signed-off-by: jmeridth <[email protected]>
1 parent 47fdd04 commit 378e6a0

File tree

7 files changed

+28
-4
lines changed

7 files changed

+28
-4
lines changed

.github/linters/trivy.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
scan:
2+
skip-dirs:
3+
- .mypy_cache

.github/linters/zizmor.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
rules:
2+
dangerous-triggers: # to allow pull_request_target for auto-labelling fork pull requests
3+
ignore:
4+
- auto-labeler.yml
5+
- pr-title.yml
6+
- release.yml

.github/workflows/copilot-setup-steps.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ jobs:
2727
steps:
2828
- name: Checkout code
2929
uses: actions/[email protected]
30+
with:
31+
persist-credentials: false
3032

3133
- name: Set up Python
32-
uses: actions/setup-python@v5.6.0
34+
uses: actions/setup-python@v6.0.0
3335
with:
3436
python-version: 3.12
3537

.github/workflows/docker-ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/[email protected]
18+
with:
19+
persist-credentials: false
1820
- name: Build the Docker image
1921
run: docker build . --file Dockerfile --platform linux/amd64

.github/workflows/python-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
steps:
2323
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2424
- name: Set up Python ${{ matrix.python-version }}
25-
uses: actions/setup-python@v5.6.0
25+
uses: actions/setup-python@v6.0.0
2626
with:
2727
python-version: ${{ matrix.python-version }}
2828
- name: Install dependencies

.github/workflows/super-linter.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ jobs:
2222
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2323
with:
2424
fetch-depth: 0
25+
persist-credentials: false
2526
- name: Setup Python
26-
uses: actions/setup-python@v5.6.0
27+
uses: actions/setup-python@v6.0.0
2728
with:
2829
python-version: "3.12"
2930
- name: Install dependencies

Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,17 @@ COPY requirements.txt *.py /action/workspace/
99
RUN python3 -m pip install --no-cache-dir -r requirements.txt \
1010
&& apt-get -y update \
1111
&& apt-get -y install --no-install-recommends git=1:2.39.5-0+deb12u2 \
12-
&& rm -rf /var/lib/apt/lists/*
12+
&& rm -rf /var/lib/apt/lists/* \
13+
&& addgroup --system appuser \
14+
&& adduser --system --ingroup appuser --home /action/workspace --disabled-login appuser \
15+
&& chown -R appuser:appuser /action/workspace
16+
17+
# Run the action as a non-root user
18+
USER appuser
19+
20+
# Add a simple healthcheck to satisfy container scanners
21+
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
22+
CMD python3 -c "import os,sys; sys.exit(0 if os.path.exists('/action/workspace/evergreen.py') else 1)"
1323

1424
CMD ["/action/workspace/evergreen.py"]
1525
ENTRYPOINT ["python3", "-u"]

0 commit comments

Comments
 (0)