Skip to content

Commit

Permalink
Merge pull request #284 from iriusrisk/feature/OPT-935
Browse files Browse the repository at this point in the history
[feature/OPT-935] to [feauture/OPT-792]
  • Loading branch information
smaneroiriusrisk authored Aug 23, 2023
2 parents d0db759 + 533cd29 commit 443af3a
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 36 deletions.
2 changes: 1 addition & 1 deletion docs/Quickstart-Guide-for-Beginners.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ With this two files we are ready to execute the `parse` command in order to gene
```shell
startleft parse \
--iac-type TERRAFORM \
--mapping-file iriusrisk-tf-aws-mapping.yaml \
--default-mapping-file iriusrisk-tf-aws-mapping.yaml \
--output-file multinetwork_security_groups_with_lb.otm \
--project-name "Terraform MN Security Groups with LB" \
--project-id "tf-mn-sg-lb" \
Expand Down
4 changes: 2 additions & 2 deletions docs/startleft-processors/iac/cft/CloudFormation-Examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ OTM file `multinetwork_security_groups_with_lb.otm` in the process.
```shell
startleft parse \
--iac-type CLOUDFORMATION \
--mapping-file iriusrisk-cft-mapping.yaml \
--default-mapping-file iriusrisk-cft-mapping.yaml \
--output-file multinetwork_security_groups_with_lb.otm \
--project-name "CFT MN Security Groups with LB" \
--project-id "cft-mn-sg-lb" \
Expand All @@ -60,7 +60,7 @@ The following command will parse both CloudFormation source files creating an OT
```shell
startleft parse \
--iac-type CLOUDFORMATION \
--mapping-file iriusrisk-cft-mapping.yaml \
--default-mapping-file iriusrisk-cft-mapping.yaml \
--output-file multinetwork_security_groups_with_lb_from_multiple_files.otm \
--project-name "CFT MN Security Groups with LB from multiple files" \
--project-id "cft-mn-sg-lb-ml-fl" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ directory with identical contents to the one above.
```shell
startleft parse \
--iac-type CLOUDFORMATION \
--mapping-file ec2-mapping.yaml \
--default-mapping-file ec2-mapping.yaml \
--output-file ec2.otm \
--project-id "my-ec2-project" \
--project-name "My EC2 project" \
Expand All @@ -182,7 +182,7 @@ curl --location --request POST localhost:5000/api/v1/startleft/iac \
--header "Accept: application/json" \
--form iac_type="CLOUDFORMATION" \
--form iac_file=@"./ec2-cft.json" \
--form mapping_file=@"./ec2-mapping.yaml" \
--form default_mapping_file=@"./ec2-mapping.yaml" \
--form id="my-ec2-project" \
--form name="My EC2 project"
```
Expand Down
2 changes: 1 addition & 1 deletion docs/startleft-processors/iac/tf/Terraform-Examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ StartLeft supports parsing Terraform source files. Some examples are provided in
```shell
startleft parse \
--iac-type TERRAFORM \
--mapping-file iriusrisk-tf-aws-mapping \
--default-mapping-file iriusrisk-tf-aws-mapping \
--output-file elb.otm \
--project-name "Terraform ELB" \
--project-id "terraform-elb" \
Expand Down
4 changes: 2 additions & 2 deletions docs/startleft-processors/iac/tf/Terraform-Quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ directory with identical contents to the one above.
```shell
startleft parse \
--iac-type TERRAFORM \
--mapping-file ec2-mapping.yaml \
--default-mapping-file ec2-mapping.yaml \
--output-file ec2.otm \
--project-id "my-ec2-project" \
--project-name "My EC2 project" \
Expand All @@ -164,7 +164,7 @@ curl --location --request POST localhost:5000/api/v1/startleft/iac \
--header "Accept: application/json" \
--form iac_type="TERRAFORM" \
--form iac_file=@"./ec2-tf.json" \
--form mapping_file=@"./ec2-mapping.yaml" \
--form default_mapping_file=@"./ec2-mapping.yaml" \
--form id="my-ec2-project" \
--form name="My EC2 project"
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ directory.
```shell
startleft parse \
--iac-type TFPLAN \
--mapping-file ir-mappings.yaml \
--default-mapping-file ir-mappings.yaml \
--output-file output.otm \
--project-id "my-project" \
--project-name "My project" \
Expand All @@ -108,7 +108,7 @@ curl --location --request POST localhost:5000/api/v1/startleft/iac \
--form iac_type="TFPLAN" \
--form iac_file=@"./tf-plan.json" \
--form iac_file=@"./tf-graph.gv" \
--form mapping_file=@"./ir-mappings.yaml" \
--form default_mapping_file=@"./ir-mappings.yaml" \
--form id="my-project" \
--form name="My project"
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Use the StartLeft CLI to generate the OTM file:
```shell
$ startleft parse \
--iac-type TFPLAN \
--mapping-file ir-mappings.yaml \
--default-mapping-file ir-mappings.yaml \
--output-file output.otm \
--project-id "my-project" \
--project-name "My project" \
Expand Down
36 changes: 14 additions & 22 deletions docs/usage/Command-Line-Interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,34 +99,26 @@ This command is used for parsing source files into the Open Threat Model format.
The options that it supports are:

```shell
-t, --iac-type [CLOUDFORMATION|TERRAFORM]
The IaC file type. NOTE: This argument
-t, --iac-type [CLOUDFORMATION|TERRAFORM|TFPLAN]
The IaC file type. NOTE: This argument is
mutually exclusive with arguments:
[diagram_type, etm_type]. [required]
-g, --diagram-type [VISIO|LUCID]
The diagram file type. NOTE: This argument
is mutually exclusive with arguments:
[custom_mapping_file,
default_mapping_file, diagram_type].
-g, --diagram-type [VISIO|LUCID]
The diagram file type. NOTE: This
argument is mutually exclusive with
arguments: [mapping_file, iac_type].
-m, --mapping-file TEXT
Mapping file to parse the IaC file.
NOTE: This argument is mutually
exclusive with arguments:
[custom_mapping_file,
default_mapping_file, diagram_type].
-d, --default-mapping-file TEXT
Default mapping file to parse the
diagram or ETM file. NOTE: This argument is
[etm_type, iac_type]. [required]
-e, --etm-type [MTMT] The etm file type. NOTE: This argument is
mutually exclusive with arguments:
[mapping_file, iac_type].
-c, --custom-mapping-file TEXT
Custom mapping file to parse the
diagram or ETM file.
[diagram_type, iac_type]. [required]
-d, --default-mapping-file TEXT
Default mapping file to parse the diagram
file. [required]
-c, --custom-mapping-file TEXT Custom mapping file to parse the diagram
file.
-o, --output-file TEXT OTM output file.
-n, --project-name TEXT Project name. [required]
-i, --project-id TEXT Project id. [required]
--help Show this message and exit.

```
> :material-information-outline: Notice that the argument with the `IaC or diagram file name` to parse is not
> preceded by a parameter
Expand Down
12 changes: 9 additions & 3 deletions docs/usage/REST-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,17 @@ Request Body:
iac_type: Required. Type of the IaC file: [CLOUDFORMATION, TERRAFORM]
id Required. ID of the new project
name Required. Name of the new project
mapping_file Required. File that contains the mapping between IaC resources and threat model resources.
default_mapping_file Required. File that contains the default mapping file between the diagram resources and threat model resources
custom_mapping_file Optional. File that contains the custom user mapping file between the diagram resources and threat model resources
```
This endpoint accepts one or more IaC source files (currently [Cloudformation](../startleft-processors/iac/cft/CloudFormation-Quickstart.md)
or [Terraform](../startleft-processors/iac/tf/Terraform-Quickstart.md)) and a mapping file, and generates an OTM with
or [Terraform](../startleft-processors/iac/tf/Terraform-Quickstart.md)),a mapping file, and an optional custom mapping file, and generates an OTM with
the resulting threat modeling content.

???+ warning "mapping_file parameter is DEPRECATED"

In previous version mapping_file parameter was used instead default_mapping_file, now you can send one or the other until mapping_file parameter is definitely deleted and only default_mapping_file will be accepted.

??? example "Example"
=== "Request"
``` shell
Expand All @@ -88,7 +93,8 @@ the resulting threat modeling content.
--form iac_type="CLOUDFORMATION" \
--form iac_file=@"./resources_cft_file.json" \
--form iac_file=@"./networks_cft_file.json" \
--form mapping_file=@"./iriusrisk-cft-mapping.yaml" \
--form default_mapping_file=@"./default-mapping.yaml" \
--form custom_mapping_file=@"./custom-mapping.yaml" \
--form id="cft-to-otm-example" \
--form name="CFT to OTM example"
```
Expand Down

0 comments on commit 443af3a

Please sign in to comment.