Skip to content
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

Add a command line tool for publishing .afb files to .json #94

Merged
merged 4 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
21 changes: 10 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '19'
- name: Install dependencies
working-directory: ./src/attack_flow_builder/
run: npm ci
Expand All @@ -28,13 +28,6 @@ jobs:
# Workaround for node.js bug: https://github.com/webpack/webpack/issues/14532
NODE_OPTIONS: "--openssl-legacy-provider"
run: npm run build
# TODO: uncomment when we add autocomplete to the builder:
# - name: Fetch ATT&CK Data
# working-directory: ./src/attack_flow_builder/
# run: npm run fetch-attack
# - name: Build ATT&CK Index
# working-directory: ./src/attack_flow_builder/
# run: npm run build-index
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
Expand All @@ -52,17 +45,20 @@ jobs:
python-version: '3.8'
- uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '19'
- name: Update APT
run: sudo apt update
- name: Install dependencies
- name: Install APT dependencies
run: sudo apt install graphviz
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org/ | python -
- name: Add Poetry to PATH
run: echo "$HOME/.poetry/bin" >> $GITHUB_PATH
- name: Install dependencies
- name: Install Python dependencies
run: poetry install
- name: Install Node dependencies
working-directory: ./src/attack_flow_builder/
run: npm ci
- name: Install Mermaid
run: npm install -g @mermaid-js/mermaid-cli
- name: Create client directory
Expand All @@ -75,6 +71,9 @@ jobs:
- name: Make Attack Flow schema
run: poetry run make docs-schema
- name: Copy corpus into docs
env:
# Workaround for node.js bug: https://github.com/webpack/webpack/issues/14532
NODE_OPTIONS: "--openssl-legacy-provider"
run: poetry run make docs-examples
- name: Copy matrix-viz code into docs
run: poetry run make docs-matrix
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ docs:
docs-examples:
mkdir -p docs/extra/corpus
cp corpus/*.afb docs/extra/corpus
cd src/attack_flow_builder && env VUE_CLI_SERVICE_CONFIG_PATH="${ROOTDIR}src/attack_flow_builder/vue.cli.config.js" npx vue-cli-service build --target lib --name cli --formats commonjs --no-clean src/cli.ts
node src/attack_flow_builder/dist/cli.common.js --verbose corpus/*.afb
cp corpus/*.json docs/extra/corpus
ls -1 corpus/*.json | sed 's/corpus\/\(.*\)\.json/\1/' | xargs -t -I {} af graphviz "corpus/{}.json" "docs/extra/corpus/{}.dot"
ls -1 docs/extra/corpus/*.dot | xargs -t -I {} dot -Tpng -O -q1 "{}"
Expand Down
1 change: 1 addition & 0 deletions corpus/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.json
Loading
Loading