Skip to content

Commit

Permalink
Fix #534. Fix #535.
Browse files Browse the repository at this point in the history
  • Loading branch information
failys committed May 22, 2020
1 parent 6679646 commit 742512a
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cairis/config/cairis_model.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
<!ATTLIST obstacle originator CDATA #REQUIRED>
<!ELEMENT obstacle_environment (definition,concern*,probability?)>
<!ATTLIST obstacle_environment name CDATA #REQUIRED>
<!ATTLIST obstacle_environment category (Confidentiality_Threat | Integrity_Threat | Availability_Threat | Accountability_Threat | Vulnerability | Duration | Frequency | Demands | Goal_Support | Anonymity_Threat | Pseudonymity_Threat | Unlinkability_Threat | Unobservability_Threat | Threat ) #REQUIRED>
<!ATTLIST obstacle_environment category (Confidentiality_Threat | Integrity_Threat | Availability_Threat | Accountability_Threat | Vulnerability | Duration | Frequency | Demands | Goal_Support | Anonymity_Threat | Pseudonymity_Threat | Unlinkability_Threat | Unobservability_Threat | Threat | Loss | Hazard ) #REQUIRED>
<!ELEMENT probability (rationale)>
<!ATTLIST probability value CDATA #REQUIRED>

Expand Down
2 changes: 1 addition & 1 deletion cairis/config/goals.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<!ATTLIST obstacle originator CDATA #REQUIRED>
<!ELEMENT obstacle_environment (definition,concern*,probability)>
<!ATTLIST obstacle_environment name CDATA #REQUIRED>
<!ATTLIST obstacle_environment category (Confidentiality_Threat | Integrity_Threat | Availability_Threat | Accountability_Threat | Vulnerability | Duration | Frequency | Demands | Goal_Support | Anonymity_Threat | Pseudonymity_Threat | Unlinkability_Threat | Unobservability_Threat | Threat) #REQUIRED>
<!ATTLIST obstacle_environment category (Confidentiality_Threat | Integrity_Threat | Availability_Threat | Accountability_Threat | Vulnerability | Duration | Frequency | Demands | Goal_Support | Anonymity_Threat | Pseudonymity_Threat | Unlinkability_Threat | Unobservability_Threat | Threat | Loss | Hazard) #REQUIRED>
<!ELEMENT probability (rationale)>
<!ATTLIST probability value CDATA #REQUIRED>
<!ELEMENT rationale (#PCDATA)>
Expand Down
12 changes: 12 additions & 0 deletions cairis/sql/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ DROP TABLE IF EXISTS component_vulnerability_target;
DROP TABLE IF EXISTS component_threat_target;

DROP TABLE IF EXISTS document_reference_vulnerability;
DROP TABLE IF EXISTS document_reference_obstacle;
DROP TABLE IF EXISTS ice_ic_contribution;
DROP TABLE IF EXISTS implied_characteristic_element_intention;
DROP TABLE IF EXISTS implied_characteristic_element;
Expand Down Expand Up @@ -3492,6 +3493,14 @@ CREATE TABLE document_reference_vulnerability (
FOREIGN KEY(vulnerability_id) REFERENCES vulnerability(id)
) ENGINE=INNODB;

CREATE TABLE document_reference_obstacle (
document_reference_id INT NOT NULL,
obstacle_id INT NOT NULL,
PRIMARY KEY(document_reference_id,obstacle_id),
FOREIGN KEY(document_reference_id) REFERENCES document_reference(id),
FOREIGN KEY(obstacle_id) REFERENCES obstacle(id)
) ENGINE=INNODB;

delimiter //

create function internalDocumentQuotationString(idName text, startIdx int, endIdx int)
Expand Down Expand Up @@ -4329,6 +4338,7 @@ INSERT INTO allowable_trace values(16,2);
INSERT INTO allowable_trace values(7,5);
INSERT INTO allowable_trace values(7,6);
INSERT INTO allowable_trace values(20,6);
INSERT INTO allowable_trace values(20,17);
INSERT INTO requirement_type values(0,'Functional');
INSERT INTO requirement_type values(1,'Data');
INSERT INTO requirement_type values(2,'Look and Feel');
Expand Down Expand Up @@ -4422,6 +4432,8 @@ INSERT INTO obstacle_category_type values(10,'Pseudonymity Threat');
INSERT INTO obstacle_category_type values(11,'Unlinkability Threat');
INSERT INTO obstacle_category_type values(12,'Unobservability Threat');
INSERT INTO obstacle_category_type values(13,'Threat');
INSERT INTO obstacle_category_type values(14,'Loss');
INSERT INTO obstacle_category_type values(15,'Hazard');
INSERT INTO project_setting values(0,'Project Name','New Project');
INSERT INTO project_setting values(1,'Project Background','None');
INSERT INTO project_setting values(2,'Project Goals','None');
Expand Down
21 changes: 16 additions & 5 deletions cairis/sql/procs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5371,7 +5371,9 @@ begin
union
select 'requirement' from_objt, fr.name from_name, 'requirement' to_objt, tr.name to_name,rr.label from requirement fr, environment_requirement fer, environment fe, requirement tr, environment_requirement ter, environment te, requirement_requirement rr where rr.from_id = fr.id and fr.id = fer.requirement_id and fer.environment_id = fe.id and fr.version = (select max(i.version) from requirement i where i.id = fr.id) and rr.to_id = tr.id and tr.id = ter.requirement_id and ter.environment_id = te.id and tr.version = (select max(i.version) from requirement i where i.id = tr.id) and fer.environment_id = environmentId and fer.environment_id = ter.environment_id
union
select 'document_reference' from_objt, dr.name from_name, 'vulnerability' to_objt, v.name to_name, 'supports' label from document_reference_vulnerability drv, environment_vulnerability ev, vulnerability v, document_reference dr where ev.environment_id = environmentId and ev.vulnerability_id = drv.vulnerability_id and drv.document_reference_id = dr.id and ev.vulnerability_id = v.id;
select 'document_reference' from_objt, dr.name from_name, 'vulnerability' to_objt, v.name to_name, 'supports' label from document_reference_vulnerability drv, environment_vulnerability ev, vulnerability v, document_reference dr where ev.environment_id = environmentId and ev.vulnerability_id = drv.vulnerability_id and drv.document_reference_id = dr.id and ev.vulnerability_id = v.id
union
select 'document_reference' from_objt, dr.name from_name, 'obstacle' to_objt, o.name to_name, 'supports' label from document_reference_obstacle dro, environment_obstacle eo, obstacle o, document_reference dr where eo.environment_id = environmentId and eo.obstacle_id = dro.obstacle_id and dro.document_reference_id = dr.id and eo.obstacle_id = o.id;
end
//

Expand Down Expand Up @@ -5506,7 +5508,9 @@ begin
union
select 'risk' from_objt, r.name from_name, 'threat' to_objt, t.name to_name from risk_threat rt, environment_risk er, environment_threat et, risk r, threat t where er.environment_id = environmentId and et.environment_id = environmentId and er.id = rt.risk_id and rt.risk_id = r.id and et.threat_id = rt.threat_id and rt.threat_id = t.id
union
select 'document_reference' from_objt,dr.name from_name,'vulnerability' to_objt, v.name to_name from document_reference_vulnerability drv, document_reference dr, environment_vulnerability ev, vulnerability v where ev.environment_id = environmentId and ev.vulnerability_id = v.id and ev.vulnerability_id = drv.vulnerability_id and drv.document_reference_id = dr.id;
select 'document_reference' from_objt,dr.name from_name,'vulnerability' to_objt, v.name to_name from document_reference_vulnerability drv, document_reference dr, environment_vulnerability ev, vulnerability v where ev.environment_id = environmentId and ev.vulnerability_id = v.id and ev.vulnerability_id = drv.vulnerability_id and drv.document_reference_id = dr.id
union
select 'document_reference' from_objt,dr.name from_name,'obstacle' to_objt, o.name to_name from document_reference_obstacle dro, document_reference dr, environment_obstacle eo, obstacle o where eo.environment_id = environmentId and eo.obstacle_id = o.id and eo.obstacle_id = dro.obstacle_id and dro.document_reference_id = dr.id;
else
select 'asset' from_objt,a.name from_name, 'threat' to_objt,t.name to_name from asset_threat at,asset a, threat t where at.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and at.asset_id = a.id and at.threat_id = t.id
union
Expand Down Expand Up @@ -5580,7 +5584,9 @@ begin
union
select 'risk' from_objt, r.name from_name, 'threat' to_objt, t.name to_name from risk_threat rt, environment_risk er, environment_threat et, risk r, threat t where er.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and et.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and et.id = rt.risk_id and rt.risk_id = r.id and et.threat_id = rt.threat_id and rt.threat_id = t.id
union
select 'document_reference' from_objt,dr.name from_name,'vulnerability' to_objt, v.name to_name from document_reference_vulnerability drv, document_reference dr, environment_vulnerability ev, vulnerability v where ev.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and ev.vulnerability_id = v.id and ev.vulnerability_id = drv.vulnerability_id and drv.document_reference_id = dr.id;
select 'document_reference' from_objt,dr.name from_name,'vulnerability' to_objt, v.name to_name from document_reference_vulnerability drv, document_reference dr, environment_vulnerability ev, vulnerability v where ev.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and ev.vulnerability_id = v.id and ev.vulnerability_id = drv.vulnerability_id and drv.document_reference_id = dr.id
union
select 'document_reference' from_objt,dr.name from_name,'obstacle' to_objt, o.name to_name from document_reference_obstacle dro, document_reference dr, environment_obstacle eo, obstacle o where eo.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and eo.obstacle_id = o.id and eo.obstacle_id = dro.obstacle_id and dro.document_reference_id = dr.id;
end if;
end
//
Expand Down Expand Up @@ -14553,7 +14559,10 @@ begin
union
select 'requirement', fr.name, 'requirement', tr.name, rr.label from requirement_requirement rr, requirement fr, requirement tr where rr.from_id = fr.id and rr.to_id = tr.id
union
select 'document_reference', dr.name, 'vulnerability', v.name, '' from document_reference_vulnerability drv, document_reference dr, vulnerability v where drv.document_reference_id = dr.id and drv.vulnerability_id = v.id;
select 'document_reference', dr.name, 'vulnerability', v.name, '' from document_reference_vulnerability drv, document_reference dr, vulnerability v where drv.document_reference_id = dr.id and drv.vulnerability_id = v.id
union
select 'document_reference', dr.name, 'obstacle', o.name, '' from document_reference_obstacle dro, document_reference dr, obstacle o where dro.document_reference_id = dr.id and dro.obstacle_id = o.id;


declare goalAssocCursor cursor for
select e.name,hg.name,'goal',rt.name,tg.name,'goal',ga.alternative_id,ga.rationale from goalgoal_goalassociation ga, environment e, goal hg, reference_type rt, goal 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
Expand Down Expand Up @@ -30064,7 +30073,9 @@ begin
union
select 'requirement', fr.name, 'requirement', tr.name, rr.label from requirement_requirement rr, requirement fr, requirement tr where rr.from_id = fr.id and rr.to_id = tr.id
union
select 'document_reference', dr.name, 'vulnerability', v.name, '' from document_reference_vulnerability drv, document_reference dr, vulnerability v where drv.document_reference_id = dr.id and drv.vulnerability_id = v.id;
select 'document_reference', dr.name, 'vulnerability', v.name, '' from document_reference_vulnerability drv, document_reference dr, vulnerability v where drv.document_reference_id = dr.id and drv.vulnerability_id = v.id
union
select 'document_reference', dr.name, 'obstacle', o.name, '' from document_reference_obstacle dro, document_reference dr, obstacle o where dro.document_reference_id = dr.id and dro.obstacle_id = o.id;

declare goalAssocCursor cursor for
select e.name,hg.name,'goal',rt.name,tg.name,'goal',ga.alternative_id,ga.rationale from goalgoal_goalassociation ga, environment e, goal hg, reference_type rt, goal 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
Expand Down
1 change: 1 addition & 0 deletions docs/traceability.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Risk Threat
Risk Vulnerability
Component Use Case
Document Reference Vulnerability
Document Reference Obstacle
================== ===================

Editing manual traceability links
Expand Down

0 comments on commit 742512a

Please sign in to comment.