Skip to content

Commit

Permalink
Added CodeQL and Bandit security checks as GitHub Actions (#1266)
Browse files Browse the repository at this point in the history
Co-authored-by: Eli Uriegas <1700823+seemethere@users.noreply.github.com>
  • Loading branch information
mstfbl and seemethere committed Apr 7, 2021
1 parent 5efd71c commit ba0bf52
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/workflows/bandit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# GitHub Actions Bandit Workflow

name: Bandit

on:
pull_request:
branches: [ master ]

workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

# Task will fail if any high-severity issues are found
# Ignoring submodules
- name: Run Bandit Security Analysis
run: |
python -m pip install bandit
python -m bandit -r . -x ./third_party -lll
43 changes: 43 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# GitHub Actions CodeQL Workflow

name: CodeQL

on:
pull_request:
branches: [ master ]

workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: python, cpp

- name: Install Ninja
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build
- name: Update submodules
run: git submodule update --init --recursive

- name: Install Torch
run: |
python -m pip install cmake
python -m pip install torch==1.8.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
sudo ln -s /usr/bin/ninja /usr/bin/ninja-build
- name: Build TorchText
run: python setup.py develop --user

# If any code scanning alerts are found, they will be under Security -> CodeQL
# Link: https://github.com/pytorch/text/security/code-scanning
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ pytest-cov
codecov

# To parse untrusted XML data
defusedxml
defusedxml

0 comments on commit ba0bf52

Please sign in to comment.