Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
name: Generate Artifacts
name: Validate Artifacts

on:
push:
branches:
- master
pull_request:
types:
- closed
branches:
- master
release:
types:
- created
- edited
- unpublished

jobs:
generate_scw_artifact:
name: Generate SCW Artifact
validate_scw_artifact:
name: Validate SCW Artifact
runs-on: ubuntu-latest
if: github.event.pull_request == null || github.event.pull_request.merged == true
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
Expand All @@ -33,9 +29,12 @@ jobs:
pip install requests
- name: Create artifact json file
run: |
python3 -B lib/artifacts.py
python3 -B lib/generate_artifacts.py
- name: Upload artifact
uses: actions/upload-artifact@v1
with:
name: Secure Code Warrior Links
path: scw_links.json
- name: Validate links
run: |
python3 -B lib/validate_artifacts.py
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ Each mapping should be setup in the following structure:
- [Remediation Advice](mappings/remediation_advice/remediation_advice.json)

#### Remediation Training
- [Secure Code Warriors](https://github.com/bugcrowd/vulnerability-rating-taxonomy/actions)
Training links can be found in the actions artifacts tab in github. We plan to create a better space for these within the actual repo.
- [Secure Code Warriors](remediation_training/)


## Supported Libraries
- [Ruby](https://github.com/bugcrowd/vrt-ruby)
Expand Down
File renamed without changes.
22 changes: 22 additions & 0 deletions lib/validate_artifacts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import os
import sys
import json
from utils import utils

ARTIFACT_FILENAME = 'scw_links.json'
ARTIFACT_DIR = 'remediation_training'

artifact_json = utils.get_json(ARTIFACT_FILENAME)
repo_path = os.path.join(ARTIFACT_DIR, ARTIFACT_FILENAME)
print(os.path.abspath(repo_path))
repo_json = utils.get_json(repo_path)

sorted_artifact_json = json.dumps(artifact_json, sort_keys=True)
sorted_repo_json = json.dumps(repo_json, sort_keys=True)

if sorted_artifact_json == sorted_repo_json:
print('SCW Document is valid!')
sys.exit(0)
else:
print('SCW Document is invalid, copy the artifact to the remediation training')
sys.exit(1)
Loading