Skip to content

Commit

Permalink
Merge pull request #88 from center-for-threat-informed-defense/af-obj…
Browse files Browse the repository at this point in the history
…ect-ref-resolution

commits for tickets: AF-164, AF-167, AF-169
  • Loading branch information
tleef42 committed Jul 21, 2023
2 parents 42bca91 + 1f706a7 commit 2ba3ce4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,18 @@ class AttackFlowPublisher extends DiagramPublisher {
sro = this.tryEmbedInDefault(parent, c.obj);
}
break;
case "grouping":
this.tryEmbedInNote(parent, c.obj);
break;
case "network-traffic":
sro = this.tryEmbedInNetworkTraffic(parent, c.obj);
break;
case "note":
this.tryEmbedInNote(parent, c.obj);
break;
case "report":
this.tryEmbedInNote(parent, c.obj);
break;
default:
sro = this.tryEmbedInDefault(parent, c.obj);
}
Expand Down
2 changes: 1 addition & 1 deletion src/attack_flow_builder/src/assets/builder.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ const config: AppConfiguration = {
type: TemplateType.DictionaryBlock,
role: SemanticRole.Node,
properties: {
number : { type: PropertyType.String, is_primary: true, is_required: true },
number : { type: PropertyType.Int, is_primary: true, is_required: true },
name : { type: PropertyType.String },
rir : { type: PropertyType.String },
},
Expand Down
10 changes: 10 additions & 0 deletions src/attack_flow_builder/src/assets/builder.config.validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ class AttackFlowValidator extends DiagramValidator {
}
// Validate links
switch(node.template.id) {
case "grouping":
if(node.next.length === 0) {
this.addError(id, "A Grouping must point to at least one object.");
}
break;
case "network_traffic":
this.validateNetworkTrafficLinks(id, node);
break;
Expand All @@ -159,6 +164,11 @@ class AttackFlowValidator extends DiagramValidator {
this.addError(id, "A Note must point to at least one object.");
}
break;
case "report":
if(node.next.length === 0) {
this.addError(id, "A Report must point to at least one object.");
}
break;
case "windows_registry_key": // Additional validation for windows registry keys
if (!AttackFlowValidator.WindowsRegistryregex.test(String(node.props.value.get("key")))) {
this.addError(id, "Invalid Windows registry key.");
Expand Down

0 comments on commit 2ba3ce4

Please sign in to comment.