- 
                Notifications
    You must be signed in to change notification settings 
- Fork 14
chore: Update security scan #225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            12 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      51199cd
              
                Update Trivy scan
              
              
                AmberJBlue 3d07f5f
              
                Add bandit scan
              
              
                AmberJBlue fa2459d
              
                Merge pull request #1 from AmberJBlue/update-security-scan
              
              
                AmberJBlue 9fad0a0
              
                Exclude tests in bandit scan
              
              
                AmberJBlue 8f46df6
              
                Exclude tests in bandit scan
              
              
                AmberJBlue 7e86cf2
              
                Remove redundant Bandit install
              
              
                AmberJBlue 1807b85
              
                Merge pull request #2 from AmberJBlue/update-security-scans
              
              
                AmberJBlue 6eda1b4
              
                Guarantee serif format
              
              
                AmberJBlue 2889a72
              
                Merge pull request #3 from AmberJBlue/update-security-scans
              
              
                AmberJBlue 5236b3f
              
                Update Bandit scan
              
              
                AmberJBlue 07eb92b
              
                Update Bandit scan
              
              
                AmberJBlue 220e773
              
                Merge pull request #4 from AmberJBlue/update-security-scans
              
              
                AmberJBlue File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,31 +1,114 @@ | ||
| name: Security | ||
| name: Security Scan | ||
|  | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
| workflow_dispatch: | ||
|  | ||
| jobs: | ||
| build: | ||
| name: Build | ||
| runs-on: ubuntu-20.04 | ||
| trivy-scan: | ||
| name: Trivy | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| security-events: write | ||
| actions: read | ||
|  | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|  | ||
| - name: Trivy scan | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|  | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| if [ -f pyproject.toml ]; then | ||
| pip install -e ".[dev]" | ||
| fi | ||
|  | ||
| - name: Run Trivy vulnerability scan | ||
| uses: aquasecurity/[email protected] | ||
| with: | ||
| scan-type: 'fs' | ||
| scan-ref: '.' | ||
| format: 'sarif' | ||
| output: 'trivy-results.sarif' | ||
| severity: 'MEDIUM,HIGH,CRITICAL' | ||
| severity: 'CRITICAL,HIGH,MEDIUM,LOW' | ||
| exit-code: '0' | ||
| ignore-unfixed: false | ||
| - name: Check for critical and high vulnerabilities | ||
| uses: aquasecurity/[email protected] | ||
| with: | ||
| scan-type: 'fs' | ||
| scan-ref: '.' | ||
| format: 'table' | ||
| severity: 'CRITICAL,HIGH' | ||
| exit-code: '1' | ||
| continue-on-error: true | ||
|  | ||
| - name: Update Security tab | ||
| - name: Upload Trivy scan results to Security tab | ||
| uses: github/codeql-action/upload-sarif@v3 | ||
| if: always() | ||
| with: | ||
| sarif_file: 'trivy-results.sarif' | ||
| category: 'trivy-security-scan' | ||
|  | ||
| bandit-scan: | ||
| name: Bandit | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| security-events: write | ||
| actions: read | ||
| contents: read | ||
| checks: write | ||
|  | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|  | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
| cache: "pip" | ||
|  | ||
| - name: Create virtual environment | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m venv .venv | ||
|  | ||
| - name: Install dependencies | ||
| run: | | ||
| source .venv/bin/activate | ||
| pip install -e ".[dev]" | ||
|  | ||
| - name: Install Bandit | ||
| run: | | ||
| source .venv/bin/activate | ||
| pip install bandit[sarif] | ||
|  | ||
| - name: Run Bandit Security Scan | ||
| uses: PyCQA/bandit-action@v1 | ||
| with: | ||
| targets: "." | ||
| exclude: "tests" | ||
|  | ||
| - name: Upload SARIF results to Security tab | ||
| if: github.ref == 'refs/heads/main' | ||
| uses: github/codeql-action/upload-sarif@v3 | ||
| with: | ||
| sarif_file: results.sarif | ||
| category: bandit-security-scan | ||
| continue-on-error: true | ||
|  | ||
| - name: Upload SARIF as artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| sarif_file: 'trivy-results.sarif' | ||
| name: bandit-sarif-results | ||
| path: results.sarif | ||
| retention-days: 30 | ||
| continue-on-error: true | ||
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -85,4 +85,4 @@ markers = [ | |
| [tool.setuptools.packages.find] | ||
| where = ["src"] | ||
|  | ||
| [tool.setuptools_scm] | ||
| [tool.setuptools_scm] | ||
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Bandit is installed separately despite being used via a GitHub Action.
Check if installing Bandit separately is required, as the GitHub Action may already handle this. Remove the step if it's unnecessary.