security scan on every monday #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Security Scan | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| schedule: | |
| # Run weekly on Monday at 9 AM | |
| - cron: '0 9 * * 1' | |
| jobs: | |
| terrasecure-scan: | |
| name: TerraSecure Self-Scan | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| security-events: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install TerraSecure | |
| run: | | |
| pip install -r requirements.txt | |
| - name: Build ML model if missing | |
| run: | | |
| if [ ! -f "models/terrasecure_production_v1.0.pkl" ]; then | |
| echo "Building ML model..." | |
| python scripts/build_production_model.py | |
| fi | |
| - name: Run TerraSecure scan | |
| run: | | |
| python src/cli.py examples/vulnerable --format sarif --output terrasecure-results.sarif | |
| continue-on-error: true | |
| - name: Upload SARIF results | |
| uses: github/codeql-action/upload-sarif@v3 | |
| if: always() | |
| with: | |
| sarif_file: terrasecure-results.sarif | |
| category: terrasecure | |
| - name: Display results | |
| if: always() | |
| run: | | |
| echo " Security scan complete" | |
| echo " Results uploaded to Security tab" | |
| python src/cli.py examples/vulnerable |