Skip to content

Commit 26929c1

Browse files
authored
Merge pull request #415 from codeX-james/fix/issues-300-301-302-309
fix: add issue/PR templates, npm+cargo audit gates, and SRI check (#301 #302 #309)
2 parents ef4f0f6 + 8f00af2 commit 26929c1

6 files changed

Lines changed: 176 additions & 17 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug Report
3+
about: Report a bug or unexpected behaviour in Stellar Goal Vault
4+
title: "[Bug] "
5+
labels: bug
6+
assignees: ""
7+
---
8+
9+
## Description
10+
11+
A clear and concise description of the bug.
12+
13+
## Steps to Reproduce
14+
15+
1. Go to '...'
16+
2. Click on '...'
17+
3. Scroll down to '...'
18+
4. See error
19+
20+
## Expected Behaviour
21+
22+
What you expected to happen.
23+
24+
## Actual Behaviour
25+
26+
What actually happened. Include error messages, screenshots, or logs where relevant.
27+
28+
## Environment
29+
30+
| Field | Value |
31+
|-------|-------|
32+
| OS | e.g. macOS 14, Ubuntu 22.04 |
33+
| Browser / Runtime | e.g. Chrome 124, Node 18.x |
34+
| Repo version / commit | e.g. `main` @ `abc1234` |
35+
36+
## Additional Context
37+
38+
Add any other context about the problem here.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Feature Request
3+
about: Suggest a new feature or improvement for Stellar Goal Vault
4+
title: "[Feature] "
5+
labels: enhancement
6+
assignees: ""
7+
---
8+
9+
## Problem
10+
11+
A clear description of the problem this feature would solve.
12+
e.g. "I'm always frustrated when..."
13+
14+
## Proposed Solution
15+
16+
Describe the feature you'd like and how it should work.
17+
18+
## Alternatives Considered
19+
20+
List any alternative solutions or features you considered and why you ruled them out.
21+
22+
## Acceptance Criteria
23+
24+
- [ ]
25+
- [ ]
26+
- [ ]
27+
28+
## Additional Context
29+
30+
Add screenshots, mockups, or any other context that helps explain the request.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
# Pull Request
22

3-
## 🗒️ Description
4-
A clear and concise description of the changes you've made.
3+
## What Changed
54

6-
## 🔗 Related Issue
7-
- Closes #[issue-number]
8-
- Fixes #[issue-number]
5+
A clear and concise description of what this PR changes and why.
96

10-
## ✅ Checklist
11-
- [ ] My code follows the existing style and patterns of the project.
12-
- [ ] I have added/updated tests for my changes.
13-
- [ ] All tests pass locally (`npm run test`).
14-
- [ ] If changing the UI, I have added screenshots/videos to this PR.
15-
- [ ] My PR has a descriptive title.
7+
## Related Issues
168

17-
## 📸 Screenshots (if applicable)
18-
Add any visual changes here to help reviewers.
9+
- Closes #
10+
- Fixes #
11+
12+
## Testing Done
13+
14+
Describe the tests you ran and how to reproduce them.
1915

20-
## 🛠️ Testing Steps
21-
How can the reviewer verify your changes?
2216
1.
2317
2.
2418
3.
2519

26-
---
27-
Thank you for your contribution! 🚀
20+
## Checklist
21+
22+
- [ ] Code follows the existing style and patterns of the project
23+
- [ ] Tests added or updated to cover the change
24+
- [ ] All tests pass locally (`npm test` / `cargo test`)
25+
- [ ] UI changes include screenshots or a screen recording
26+
- [ ] PR title is descriptive and references the issue number
27+
28+
## Screenshots (if applicable)
29+
30+
Add screenshots or recordings for visual changes.

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,23 @@ jobs:
3535
working-directory: backend
3636
run: npm run lint
3737

38+
- name: Audit backend dependencies
39+
working-directory: backend
40+
run: npm audit --audit-level=high
41+
continue-on-error: false
42+
43+
- name: Upload backend audit report
44+
if: always()
45+
run: npm audit --json --audit-level=none > /tmp/backend-audit.json 2>&1 || true
46+
working-directory: backend
47+
48+
- name: Upload backend audit artifact
49+
if: always()
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: backend-npm-audit
53+
path: /tmp/backend-audit.json
54+
3855
frontend-build:
3956
name: Frontend Build
4057
runs-on: ubuntu-latest
@@ -62,6 +79,26 @@ jobs:
6279
working-directory: frontend
6380
run: npm run lint
6481

82+
- name: Check SRI integrity attributes on CDN assets
83+
run: bash scripts/check-sri.sh frontend/index.html
84+
85+
- name: Audit frontend dependencies
86+
working-directory: frontend
87+
run: npm audit --audit-level=high
88+
continue-on-error: false
89+
90+
- name: Upload frontend audit report
91+
if: always()
92+
run: npm audit --json --audit-level=none > /tmp/frontend-audit.json 2>&1 || true
93+
working-directory: frontend
94+
95+
- name: Upload frontend audit artifact
96+
if: always()
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: frontend-npm-audit
100+
path: /tmp/frontend-audit.json
101+
65102
contract-build:
66103
name: Contract Build
67104
runs-on: ubuntu-latest

.github/workflows/contracts-ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@ jobs:
3838
restore-keys: |
3939
${{ runner.os }}-cargo-
4040
41+
- name: Install cargo-audit
42+
run: cargo install cargo-audit --locked
43+
44+
- name: Audit Cargo dependencies
45+
working-directory: contracts
46+
run: cargo audit 2>&1 | tee /tmp/cargo-audit.txt; exit ${PIPESTATUS[0]}
47+
48+
- name: Upload cargo audit artifact
49+
if: always()
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: cargo-audit-report
53+
path: /tmp/cargo-audit.txt
54+
4155
- name: Run clippy (deny all warnings)
4256
working-directory: contracts
4357
run: cargo clippy --all-targets --all-features -- -D warnings

scripts/check-sri.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
# Verify every external <link> and <script> tag in index.html carries integrity + crossorigin attributes.
3+
# Exits non-zero if any CDN resource lacks an integrity hash.
4+
5+
set -euo pipefail
6+
7+
HTML_FILE="${1:-frontend/index.html}"
8+
9+
if [ ! -f "$HTML_FILE" ]; then
10+
echo "ERROR: $HTML_FILE not found"
11+
exit 1
12+
fi
13+
14+
ERRORS=0
15+
16+
while IFS= read -r line; do
17+
# Match <link> or <script> tags that load from an external URL (http/https)
18+
if echo "$line" | grep -qiE '<(link|script)[^>]+(href|src)="https?://'; then
19+
if ! echo "$line" | grep -q 'integrity='; then
20+
echo "MISSING integrity: $line"
21+
ERRORS=$((ERRORS + 1))
22+
fi
23+
if ! echo "$line" | grep -q 'crossorigin='; then
24+
echo "MISSING crossorigin: $line"
25+
ERRORS=$((ERRORS + 1))
26+
fi
27+
fi
28+
done < "$HTML_FILE"
29+
30+
if [ "$ERRORS" -gt 0 ]; then
31+
echo ""
32+
echo "SRI check FAILED: $ERRORS attribute(s) missing."
33+
echo "Generate a hash with: openssl dgst -sha384 -binary <file> | openssl base64 -A"
34+
exit 1
35+
fi
36+
37+
echo "SRI check passed — all CDN resources carry integrity and crossorigin attributes."

0 commit comments

Comments
 (0)