-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: John Andersen <[email protected]>
- Loading branch information
Showing
3 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import sys | ||
import json | ||
import unittest.mock | ||
|
||
import dffml | ||
|
||
from auditor import audit as untyped_audit | ||
from parser import parse | ||
|
||
|
||
@dffml.op | ||
def audit(ltm: str) -> list: | ||
return untyped_audit(parse(ltm)) | ||
|
||
|
||
AUDITOR_OVERLAY = dffml.DataFlow(*dffml.opimp_in(sys.modules[__name__])) |
This file contains 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
definitions: | ||
ThreatDragonThreatModelPath: | ||
name: ThreatDragonThreatModelPath | ||
primitive: str | ||
auditor_overlay:audit.outputs.result: | ||
name: auditor_overlay:audit.outputs.result | ||
primitive: array | ||
flow: | ||
auditor_overlay:audit: | ||
inputs: | ||
ltm: | ||
- seed | ||
linked: true | ||
operations: | ||
auditor_overlay:audit: | ||
inputs: | ||
ltm: ThreatDragonThreatModelPath | ||
name: auditor_overlay:audit | ||
outputs: | ||
result: auditor_overlay:audit.outputs.result | ||
retry: 0 | ||
stage: processing |
This file contains 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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
Living THREATS.md | ||
################# | ||
|
||
Install Alice https://github.com/pdxjohnny/dffml/tree/manifest/entities/alice | ||
|
||
Create the ``THREATS.md`` file | ||
|
||
.. code-block:: console | ||
$ alice threats \ | ||
-inputs \ | ||
models/good.json=ThreatDragonThreatModelPath \ | ||
models/GOOD_THREATS.md=ThreatsMdPath | ||
We made ``auditor_overlay.py`` which is a data flow which calls the auditor. We | ||
use ``sed`` to direct the data flow to run on the path to the threat model from | ||
Threat Dragon used as input. | ||
|
||
.. code-block:: console | ||
$ dffml service dev export auditor_overlay:AUDITOR_OVERLAY \ | ||
-configloader yaml \ | ||
| sed -e 's/auditor_overlay:audit.inputs.ltm/ThreatDragonThreatModelPath/g' \ | ||
| tee auditor_overlay.yaml | ||
Generate ``GOOD_THREATS.md`` with auditing overlay. | ||
|
||
.. code-block:: console | ||
$ alice threats -log debug \ | ||
-overlay auditor_overlay.yaml \ | ||
-inputs \ | ||
models/good.json=ThreatDragonThreatModelPath \ | ||
models/GOOD_THREATS.md=ThreatsMdPath | ||
Generate ``BAD_THREATS.md`` with auditing overlay. | ||
|
||
.. code-block:: console | ||
$ alice threats -log debug \ | ||
-overlay auditor_overlay.yaml \ | ||
-inputs \ | ||
models/bad.json=ThreatDragonThreatModelPath \ | ||
models/BAD_THREATS.md=ThreatsMdPath | ||
Dump out to HTTP to copy to GitHub for rendering. | ||
|
||
.. code-block:: console | ||
$ (echo -e 'HTTP/1.0 200 OK\n' && cat models/GOOD_THREATS.md) | nc -Nlp 9999; | ||
$ (echo -e 'HTTP/1.0 200 OK\n' && cat models/BAD_THREATS.md) | nc -Nlp 9999; |