diff --git a/cairis/data/DimensionDAO.py b/cairis/data/DimensionDAO.py index ac39ba267..426683671 100644 --- a/cairis/data/DimensionDAO.py +++ b/cairis/data/DimensionDAO.py @@ -45,7 +45,7 @@ def get_objects_by_names(self,table,id): def get_objects_by_2parameters(self,table,environment): try: - permissableDimensions = ['asset','asset_value','attacker','control','countermeasure','datastore','detection_mechanism','diagramDatastore','diagramEntity','diagramProcess','domainproperty','dfd_filter','entity','goal','misusecase','obstacle','persona', 'process', 'requirement','response','risk','role','task','task_characteristic', 'threat', 'ugm_filter','usecase', 'vulnerability','component'] + permissableDimensions = ['asset','asset_value','attacker','control','countermeasure','datastore','detection_mechanism','diagramDatastore','diagramEntity','diagramProcess','domainproperty','dfd_filter','entity','goal','misusecase','obstacle','persona', 'process', 'requirement','response','risk','role','task','task_characteristic', 'threat', 'ugm_filter','usecase', 'unconnected_vulnerability','unconnected_threat','vulnerability','component'] if (table not in permissableDimensions): raise CairisHTTPError(BAD_REQUEST,'Invalid dimension',table + ' is not a permissable dimension when specifying environment') if (self.db_proxy.nameExists(environment,'environment') == False): diff --git a/cairis/sql/procs.sql b/cairis/sql/procs.sql index 0bb9d0465..985c1d77d 100755 --- a/cairis/sql/procs.sql +++ b/cairis/sql/procs.sql @@ -6628,9 +6628,9 @@ begin union select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'domainproperty' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstacledomainproperty_goalassociation ga, environment e, obstacle hg, reference_type rt, domainproperty tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id union - select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'unconnected_vulnerability' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstaclevulnerability_goalassociation ga, environment e, obstacle hg, reference_type rt, vulnerability tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id + select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'vulnerability' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstaclevulnerability_goalassociation ga, environment e, obstacle hg, reference_type rt, vulnerability tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id union - select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'unconnected_threat' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstaclethreat_goalassociation ga, environment e, obstacle hg, reference_type rt, threat tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id; + select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'threat' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstaclethreat_goalassociation ga, environment e, obstacle hg, reference_type rt, threat tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id; else select id into environmentId from environment where name = environmentName limit 1; select ga.id id,e.name environment,hg.name goal_name,'goal' goal_dim,rt.name ref_type,tg.name subgoal_name,'goal' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from goalgoal_goalassociation ga, environment e, goal hg, reference_type rt, goal tg where ga.environment_id = environmentId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id @@ -6667,9 +6667,9 @@ begin union select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'domainproperty' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstacledomainproperty_goalassociation ga, environment e, obstacle hg, reference_type rt, domainproperty tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id and ga.environment_id = environmentId union - select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'unconnected_vulnerability' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstaclevulnerability_goalassociation ga, environment e, obstacle hg, reference_type rt, vulnerability tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id and ga.environment_id = environmentId + select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'vulnerability' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstaclevulnerability_goalassociation ga, environment e, obstacle hg, reference_type rt, vulnerability tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id and ga.environment_id = environmentId union - select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'unconnected_threat' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstaclethreat_goalassociation ga, environment e, obstacle hg, reference_type rt, threat tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id and ga.environment_id = environmentId; + select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'threat' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstaclethreat_goalassociation ga, environment e, obstacle hg, reference_type rt, threat tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id and ga.environment_id = environmentId; end if; end // @@ -6910,7 +6910,7 @@ begin elseif goalDimName = 'obstacle' and subGoalDimName = 'vulnerability' then select id into goalId from obstacle where name = goalName; - select id into subGoalId from threat where name = subGoalName; + select id into subGoalId from vulnerability where name = subGoalName; update obstaclevulnerability_goalassociation set environment_id = environmentId, goal_id = goalId, ref_type_id = aTypeId, subgoal_id = subGoalId,alternative_id = alternativeId, rationale = rationaleName where id = associationId; elseif goalDimName = 'obstacle' and subGoalDimName = 'role' then