Exemple #1
0
        public Process([NotNull] IThreatModel model, [Required] string name)
        {
            _modelId = model.Id;
            _model   = model;
            _id      = Guid.NewGuid();
            Name     = name;

            model.AutoApplySchemas(this);
        }
Exemple #2
0
        public TrustBoundary([NotNull] IThreatModel model, [Required] string name) : this()
        {
            _modelId = model.Id;
            _model   = model;
            _id      = Guid.NewGuid();
            Name     = name;

            model.AutoApplySchemas(this);
        }
Exemple #3
0
        public ThreatType([NotNull] IThreatModel model,
                          [Required] string name, [NotNull] ISeverity severity) : this()
        {
            _id         = Guid.NewGuid();
            _model      = model;
            _modelId    = model.Id;
            Name        = name;
            _severity   = severity;
            _severityId = severity.Id;

            model.AutoApplySchemas(this);
        }
Exemple #4
0
        public DataFlow([NotNull] IThreatModel model, [Required] string name, Guid sourceId, Guid targetId) : this()
        {
            _modelId  = model.Id;
            _model    = model;
            _id       = Guid.NewGuid();
            Name      = name;
            _sourceId = sourceId;
            _targetId = targetId;
            FlowType  = FlowType.ReadWriteCommand;

            model.AutoApplySchemas(this);
        }
        public ThreatEvent([NotNull] IThreatModel model, [NotNull] IThreatType threatType, [NotNull] IIdentity parent) : this()
        {
            _id           = Guid.NewGuid();
            _model        = model;
            _modelId      = model.Id;
            _parentId     = parent.Id;
            _parent       = parent;
            _threatType   = threatType;
            _threatTypeId = threatType.Id;
            Name          = threatType.Name;
            Description   = threatType.Description;
            Severity      = threatType.Severity;
            var threatTypeProperties = threatType.Properties?.ToArray();

            if (threatTypeProperties?.Any() ?? false)
            {
                foreach (var property in threatTypeProperties)
                {
                    AddProperty(property);
                }
            }

            model.AutoApplySchemas(this);
        }
Exemple #6
0
        public Vulnerability([NotNull] IThreatModel model, [NotNull] IWeakness weakness, [NotNull] IIdentity parent) : this()
        {
            _id         = Guid.NewGuid();
            _model      = model;
            _modelId    = model.Id;
            _parentId   = parent.Id;
            _parent     = parent;
            _weakness   = weakness;
            _weaknessId = weakness.Id;
            Name        = weakness.Name;
            Description = weakness.Description;
            Severity    = weakness.Severity;
            var properties = weakness.Properties?.ToArray();

            if (properties?.Any() ?? false)
            {
                foreach (var property in properties)
                {
                    AddProperty(property);
                }
            }

            model.AutoApplySchemas(this);
        }