Skip to content

Commit 57ced18

Browse files
committed
Add plus constructs
1 parent 7711fe6 commit 57ced18

18 files changed

+3063
-658
lines changed

.projenrc.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ const project = new cdk.JsiiProject({
55
defaultReleaseBranch: "main",
66
name: "cdktg",
77
description: "Agile Threat Modeling as Code",
8-
keywords: ["threagile", "cdk", "threat modeling", "stride"],
8+
keywords: [
9+
"threagile",
10+
"cdk",
11+
"threat modeling",
12+
"stride",
13+
"devsecops",
14+
"appsec",
15+
"constructs",
16+
],
917
vscode: true,
1018
repositoryUrl: "https://github.com/hupe1980/cdk-threagile.git",
1119
license: "MIT",

API.md

Lines changed: 2611 additions & 648 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/data-asset.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class DataAsset extends Resource {
4646
return {
4747
[this.node.id]: {
4848
id: this.uuid,
49-
description: this.description,
49+
description: this.description ?? null,
5050
usage: this.usage,
5151
tags: Array.from(new Set(this.tags)),
5252
origin: this.origin,

src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ export * from "./synthesizer";
1919
export * from "./technical-asset";
2020
export * from "./trust-boundary";
2121
export * from "./usage";
22+
23+
// export submobules
24+
export * as plus_aws from "./plus-aws";
25+
export * as plus from "./plus";
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { Construct } from "constructs";
2+
import {
3+
CIATriad,
4+
Encryption,
5+
Machine,
6+
Size,
7+
TechnicalAsset,
8+
TechnicalAssetType,
9+
Technology,
10+
Usage,
11+
} from "..";
12+
import { SecurityGroup } from "./security-group";
13+
14+
export interface ApplicationLoadBalancerProps {
15+
readonly waf?: boolean;
16+
readonly securityGroup?: SecurityGroup;
17+
readonly description?: string;
18+
readonly ciaTriad: CIATriad;
19+
readonly tags?: string[];
20+
}
21+
22+
export class ApplicationLoadBalancer extends TechnicalAsset {
23+
public readonly securityGroup: SecurityGroup;
24+
25+
constructor(
26+
scope: Construct,
27+
id: string,
28+
props: ApplicationLoadBalancerProps
29+
) {
30+
super(scope, id, {
31+
description: props.description,
32+
type: TechnicalAssetType.PROCESS,
33+
usage: Usage.BUSINESS,
34+
humanUse: false,
35+
size: Size.COMPONENT,
36+
technology: props.waf ? Technology.WAF : Technology.LOAD_BALANCER,
37+
tags: props.tags,
38+
internet: false,
39+
machine: Machine.VIRTUAL,
40+
encryption: Encryption.NONE,
41+
owner: "",
42+
ciaTriad: props.ciaTriad,
43+
multiTenant: true,
44+
redundant: true,
45+
customDevelopedParts: false,
46+
});
47+
48+
this.securityGroup =
49+
props.securityGroup ?? new SecurityGroup(this, `${id} SG`);
50+
51+
this.securityGroup.addTechnicalAssets(this);
52+
}
53+
}

src/plus-aws/cloud.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Construct } from "constructs";
2+
import { TrustBoundary, TrustBoundaryType } from "..";
3+
4+
export interface CloudProps {
5+
readonly description?: string;
6+
readonly tags?: string[];
7+
}
8+
9+
export class Cloud extends TrustBoundary {
10+
constructor(scope: Construct, id: string, props: CloudProps = {}) {
11+
super(scope, id, {
12+
type: TrustBoundaryType.NETWORK_CLOUD_PROVIDER,
13+
description: props.description,
14+
tags: props.tags,
15+
});
16+
}
17+
}

src/plus-aws/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * from "./application-load-balancer";
2+
export * from "./cloud";
3+
export * from "./security-group";

src/plus-aws/security-group.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Construct } from "constructs";
2+
import { TrustBoundary, TrustBoundaryType } from "..";
3+
4+
export interface SecurityGroupProps {
5+
readonly description?: string;
6+
readonly tags?: string[];
7+
}
8+
9+
export class SecurityGroup extends TrustBoundary {
10+
constructor(scope: Construct, id: string, props: SecurityGroupProps = {}) {
11+
super(scope, id, {
12+
type: TrustBoundaryType.NETWORK_CLOUD_SECURITY_GROUP,
13+
description: props.description,
14+
tags: props.tags,
15+
});
16+
}
17+
}

src/plus/browser.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { Construct } from "constructs";
2+
import {
3+
TechnicalAsset,
4+
TechnicalAssetType,
5+
Usage,
6+
Scope,
7+
Machine,
8+
Encryption,
9+
CIATriad,
10+
Size,
11+
Technology,
12+
} from "..";
13+
14+
export interface BrowserProps {
15+
readonly description?: string;
16+
readonly scope: Scope;
17+
readonly owner?: string;
18+
readonly ciaTriad: CIATriad;
19+
}
20+
21+
export class Browser extends TechnicalAsset {
22+
constructor(scope: Construct, id: string, props: BrowserProps) {
23+
super(scope, id, {
24+
description: props.description,
25+
type: TechnicalAssetType.EXTERNAL_ENTITY,
26+
usage: Usage.BUSINESS,
27+
humanUse: true,
28+
scope: props.scope,
29+
size: Size.APPLICATION,
30+
technology: Technology.BROWSER,
31+
internet: true,
32+
machine: Machine.PHYSICAL,
33+
encryption: Encryption.NONE,
34+
owner: props.owner,
35+
ciaTriad: props.ciaTriad,
36+
multiTenant: false,
37+
redundant: false,
38+
customDevelopedParts: false,
39+
});
40+
}
41+
}

0 commit comments

Comments
 (0)