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

Af149 opinion #86

Merged
merged 5 commits into from
Jul 24, 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
14 changes: 13 additions & 1 deletion src/attack_flow_builder/src/assets/builder.config.publisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,16 @@ class AttackFlowPublisher extends DiagramPublisher {
case PropertyType.Enum:
if (prop instanceof EnumProperty && prop.isDefined()) {
let value = prop.toReferenceValue()!.toRawValue()!;
tleef42 marked this conversation as resolved.
Show resolved Hide resolved
node[key] = value === "True";
if(["True", "False"].includes(value.toString())) {
// case(BoolEnum)
node[key] = value === "True";
}
else {
// case(String | List | Dictionary | null)
value = value.toString();
value = value.toLowerCase().replace(' ', '-');
node[key] = value;
}
}
break;
case PropertyType.List:
Expand Down Expand Up @@ -363,6 +372,9 @@ class AttackFlowPublisher extends DiagramPublisher {
case "note":
this.tryEmbedInNote(parent, c.obj);
break;
case "opinion":
this.tryEmbedInNote(parent, c.obj);
break;
default:
sro = this.tryEmbedInDefault(parent, c.obj);
}
Expand Down
16 changes: 15 additions & 1 deletion src/attack_flow_builder/src/assets/builder.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,21 @@ const config: AppConfiguration = {
properties: {
explanation : { type: PropertyType.String, is_primary: true },
authors : { type: PropertyType.List, form: { type: PropertyType.String } },
opinion : { type: PropertyType.String, is_required: true },
opinion : {
type: PropertyType.Enum,
options: {
type: PropertyType.List,
form: { type: PropertyType.String },
value: [
["strongly-disagree", "Strongly Disagree"],
["disagree", "Disagree"],
["neutral", "Neutral"],
["agree", "Agree"],
["strongly-agree", "Strongly Agree"]
]
},
is_required: true
}
},
anchor_template: "@__builtin__anchor",
style: DarkTheme.DictionaryBlock({ head: { ...Colors.Gray }})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,17 @@ class AttackFlowValidator extends DiagramValidator {
this.addError(id, "A Note must point to at least one object.");
}
break;
case "opinion":
if(node.next.length === 0) {
this.addError(id, "An Opinion 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.");
}
break;

}
}

Expand Down
Loading