createThreat method

Future<CreateThreatOutput> createThreat({
  1. required String agentSpaceId,
  2. required String threatJobId,
  3. ThreatAnchorShape? anchor,
  4. String? comments,
  5. List<ThreatEvidenceShape>? evidence,
  6. List<String>? impactedAssets,
  7. List<String>? impactedGoal,
  8. String? prerequisites,
  9. String? recommendation,
  10. ThreatSeverity? severity,
  11. String? statement,
  12. List<StrideCategory>? stride,
  13. String? threatAction,
  14. String? threatImpact,
  15. String? threatSource,
  16. String? title,
})

Creates a new threat under a threat model job.

Parameter agentSpaceId : The unique identifier of the agent space.

Parameter threatJobId : The unique identifier of the threat model job the threat belongs to.

Parameter anchor : The DFD element this threat is anchored to.

Parameter comments : Optional customer comment on the threat.

Parameter evidence : The source code files supporting the threat.

Parameter impactedAssets : The specific assets affected by the threat.

Parameter impactedGoal : The security goals affected by the threat.

Parameter prerequisites : The conditions required for the threat to be exploitable.

Parameter recommendation : The recommended mitigation guidance for this threat.

Parameter severity : The severity level of the threat.

Parameter statement : The natural-language threat statement.

Parameter stride : The STRIDE categories applicable to this threat.

Parameter threatAction : What the threat source can do.

Parameter threatImpact : The direct consequence of the threat action.

Parameter threatSource : The actor or origin of the threat.

Parameter title : A short title summarizing the threat.

Implementation

Future<CreateThreatOutput> createThreat({
  required String agentSpaceId,
  required String threatJobId,
  ThreatAnchorShape? anchor,
  String? comments,
  List<ThreatEvidenceShape>? evidence,
  List<String>? impactedAssets,
  List<String>? impactedGoal,
  String? prerequisites,
  String? recommendation,
  ThreatSeverity? severity,
  String? statement,
  List<StrideCategory>? stride,
  String? threatAction,
  String? threatImpact,
  String? threatSource,
  String? title,
}) async {
  final $payload = <String, dynamic>{
    'agentSpaceId': agentSpaceId,
    'threatJobId': threatJobId,
    if (anchor != null) 'anchor': anchor,
    if (comments != null) 'comments': comments,
    if (evidence != null) 'evidence': evidence,
    if (impactedAssets != null) 'impactedAssets': impactedAssets,
    if (impactedGoal != null) 'impactedGoal': impactedGoal,
    if (prerequisites != null) 'prerequisites': prerequisites,
    if (recommendation != null) 'recommendation': recommendation,
    if (severity != null) 'severity': severity.value,
    if (statement != null) 'statement': statement,
    if (stride != null) 'stride': stride.map((e) => e.value).toList(),
    if (threatAction != null) 'threatAction': threatAction,
    if (threatImpact != null) 'threatImpact': threatImpact,
    if (threatSource != null) 'threatSource': threatSource,
    if (title != null) 'title': title,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/CreateThreat',
    exceptionFnMap: _exceptionFns,
  );
  return CreateThreatOutput.fromJson(response);
}