Commit 848cfbef authored by Paff's avatar Paff
Browse files

delete CoCoHelper

parent b6f5f394
/**
* Generated on Sat Oct 11 11:38:49 CEST 2014
* Generated on Mon Oct 13 17:11:05 CEST 2014
*/
config {
Require-Model:
......
......@@ -121,4 +121,9 @@ public enum MontiSecArcAnalysisErrorCodes implements IErrorCode {
*/
AvoidInputString,
/**
* The input must be filter again in a higher trustlevel
*/
RepeatFilteringInHigherTrustlevel,
}
......@@ -2,15 +2,14 @@ package secarc.ets.analysis.connect;
import interfaces2.resolvers.AmbigousException;
import mc.IErrorCode;
import mc.ast.ASTNode;
import mc.umlp.arcd._ast.ASTArcComponent;
import mc.umlp.arcd._ast.ASTArcConnector;
import mc.umlp.arcd._ast.ASTArcSimpleConnector;
import mc.umlp.arcd.ets.entries.ComponentEntry;
import mc.umlp.common._ast.UMLPNode;
import secarc.error.MontiSecArcAnalysisErrorCodes;
import secarc.ets.analysis.checker.Analysis;
import secarc.ets.analysis.checker.ISecAnalysisConnectorChecker;
import secarc.ets.check.CoCoHelper;
import secarc.ets.check.MontiSecArcAnalysisConstants;
import secarc.ets.entries.SecComponentEntry;
import secarc.ets.entries.SecConnectorEntry;
......@@ -42,7 +41,7 @@ public class TrustlevelPathHigherThanEnvironment extends Analysis implements
*/
@Override
public void check(ASTArcConnector node, SecConnectorEntry entry) throws AmbigousException {
innerCheck(node, entry);
innerCheck(node, entry, node.getMainParent());
}
/*
......@@ -52,10 +51,10 @@ public class TrustlevelPathHigherThanEnvironment extends Analysis implements
@Override
public void check(ASTArcSimpleConnector node, SecConnectorEntry entry)
throws AmbigousException {
innerCheck(node, entry);
innerCheck(node, entry, node.getMainParent());
}
protected void innerCheck(ASTNode node, SecConnectorEntry entry) throws AmbigousException {
protected void innerCheck(UMLPNode node, SecConnectorEntry entry, ASTArcComponent component) throws AmbigousException {
String refTarget = entry.getTarget();
String refSource = entry.getSource();
SecComponentEntry componentSource = null;
......@@ -65,28 +64,28 @@ public class TrustlevelPathHigherThanEnvironment extends Analysis implements
if(refSource.contains(".")) {
//Is in another namespace
componentSource = (SecComponentEntry) resolver.resolve(refSource.substring(0, refSource.indexOf(".")), ComponentEntry.KIND, getNameSpaceFor(CoCoHelper.getMainParent(node)));
componentSource = (SecComponentEntry) resolver.resolve(refSource.substring(0, refSource.indexOf(".")), ComponentEntry.KIND, getNameSpaceFor(component));
} else {
//Is in the same namespace
componentSource = (SecComponentEntry) resolver.resolve(CoCoHelper.getMainParent(node).getName(), ComponentEntry.KIND, getNameSpaceFor(node));
componentSource = (SecComponentEntry) resolver.resolve(component.getName(), ComponentEntry.KIND, getNameSpaceFor(node));
}
if(refTarget.contains(".")) {
//Is in another namespace
refTarget = refTarget.substring(0, refTarget.indexOf("."));
refTarget = refTarget.replaceFirst(refTarget.substring(0, 1), refTarget.substring(0, 1).toUpperCase());
componentTarget = (SecComponentEntry) resolver.resolve(refTarget, ComponentEntry.KIND, getNameSpaceFor(CoCoHelper.getMainParent(node)));
componentTarget = (SecComponentEntry) resolver.resolve(refTarget, ComponentEntry.KIND, getNameSpaceFor(component));
} else {
//Is in the same namespace
componentTarget = (SecComponentEntry) resolver.resolve(CoCoHelper.getMainParent(node).getName(), ComponentEntry.KIND, getNameSpaceFor(node));
componentTarget = (SecComponentEntry) resolver.resolve(component.getName(), ComponentEntry.KIND, getNameSpaceFor(node));
}
if((refTarget.contains(".") && refSource.contains(".")) || CoCoHelper.getMainParent(node).getMainParent() == null) {
if((refTarget.contains(".") && refSource.contains(".")) || component.getMainParent() == null) {
//In the same namesparce
componentParent = (SecComponentEntry) resolver.resolve(CoCoHelper.getMainParent(node).getName(), ComponentEntry.KIND, getNameSpaceFor(CoCoHelper.getMainParent(node)));
componentParent = (SecComponentEntry) resolver.resolve(component.getName(), ComponentEntry.KIND, getNameSpaceFor(component));
} else {
//In a higher namespace
componentParent = (SecComponentEntry) resolver.resolve(CoCoHelper.getMainParent(node).getMainParent().getName(), ComponentEntry.KIND, getNameSpaceFor(CoCoHelper.getMainParent(node).getMainParent()));
componentParent = (SecComponentEntry) resolver.resolve(component.getMainParent().getName(), ComponentEntry.KIND, getNameSpaceFor(component.getMainParent()));
}
//Is checked in another coco
......
......@@ -10,7 +10,6 @@ import interfaces2.resolvers.AmbigousException;
import secarc.error.MontiSecArcAnalysisErrorCodes;
import secarc.ets.analysis.checker.Analysis;
import secarc.ets.analysis.checker.ISecAnalysisConnectorChecker;
import secarc.ets.check.CoCoHelper;
import secarc.ets.check.MontiSecArcAnalysisConstants;
import secarc.ets.entries.SecComponentEntry;
import secarc.ets.entries.SecConnectorEntry;
......@@ -43,7 +42,7 @@ public class UnencryptedConnectorThroughLowTurstlevel extends Analysis
@Override
public void check(ASTArcConnector node, SecConnectorEntry entry)
throws AmbigousException {
innerCheck(node, entry);
innerCheck(node, entry, node.getMainParent());
}
/*
......@@ -53,7 +52,7 @@ public class UnencryptedConnectorThroughLowTurstlevel extends Analysis
@Override
public void check(ASTArcSimpleConnector node, SecConnectorEntry entry)
throws AmbigousException {
innerCheck(node, entry);
innerCheck(node, entry, node.getMainParent());
}
/**
......@@ -62,12 +61,12 @@ public class UnencryptedConnectorThroughLowTurstlevel extends Analysis
* @param entry
* @throws AmbigousException
*/
protected void innerCheck(ASTNode node, SecConnectorEntry entry) throws AmbigousException {
protected void innerCheck(ASTNode node, SecConnectorEntry entry, ASTArcComponent component) throws AmbigousException {
if(entry.isEncrypted()) {
return;
}
ASTArcComponent nodeParent = CoCoHelper.getMainParent(node);
ASTArcComponent nodeParent = component;
SecComponentEntry parentComp = (SecComponentEntry) resolver.resolve(nodeParent.getName(), ComponentEntry.KIND, getNameSpaceFor(nodeParent));
//Ports are always in different components
......
......@@ -38,6 +38,8 @@ public final class MontiSecArcAnalysisConstants {
public static final String TAINT_PROPERGATION = "Checks the type of the input port and propergates the needed filters.";
public static final String REPEAT_FILTERING_IN_HIGHER_TRUSTLEVEL = "Checks if the input is filtered again in a higher trustlevel.";
public static final String LIST_FILTER = "Lists all filters.";
public static final String AVOID_INPUT_STRING = "Checks if a input port has the type String.";
......
......@@ -9,7 +9,6 @@ import java.util.Map;
import secarc.ets.analysis.configuration.ReviewedConfiguration;
import secarc.ets.analysis.connect.EncryptedPathEndInLowTrustlevel;
import secarc.ets.analysis.connect.EncryptedPathWithUnencryptedPart;
import secarc.ets.analysis.connect.ListEncryptedData;
import secarc.ets.analysis.connect.TrustlevelPathHigherThanEnvironment;
import secarc.ets.analysis.connect.UnencryptedConnectorThroughLowTurstlevel;
import secarc.ets.analysis.filter.AvoidInputString;
......
......@@ -175,8 +175,10 @@ public class MontiSecArcAnalysisVisitor extends CheckWorkflowClient {
public void visit(ASTSecArcFilter node) {
try {
FilterEntry entry = (FilterEntry) resolver.resolve(node.getName(), FilterEntry.KIND, getNameSpaceFor(node));
for (ISecAnalysisFilterChecker cc : analysisFilterChecker) {
cc.check(node, entry, graph);
if(entry != null) {
for (ISecAnalysisFilterChecker cc : analysisFilterChecker) {
cc.check(node, entry, graph);
}
}
} catch (AmbigousException e) {
// not checked here
......@@ -192,8 +194,10 @@ public class MontiSecArcAnalysisVisitor extends CheckWorkflowClient {
public void visit(ASTSecArcConfiguration node) {
try {
ConfigurationEntry entry = (ConfigurationEntry) resolver.resolve(node.getName(), ConfigurationEntry.KIND, getNameSpaceFor(node));
for (ISecAnalysisConfigurationChecker cc : analysisConfigurationChecker) {
cc.check(node, entry);
if(entry != null) {
for (ISecAnalysisConfigurationChecker cc : analysisConfigurationChecker) {
cc.check(node, entry);
}
}
} catch (AmbigousException e) {
// not checked here
......@@ -207,8 +211,10 @@ public class MontiSecArcAnalysisVisitor extends CheckWorkflowClient {
public void visit(ASTArcPort node) {
try {
SecPortEntry entry = (SecPortEntry) resolver.resolve(node.getName(), PortEntry.KIND, getNameSpaceFor(node));
for(ISecAnalysisPortChecker cc : analysisPortChecker) {
cc.check(node, entry, this.graph);
if(entry != null) {
for(ISecAnalysisPortChecker cc : analysisPortChecker) {
cc.check(node, entry, this.graph);
}
}
} catch (AmbigousException e) {
// not checked here
......@@ -262,8 +268,10 @@ public class MontiSecArcAnalysisVisitor extends CheckWorkflowClient {
public void visit(ASTArcComponent node) {
try {
SecComponentEntry entry = (SecComponentEntry) resolver.resolve(node.getName(), ComponentEntry.KIND, getNameSpaceFor(node));
for(ISecAnalysisComponentChecker cc : analysisComponentChecker) {
cc.check(node, entry);
if(entry != null) {
for(ISecAnalysisComponentChecker cc : analysisComponentChecker) {
cc.check(node, entry);
}
}
} catch (AmbigousException e) {
// not checked here
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment