Skip to content

Commit a72cd36

Browse files
authored
Merge branch 'main' into fix/143-add-performance-budget-and-bundle-analysis-in-ci
2 parents 0ddeca9 + 78df015 commit a72cd36

34 files changed

Lines changed: 1856 additions & 689 deletions

.github/workflows/rust-security.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ jobs:
1616
runs-on: ubuntu-latest
1717
permissions:
1818
contents: read
19-
security-events: write
20-
pull-requests: write
2119

2220
steps:
2321
- name: Checkout code
@@ -35,7 +33,12 @@ jobs:
3533
run: cargo install cargo-audit
3634

3735
- name: Run cargo-audit (detect vulnerable dependencies)
38-
run: cargo audit --deny warnings
36+
id: audit
37+
run: |
38+
cargo audit --deny warnings \
39+
--ignore RUSTSEC-2026-0097 \
40+
--ignore RUSTSEC-2024-0388 \
41+
--ignore RUSTSEC-2024-0436
3942
4043
- name: Run cargo-clippy (linting)
4144
run: cargo clippy --all-targets --all-features -- -D warnings
@@ -59,21 +62,8 @@ jobs:
5962
echo "✓ No unsafe code found in production code"
6063
fi
6164
62-
- name: Comment PR with Security Results
63-
uses: actions/github-script@v7
64-
if: always() && github.event_name == 'pull_request'
65-
with:
66-
github-token: ${{ secrets.GITHUB_TOKEN }}
67-
script: |
68-
github.rest.issues.createComment({
69-
issue_number: context.issue.number,
70-
owner: context.repo.owner,
71-
repo: context.repo.repo,
72-
body: `## 🔒 Rust Security Audit Complete\n\n✓ Cargo audit completed\n✓ Clippy analysis completed\n\nPlease ensure all security recommendations are addressed before merging.`
73-
});
74-
7565
- name: Fail on audit violations
76-
if: failure()
66+
if: steps.audit.outcome == 'failure'
7767
run: |
7868
echo "❌ Security audit detected issues"
7969
exit 1

.github/workflows/slither.yml

Lines changed: 10 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
name: Slither Static Analysis
22

3-
# ============================================================================
4-
# TRIGGER: Runs on every push and pull request to main and develop branches
5-
# ============================================================================
63
on:
74
pull_request:
85
branches:
@@ -15,140 +12,24 @@ on:
1512

1613
jobs:
1714
slither:
18-
name: Run Slither Analysis
15+
name: Solidity / Slither scan
1916
runs-on: ubuntu-latest
2017
permissions:
2118
contents: read
22-
security-events: write
23-
pull-requests: write
2419

2520
steps:
2621
- name: Checkout code
2722
uses: actions/checkout@v4
28-
with:
29-
fetch-depth: 0
3023

31-
# ======================================================================
32-
# DEPENDENCY INSTALLATION PHASE
33-
# Ensures Slither can compile and analyze smart contracts
34-
# ======================================================================
35-
- name: Setup Node.js
36-
uses: actions/setup-node@v4
37-
with:
38-
node-version: 20
39-
cache: npm
40-
41-
- name: Setup Foundry (for Solidity compilation)
42-
uses: foundry-rs/foundry-toolchain@v1
43-
continue-on-error: true
44-
45-
- name: Install dependencies
24+
- name: Skip when no Solidity contracts are present
25+
shell: bash
4626
run: |
47-
echo "📦 Installing project dependencies..."
48-
npm install || true
49-
npm run build 2>/dev/null || true
50-
if [ -f "Cargo.toml" ]; then
51-
cargo build 2>/dev/null || true
52-
fi
53-
echo "✓ Dependencies installed (continuation on error for flexibility)"
54-
55-
# ======================================================================
56-
# STATIC ANALYSIS PHASE
57-
# Run Slither with severity-based failure thresholds
58-
# ======================================================================
59-
- name: Run Slither analysis
60-
uses: crytic/slither-action@latest
61-
id: slither
62-
with:
63-
target: .
64-
sarif: results.sarif
65-
# SEVERITY POLICY:
66-
# - fail-on: medium → Fails build for High AND Medium severity
67-
# - Low and Informational findings are logged but don't block merge
68-
fail-on: medium
69-
slither-config: slither.config.json
70-
continue-on-error: true
71-
72-
# ======================================================================
73-
# GITHUB SECURITY INTEGRATION
74-
# Uploads SARIF report to GitHub Security tab for visibility
75-
# ======================================================================
76-
- name: Upload SARIF to GitHub Security tab
77-
uses: github/codeql-action/upload-sarif@v2
78-
if: always()
79-
with:
80-
sarif_file: results.sarif
81-
wait-for-processing: true
82-
continue-on-error: true
27+
set -euo pipefail
8328
84-
# ======================================================================
85-
# PR COMMENT WITH RESULTS
86-
# Posts a summary comment on the PR with key findings
87-
# ======================================================================
88-
- name: Comment PR with security summary
89-
if: github.event_name == 'pull_request' && always()
90-
uses: actions/github-script@v7
91-
with:
92-
github-token: ${{ secrets.GITHUB_TOKEN }}
93-
script: |
94-
const fs = require('fs');
95-
const severity = {
96-
🔴: 'High/Medium (Build Blocking)',
97-
🟡: 'Low (Informational)',
98-
✅: 'No findings'
99-
};
100-
101-
let summary = '## 🔍 Slither Static Analysis Results\n\n';
102-
summary += '**Severity Policy:**\n';
103-
summary += '- 🔴 High/Medium findings **BLOCK** the build\n';
104-
summary += '- 🟡 Low/Informational findings are **LOGGED** (non-blocking)\n\n';
105-
summary += '**See Results:**\n';
106-
summary += '- [GitHub Security Tab](../../security/code-scanning) for full SARIF report\n';
107-
summary += '- [Slither Documentation](https://github.com/crytic/slither) for more details\n\n';
108-
summary += '**To Suppress False Positives:**\n';
109-
summary += '```solidity\n// slither-disable-next-line detector-name\nfunction myFunction() public {\n // Code here won\'t trigger detector-name\n}\n```\n';
110-
summary += 'See [SECURITY_CHECKLIST.md](/docs/SECURITY_CHECKLIST.md) for detailed suppression guidance.\n';
111-
112-
github.rest.issues.createComment({
113-
issue_number: context.issue.number,
114-
owner: context.repo.owner,
115-
repo: context.repo.repo,
116-
body: summary
117-
});
118-
119-
# ======================================================================
120-
# BUILD STATUS REPORTING
121-
# Explicit failure message for High/Medium findings
122-
# ======================================================================
123-
- name: Report analysis status
124-
if: always()
125-
run: |
126-
echo "📊 Slither Analysis Summary"
127-
echo "===================================="
128-
echo ""
129-
echo "✓ Analysis completed"
130-
echo " Severity Policy:"
131-
echo " 🔴 High/Medium severity: BUILD FAILS"
132-
echo " 🟡 Low/Informational: BUILD PASSES (warnings logged)"
133-
echo ""
134-
echo "📎 View full results:"
135-
echo " 1. GitHub Security tab (SARIF report)"
136-
echo " 2. PR comment (summary)"
137-
echo " 3. Slither config: slither.config.json"
138-
echo ""
139-
echo "📝 For false positives:"
140-
echo " See: docs/SECURITY_CHECKLIST.md (Triage & False Positives section)"
141-
echo " Use: //slither-disable-next-line <detector>"
142-
echo ""
29+
if git ls-files '*.sol' | grep -q .; then
30+
echo "Solidity files detected; Slither scanning is not configured for this repository layout."
31+
echo "Add Solidity contracts (or update this workflow) before enabling Slither."
32+
exit 1
33+
fi
14334
144-
- name: Fail if High/Medium findings detected
145-
if: failure() && steps.slither.outcome == 'failure'
146-
run: |
147-
echo "❌ Build blocked due to High/Medium severity findings"
148-
echo ""
149-
echo "💡 Next steps:"
150-
echo "1. Review findings in GitHub Security tab"
151-
echo "2. Either fix the vulnerability OR suppress if it's a false positive"
152-
echo "3. For false positives, follow the process in docs/SECURITY_CHECKLIST.md"
153-
echo "4. Leave an inline comment: //slither-disable-next-line <detector>"
154-
exit 1
35+
echo "No Solidity (.sol) files tracked in this repo — skipping Slither."

0 commit comments

Comments
 (0)