Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 148 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
## 📋 Pull Request Summary

<!-- Provide a brief description of your changes -->

## 🎯 Changes Made

<!-- List the key changes in this PR -->
-
-
-

## 🤖 Bot Metadata

<!-- Auto-generated bot information (if applicable) -->
- **Bot Version**: 1.0.0
- **Execution Mode**: 🔒 DRY_RUN / 🚀 LIVE
- **Scan Type**: Security / Audit / Health / Full
- **Timestamp**: YYYY-MM-DD HH:MM:SS UTC

## ✅ Safety Checklist

<!-- Check all that apply -->
- [ ] All changes reviewed and tested
- [ ] No secrets or credentials included in code
- [ ] All scripts default to safe, non-destructive mode (DRY_RUN=true)
- [ ] Documentation updated to reflect changes
- [ ] Workflow permissions are minimal and appropriate
- [ ] Bot pings disabled by default (opt-in only)
- [ ] Changes are backward compatible
- [ ] Tests pass locally
- [ ] No breaking changes introduced

## 🔍 Testing Evidence

<!-- Describe how you tested your changes -->
- **Test Environment**: Local / CI / Staging
- **Test Results**:
- **Manual Testing**:

### Security Scan Results
<!-- If security scan was run -->
- 🔒 Hardcoded secrets detection: ✅ Pass / ⚠️ Review needed
- 🔐 Vulnerability scanning: ✅ Pass / ⚠️ Review needed
- 📊 Code quality checks: ✅ Pass / ⚠️ Review needed

### Audit Results
<!-- If code audit was run -->
- 📁 Repository structure: ✅ Valid
- 📈 Code metrics:
- 🧾 Compliance: ✅ Pass / ⚠️ Review needed

### Health Check
<!-- If health check was run -->
- ❤️ Configuration validation: ✅ Pass
- 🩺 Dependency health: ✅ Pass / ⚠️ Needs attention
- 📋 Status: 🟢 Healthy / 🟡 Warning / 🔴 Critical

## 🛡️ Security Notes

<!-- Security-related information -->
- **Secrets Required**: Yes / No
- If yes, list required secrets (but NOT the actual values!)
- **Permissions Changed**: Yes / No
- If yes, describe the changes
- **External Dependencies**: Yes / No
- If yes, list new dependencies

### Security Review
- [ ] No new secrets introduced in code
- [ ] All credentials managed via environment variables
- [ ] Third-party dependencies audited
- [ ] No suspicious network calls
- [ ] Input validation implemented
- [ ] Error handling appropriate

## 📊 Audit Artifacts

<!-- Links to generated reports and artifacts -->
- Security Scan Report: [Link or "See workflow artifacts"]
- Audit Report: [Link or "See workflow artifacts"]
- Health Check Report: [Link or "See workflow artifacts"]
- Bot Logs: [Link or "See workflow artifacts"]

### Workflow Run
- **Workflow**: [Link to GitHub Actions run]
- **Status**: ✅ Success / ⚠️ Warning / ❌ Failed
- **Duration**: X minutes
- **Artifacts**: [Link to downloadable artifacts]

## 🔗 Related Issues

<!-- Link related issues or PRs -->
Closes #
Related to #

## 📚 Documentation

<!-- Links to relevant documentation -->
- Architecture changes documented in:
- Usage guide updated:
- Security implications documented:

## 🚀 Deployment Notes

<!-- If this PR includes deployment changes -->
- **Deployment Target**: Testnet / Mainnet
- **Network**: Base / Solana / Other
- **Pre-deployment Steps**:
- **Post-deployment Verification**:
- **Rollback Plan**:

## 💬 Additional Context

<!-- Any other information reviewers should know -->

## 👥 Reviewers

<!-- Tag specific people for review -->
@SolanaRemix @smsdao @SmartBrain

---

## 🤖 Automated PR Information

<!-- This section can be populated by automation -->

### GitAntivirus Bot Activity
- **Repositories Scanned**: N/A
- **PRs Created**: 0
- **Pings Sent**: 0 (disabled by default)
- **Errors**: None

### Configuration Used
```json
{
"dry_run": true,
"bot_pings_enabled": false,
"allowlist_orgs": [],
"max_prs_per_run": 3
}
```

---

**🔒 Security First**: This PR follows security best practices with conservative defaults and dry-run mode enabled.

**✨ Created**: YYYY-MM-DD
**🧠 Powered by**: SmartBrain / SMSDAO / GitAntivirus
220 changes: 220 additions & 0 deletions .github/workflows/gitantivirus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
name: 🛡️ GitAntivirus - Smart Contract Security

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
schedule:
- cron: '0 0 * * 1' # Weekly on Monday at midnight UTC
workflow_dispatch:
inputs:
dry_run:
description: 'Enable dry-run mode'
required: false
default: 'true'
type: choice
options:
- 'true'
- 'false'
scan_type:
description: 'Type of scan to perform'
required: false
default: 'full'
type: choice
options:
- 'scan'
- 'audit'
- 'health'
- 'full'

permissions:
contents: read
pull-requests: write
issues: write

env:
DRY_RUN: ${{ github.event.inputs.dry_run || 'true' }}
BOT_PINGS_ENABLED: false
ALLOWLIST_ORGS: ""
SCAN_TYPE: ${{ github.event.inputs.scan_type || 'full' }}

jobs:
gitantivirus-scan:
name: 🔍 Security Scan & Audit
runs-on: ubuntu-latest

steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 🔧 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'

- name: 📦 Install pnpm
run: |
npm install -g pnpm
pnpm --version

- name: 📥 Install dependencies
run: |
if [ -f "package.json" ]; then
pnpm install --frozen-lockfile || pnpm install
else
echo "No package.json found, skipping dependency installation"
fi

- name: ✅ Make scripts executable
run: |
chmod +x scripts/*.sh
ls -la scripts/

- name: 🔧 SMSDAO Repair (Dry-run check)
if: env.DRY_RUN == 'true'
run: |
echo "🔒 Running in DRY_RUN mode - no modifications will be made"
if [ -f "config/repair.json" ]; then
cat config/repair.json
fi

- name: 🧠 SmartBrain - Security Scan
if: env.SCAN_TYPE == 'scan' || env.SCAN_TYPE == 'full'
run: |
echo "Running security scan..."
DRY_RUN=${{ env.DRY_RUN }} VERBOSE=true ./scripts/master.sh scan

- name: 🧠 SmartBrain - Code Audit
if: env.SCAN_TYPE == 'audit' || env.SCAN_TYPE == 'full'
run: |
echo "Running code audit..."
DRY_RUN=${{ env.DRY_RUN }} VERBOSE=true ./scripts/master.sh audit

- name: 🧠 SmartBrain - Health Check
if: env.SCAN_TYPE == 'health' || env.SCAN_TYPE == 'full'
run: |
echo "Running health check..."
DRY_RUN=${{ env.DRY_RUN }} VERBOSE=true ./scripts/master.sh health

- name: 📊 Upload Scan Artifacts
if: always() && env.DRY_RUN == 'false'
uses: actions/upload-artifact@v4
with:
name: gitantivirus-reports-${{ github.run_number }}
path: |
reports/
SECURITY-SUMMARY*.md
retention-days: 30
if-no-files-found: ignore

- name: 🏷️ Add Labels
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
continue-on-error: true
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const labels = ['security', 'gitantivirus', 'automated-scan'];
try {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: labels
});
console.log('✅ Labels added successfully');
} catch (error) {
console.log('⚠️ Could not add labels:', error.message);
}

- name: 💬 Sticky PR Comment
if: |
github.event_name == 'pull_request' &&
env.BOT_PINGS_ENABLED == 'true' &&
github.repository_owner == 'SolanaRemix'
uses: actions/github-script@v7
continue-on-error: true
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const body = `## 🛡️ GitAntivirus Security Report

**Scan completed:** ${new Date().toUTCString()}
**Mode:** ${process.env.DRY_RUN === 'true' ? '🔒 DRY RUN' : '🚀 LIVE'}
**Scan Type:** ${process.env.SCAN_TYPE}

### 📊 Results
- ✅ Security scan completed
- ✅ Code audit completed
- ✅ Health check completed

### 🔔 Notifications
${process.env.BOT_PINGS_ENABLED === 'true' ? '@SolanaRemix @smsdao @SmartBrain' : '_Pings disabled_'}

---
_This is an automated security scan. Reports are available in workflow artifacts._
`;

const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
});

const existingComment = comments.data.find(c =>
c.user.login === 'github-actions[bot]' &&
c.body.includes('GitAntivirus Security Report')
);

if (existingComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existingComment.id,
body: body
});
console.log('✅ Updated existing comment');
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: body
});
console.log('✅ Created new comment');
}

- name: 📌 Add to Project
if: env.DRY_RUN == 'false'
uses: actions/github-script@v7
continue-on-error: true
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const projectUrl = process.env.PROJECT_URL;
if (projectUrl) {
console.log('📌 Project URL configured');
// Project integration would go here if PROJECT_URL is set
} else {
console.log('⚠️ No PROJECT_URL configured');
}
env:
PROJECT_URL: ${{ secrets.PROJECT_URL }}

- name: 📝 Summary
if: always()
run: |
echo "## 🛡️ GitAntivirus Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **Mode:** ${DRY_RUN}" >> $GITHUB_STEP_SUMMARY
echo "- **Scan Type:** ${SCAN_TYPE}" >> $GITHUB_STEP_SUMMARY
echo "- **Status:** ✅ Complete" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Configuration" >> $GITHUB_STEP_SUMMARY
echo "- DRY_RUN: ${DRY_RUN}" >> $GITHUB_STEP_SUMMARY
echo "- BOT_PINGS_ENABLED: ${BOT_PINGS_ENABLED}" >> $GITHUB_STEP_SUMMARY
echo "- ALLOWLIST_ORGS: ${ALLOWLIST_ORGS:-'(empty)'}" >> $GITHUB_STEP_SUMMARY
Loading