Skip to content

Commit b79d710

Browse files
fmassamalfetNicolasHug
authored andcommitted
[fbsync] Added CodeQL and Bandit security checks as GitHub Actions (#3625)
Summary: * Added CodeQL and Bandit security checks as GitHub Actions * Nit fix on defusedxml.ElementTree * Remove defusedxml as hard requirement * Changed diffusedxml/xml importing * Fix compilation * Removed Bandit specific changes Reviewed By: NicolasHug Differential Revision: D27706940 fbshipit-source-id: c6a9d46d814aabd38e2b2d609d495427c5f2d591 Co-authored-by: Nikita Shulga <[email protected]> Co-authored-by: Nicolas Hug <[email protected]> Co-authored-by: Francisco Massa <[email protected]>
1 parent ed386ab commit b79d710

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

.github/workflows/bandit.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# GitHub Actions Bandit Workflow
2+
3+
name: Bandit
4+
5+
on:
6+
pull_request:
7+
branches: [ master ]
8+
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
# Task will fail if any high-severity issues are found
19+
# Ignoring submodules
20+
- name: Run Bandit Security Analysis
21+
run: |
22+
python -m pip install bandit
23+
python -m bandit -r . -x ./third_party -lll

.github/workflows/codeql.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# GitHub Actions CodeQL Workflow
2+
3+
name: CodeQL
4+
5+
on:
6+
pull_request:
7+
branches: [ master ]
8+
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Initialize CodeQL
19+
uses: github/codeql-action/init@v1
20+
with:
21+
languages: python, cpp
22+
23+
- name: Install Ninja
24+
run: |
25+
sudo apt-get update -y
26+
sudo apt-get install -y ninja-build
27+
28+
- name: Update submodules
29+
run: git submodule update --init --recursive
30+
31+
- name: Install Torch
32+
run: |
33+
python -m pip install cmake
34+
python -m pip install torch==1.8.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
35+
sudo ln -s /usr/bin/ninja /usr/bin/ninja-build
36+
37+
- name: Build TorchVision
38+
run: python setup.py develop --user
39+
40+
# If any code scanning alerts are found, they will be under Security -> CodeQL
41+
# Link: https://github.com/pytorch/vision/security/code-scanning
42+
- name: Perform CodeQL Analysis
43+
uses: github/codeql-action/analyze@v1

0 commit comments

Comments
 (0)