Skip to content

Commit 1ea1c50

Browse files
Review SCM files and security updates (#4)
1 parent db6eccf commit 1ea1c50

13 files changed

Lines changed: 315 additions & 470 deletions

.github/workflows/ci.yml

Lines changed: 22 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# SPDX-License-Identifier: AGPL-3.0-or-later
12
name: CI
23

34
on:
@@ -6,149 +7,37 @@ on:
67
pull_request:
78
branches: [ main ]
89

9-
jobs:
10-
test-python:
11-
runs-on: ubuntu-latest
12-
strategy:
13-
matrix:
14-
python-version: ['3.8', '3.9', '3.10', '3.11']
15-
16-
steps:
17-
- uses: actions/checkout@v3
18-
19-
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v4
21-
with:
22-
python-version: ${{ matrix.python-version }}
23-
24-
- name: Install dependencies
25-
run: |
26-
python -m pip install --upgrade pip
27-
pip install -e ".[dev]"
28-
29-
- name: Lint with flake8
30-
run: |
31-
flake8 src/python/ipv6tools --count --select=E9,F63,F7,F82 --show-source --statistics
32-
flake8 src/python/ipv6tools --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
33-
34-
- name: Run tests with pytest
35-
run: |
36-
pytest tests/python/ -v --cov=ipv6tools --cov-report=xml --cov-report=term
37-
38-
- name: Upload coverage to Codecov
39-
uses: codecov/codecov-action@v3
40-
with:
41-
file: ./coverage.xml
42-
flags: python
43-
name: python-${{ matrix.python-version }}
44-
45-
test-go:
46-
runs-on: ubuntu-latest
47-
strategy:
48-
matrix:
49-
go-version: ['1.20', '1.21']
50-
51-
steps:
52-
- uses: actions/checkout@v3
53-
54-
- name: Set up Go ${{ matrix.go-version }}
55-
uses: actions/setup-go@v4
56-
with:
57-
go-version: ${{ matrix.go-version }}
58-
59-
- name: Build Go tools
60-
run: |
61-
cd src/go
62-
go build -v ./cmd/ipv6-ping
63-
go build -v ./cmd/ipv6-scan
64-
65-
- name: Run Go tests
66-
run: |
67-
cd src/go
68-
go test -v ./...
69-
70-
test-web:
71-
runs-on: ubuntu-latest
72-
73-
steps:
74-
- uses: actions/checkout@v3
75-
76-
- name: Validate HTML
77-
run: |
78-
docker run --rm -v $(pwd)/src/web:/web ghcr.io/validator/validator:latest \
79-
vnu --also-check-css --also-check-svg /web/index.html || true
80-
81-
- name: Check JavaScript syntax
82-
uses: actions/setup-node@v3
83-
with:
84-
node-version: '18'
85-
86-
- name: Lint JavaScript
87-
run: |
88-
cd src/web
89-
npx jshint ipv6-tools.js app.js || true
10+
permissions: read-all
9011

12+
jobs:
9113
lint-shell:
9214
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
9317

9418
steps:
95-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
9620

9721
- name: Run ShellCheck
98-
uses: ludeeus/action-shellcheck@master
22+
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # v2.0.0
9923
with:
10024
scandir: './src/scripts'
10125

102-
docker-build:
103-
runs-on: ubuntu-latest
104-
105-
steps:
106-
- uses: actions/checkout@v3
107-
108-
- name: Build Docker image
109-
run: |
110-
docker build -t ipv6-only:test .
111-
112-
- name: Test Docker image
113-
run: |
114-
docker run --rm ipv6-only:test ipv6-validate 2001:db8::1
115-
116-
security:
26+
container-build:
11727
runs-on: ubuntu-latest
28+
permissions:
29+
contents: read
11830

11931
steps:
120-
- uses: actions/checkout@v3
121-
122-
- name: Run Bandit security scan
123-
run: |
124-
pip install bandit
125-
bandit -r src/python/ipv6tools/ -f json -o bandit-report.json || true
126-
127-
- name: Run Safety check
128-
run: |
129-
pip install safety
130-
safety check --json || true
131-
132-
release:
133-
runs-on: ubuntu-latest
134-
needs: [test-python, test-go, test-web, lint-shell]
135-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
136-
137-
steps:
138-
- uses: actions/checkout@v3
139-
140-
- name: Set up Python
141-
uses: actions/setup-python@v4
142-
with:
143-
python-version: '3.11'
144-
145-
- name: Build package
146-
run: |
147-
pip install build
148-
python -m build
149-
150-
- name: Publish to PyPI
151-
if: startsWith(github.ref, 'refs/tags')
152-
uses: pypa/gh-action-pypi-publish@release/v1
153-
with:
154-
password: ${{ secrets.PYPI_API_TOKEN }}
32+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
33+
34+
- name: Build container image with nerdctl/podman
35+
run: |
36+
if command -v nerdctl &> /dev/null; then
37+
nerdctl build -t ipv6-only:test -f Containerfile .
38+
elif command -v podman &> /dev/null; then
39+
podman build -t ipv6-only:test -f Containerfile .
40+
else
41+
echo "No supported container runtime found (nerdctl/podman)"
42+
exit 0
43+
fi
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
# SPDX-License-Identifier: AGPL-3.0-or-later
12
name: Container Policy
23
on: [push, pull_request]
4+
5+
permissions: read-all
6+
37
jobs:
48
check:
59
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
612
steps:
7-
- uses: actions/checkout@v4
13+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
814
- name: Enforce container policy
915
run: |
1016
# Block new Dockerfiles
@@ -13,12 +19,12 @@ jobs:
1319
echo "❌ New Dockerfile detected. Use Containerfile instead."
1420
exit 1
1521
fi
16-
22+
1723
# Check for docker command usage in scripts
1824
DOCKER_CMD=$(grep -r "docker build\|docker run\|docker push" --include="*.sh" --include="*.yml" --include="*.yaml" . 2>/dev/null | grep -v "nerdctl\|podman" | head -5 || true)
1925
if [ -n "$DOCKER_CMD" ]; then
2026
echo "⚠️ docker command found. Prefer nerdctl or podman:"
2127
echo "$DOCKER_CMD"
2228
fi
23-
29+
2430
echo "✅ Container policy check passed"
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
1+
# SPDX-License-Identifier: AGPL-3.0-or-later
12
name: Guix/Nix Package Policy
23
on: [push, pull_request]
4+
5+
permissions: read-all
6+
37
jobs:
48
check:
59
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
612
steps:
7-
- uses: actions/checkout@v4
13+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
814
- name: Enforce Guix primary / Nix fallback
915
run: |
1016
# Check for package manager files
1117
HAS_GUIX=$(find . -name "*.scm" -o -name ".guix-channel" -o -name "guix.scm" 2>/dev/null | head -1)
1218
HAS_NIX=$(find . -name "*.nix" 2>/dev/null | head -1)
13-
19+
1420
# Block new package-lock.json, yarn.lock, Gemfile.lock, etc.
1521
NEW_LOCKS=$(git diff --name-only --diff-filter=A HEAD~1 2>/dev/null | grep -E 'package-lock\.json|yarn\.lock|Gemfile\.lock|Pipfile\.lock|poetry\.lock|cargo\.lock' || true)
1622
if [ -n "$NEW_LOCKS" ]; then
1723
echo "⚠️ Lock files detected. Prefer Guix manifests for reproducibility."
1824
fi
19-
25+
2026
# Prefer Guix, fallback to Nix
2127
if [ -n "$HAS_GUIX" ]; then
2228
echo "✅ Guix package management detected (primary)"
@@ -25,5 +31,5 @@ jobs:
2531
else
2632
echo "ℹ️ Consider adding guix.scm or flake.nix for reproducible builds"
2733
fi
28-
34+
2935
echo "✅ Package policy check passed"

.github/workflows/jekyll-gh-pages.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
1+
# SPDX-License-Identifier: AGPL-3.0-or-later
2+
# Workflow for building and deploying a Jekyll site to GitHub Pages
23
name: Deploy Jekyll with GitHub Pages dependencies preinstalled
34

45
on:
@@ -25,18 +26,20 @@ jobs:
2526
# Build job
2627
build:
2728
runs-on: ubuntu-latest
29+
permissions:
30+
contents: read
2831
steps:
2932
- name: Checkout
30-
uses: actions/checkout@v4
33+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
3134
- name: Setup Pages
32-
uses: actions/configure-pages@v5
35+
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
3336
- name: Build with Jekyll
34-
uses: actions/jekyll-build-pages@v1
37+
uses: actions/jekyll-build-pages@44a6e6beabd48582f863aeeb6cb2151cc1716697 # v1.0.13
3538
with:
3639
source: ./
3740
destination: ./_site
3841
- name: Upload artifact
39-
uses: actions/upload-pages-artifact@v3
42+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
4043

4144
# Deployment job
4245
deploy:
@@ -45,7 +48,10 @@ jobs:
4548
url: ${{ steps.deployment.outputs.page_url }}
4649
runs-on: ubuntu-latest
4750
needs: build
51+
permissions:
52+
pages: write
53+
id-token: write
4854
steps:
4955
- name: Deploy to GitHub Pages
5056
id: deployment
51-
uses: actions/deploy-pages@v4
57+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

.github/workflows/quality.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,55 @@
1+
# SPDX-License-Identifier: AGPL-3.0-or-later
12
name: Code Quality
23
on: [push, pull_request]
34

5+
permissions: read-all
6+
47
jobs:
58
lint:
69
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
712
steps:
8-
- uses: actions/checkout@v4
9-
13+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
14+
1015
- name: Check file permissions
1116
run: |
1217
find . -type f -perm /111 -name "*.sh" | head -10 || true
13-
18+
1419
- name: Check for secrets
15-
uses: trufflesecurity/trufflehog@main
20+
uses: trufflesecurity/trufflehog@80e8293c5aaa80faf9b3e8fde13b80c04073d7ab # v3.63.6
1621
with:
1722
path: ./
1823
base: ${{ github.event.pull_request.base.sha || github.event.before }}
1924
head: ${{ github.sha }}
2025
continue-on-error: true
21-
26+
2227
- name: Check TODO/FIXME
2328
run: |
2429
echo "=== TODOs ==="
2530
grep -rn "TODO\|FIXME\|HACK\|XXX" --include="*.rs" --include="*.res" --include="*.py" --include="*.ex" . | head -20 || echo "None found"
26-
31+
2732
- name: Check for large files
2833
run: |
2934
find . -type f -size +1M -not -path "./.git/*" | head -10 || echo "No large files"
30-
35+
3136
- name: EditorConfig check
32-
uses: editorconfig-checker/action-editorconfig-checker@main
37+
uses: editorconfig-checker/action-editorconfig-checker@8f5440cbefd5428ba6a00b31c5a0b7abcd9a42fd # v2.0.0
3338
continue-on-error: true
3439

3540
docs:
3641
runs-on: ubuntu-latest
42+
permissions:
43+
contents: read
3744
steps:
38-
- uses: actions/checkout@v4
45+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
3946
- name: Check documentation
4047
run: |
4148
MISSING=""
4249
[ ! -f "README.md" ] && [ ! -f "README.adoc" ] && MISSING="$MISSING README"
4350
[ ! -f "LICENSE" ] && [ ! -f "LICENSE.txt" ] && [ ! -f "LICENSE.md" ] && MISSING="$MISSING LICENSE"
4451
[ ! -f "CONTRIBUTING.md" ] && [ ! -f "CONTRIBUTING.adoc" ] && MISSING="$MISSING CONTRIBUTING"
45-
52+
4653
if [ -n "$MISSING" ]; then
4754
echo "::warning::Missing docs:$MISSING"
4855
else

.github/workflows/rsr-antipattern.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# RSR Anti-Pattern CI Check
21
# SPDX-License-Identifier: AGPL-3.0-or-later
3-
#
2+
# RSR Anti-Pattern CI Check
43
# Enforces: No TypeScript, No Go, No Python (except SaltStack), No npm
54
# Allows: ReScript, Deno, WASM, Rust, OCaml, Haskell, Guile/Scheme
65

@@ -12,11 +11,15 @@ on:
1211
pull_request:
1312
branches: [main, master, develop]
1413

14+
permissions: read-all
15+
1516
jobs:
1617
antipattern-check:
1718
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
1821
steps:
19-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2023

2124
- name: Check for TypeScript
2225
run: |

0 commit comments

Comments
 (0)