Commit 827ebc03 authored by Paff's avatar Paff
Browse files

analysis: taint propergation

parent 9effa649
/**
* Generated on Mon Oct 06 13:26:55 CEST 2014
* Generated on Mon Oct 06 13:57:43 CEST 2014
*/
config {
Require-Model:
......
/**
* Generated on Mon Oct 06 13:27:14 CEST 2014
* Generated on Mon Oct 06 13:58:01 CEST 2014
*/
config {
Require-Model:
......
......@@ -75,4 +75,9 @@ public enum MontiSecArcAnalysisErrorCodes implements IErrorCode {
*/
DerivedRolesComponent,
/**
* Porpergates the needed filter
*/
TaintPropergation,
}
package secarc.ets.analysis.filter;
import mc.IErrorCode;
import mc.umlp.arcd._ast.ASTArcPort;
import interfaces2.coco.ContextCondition;
import interfaces2.resolvers.AmbigousException;
import secarc.error.MontiSecArcAnalysisErrorCodes;
import secarc.ets.analysis.checker.AnalysisHelper;
import secarc.ets.analysis.checker.ISecAnalysisPortChecker;
import secarc.ets.check.MontiSecArcAnalysisConstants;
import secarc.ets.entries.SecPortEntry;
import secarc.ets.graph.ArchitectureGraph;
/**
* The type of the input port indicates the needed filters
*
* <br>
* <br>
* Copyright (c) 2011 RWTH Aachen. All rights reserved
*
* @author (last commit) $Author$
* @version $Date$<br>
* $Revision$
*
*/
public class TaintPropergation extends ContextCondition implements
ISecAnalysisPortChecker {
public TaintPropergation() {
super(MontiSecArcAnalysisConstants.TAINT_PROPERGATION);
}
@Override
public void check(ASTArcPort node, SecPortEntry entry,
ArchitectureGraph graph) throws AmbigousException {
if(AnalysisHelper.isPortBenningOfPath(node, resolver, getNameSpaceFor(node), getNameSpaceFor(node.getMainParent()))) {
addReport("The input port " + entry.getName() + " has the type " + entry.getTypeReference() + ".", node.get_SourcePositionStart());
}
}
@Override
public IErrorCode getErrorCode() {
return MontiSecArcAnalysisErrorCodes.TaintPropergation;
}
}
......@@ -19,7 +19,7 @@ import mc.IErrorCode;
import mc.umlp.arcd.ets.entries.ConnectorEntry;
/**
* TODO
* Checks the path to the filter
*
* <br>
* <br>
......
......@@ -34,6 +34,8 @@ public final class MontiSecArcAnalysisConstants {
public static final String TAINT_TRACKING = "Checks if a input is filter before it is used.";
public static final String TAINT_PROPERGATION = "Checks the type of the input port and propergates the needed filters.";
public static final String LIST_FILTER = "Lists all filters.";
public static final String ALL_PORT_ANALYSIS = "Checks all analysis related to ports.";
......
......@@ -12,6 +12,7 @@ import secarc.ets.analysis.connect.EncryptedPathWithUnencryptedPart;
import secarc.ets.analysis.connect.ListEncryptedData;
import secarc.ets.analysis.connect.UnencryptedConnectorThroughLowTurstlevel;
import secarc.ets.analysis.filter.ListFilters;
import secarc.ets.analysis.filter.TaintPropergation;
import secarc.ets.analysis.filter.TaintTracking;
import secarc.ets.analysis.port.ListCriticalPorts;
import secarc.ets.analysis.port.ListSystemIncomingPorts;
......@@ -116,9 +117,12 @@ public final class MontiSecArcAnalysisCreator {
//List all filters
filterAnalysis.addChild(new ListFilters());
//Tainttracking
//Taint tracking
filterAnalysis.addChild(new TaintTracking());
//taint propergation
filterAnalysis.addChild(new TaintPropergation());
//Analysis for ports
CompositeContextCondition portAnalysis = new CompositeContextCondition(MontiSecArcAnalysisConstants.ALL_PORT_ANALYSIS);
......
......@@ -51,8 +51,9 @@ public class MontiSecArcAnalysisTest extends TestWithSymtabAnalysis<MontiSecArcA
errorCodes.add(MontiSecArcAnalysisErrorCodes.DerivedRolesThirdParty);
errorCodes.add(MontiSecArcAnalysisErrorCodes.DerivedRolesComponent);
errorCodes.add(MontiSecArcAnalysisErrorCodes.ListIncomingtPorts);
errorCodes.add(MontiSecArcAnalysisErrorCodes.TaintPropergation);
assertEquals(16, handler.getWarnings().size());
assertEquals(25, handler.getWarnings().size());
for(ProblemReport error : handler.getErrors()) {
assertTrue(errorCodes.contains(error.getErrorcode()));
}
......@@ -75,8 +76,9 @@ public class MontiSecArcAnalysisTest extends TestWithSymtabAnalysis<MontiSecArcA
errorCodes.add(MontiSecArcAnalysisErrorCodes.TaintTracking);
errorCodes.add(MontiSecArcAnalysisErrorCodes.EncryptedPathEndInLowTrustlevel);
errorCodes.add(MontiSecArcAnalysisErrorCodes.DerivedRolesComponent);
errorCodes.add(MontiSecArcAnalysisErrorCodes.TaintPropergation);
assertEquals(9, handler.getWarnings().size());
assertEquals(11, handler.getWarnings().size());
for(ProblemReport error : handler.getErrors()) {
assertTrue(errorCodes.contains(error.getErrorcode()));
}
......@@ -96,8 +98,9 @@ public class MontiSecArcAnalysisTest extends TestWithSymtabAnalysis<MontiSecArcA
errorCodes.add(MontiSecArcAnalysisErrorCodes.ReviewedConfiguration);
errorCodes.add(MontiSecArcAnalysisErrorCodes.DerivedRolesThirdParty);
errorCodes.add(MontiSecArcAnalysisErrorCodes.DerivedRolesComponent);
errorCodes.add(MontiSecArcAnalysisErrorCodes.TaintPropergation);
assertEquals(5, handler.getWarnings().size());
assertEquals(10, handler.getWarnings().size());
for(ProblemReport error : handler.getErrors()) {
assertTrue(errorCodes.contains(error.getErrorcode()));
}
......@@ -115,8 +118,9 @@ public class MontiSecArcAnalysisTest extends TestWithSymtabAnalysis<MontiSecArcA
List<MontiSecArcAnalysisErrorCodes> errorCodes = new ArrayList<MontiSecArcAnalysisErrorCodes>();
errorCodes.add(MontiSecArcAnalysisErrorCodes.DerivedRolesThirdParty);
errorCodes.add(MontiSecArcAnalysisErrorCodes.DerivedRolesComponent);
errorCodes.add(MontiSecArcAnalysisErrorCodes.TaintPropergation);
assertEquals(2, handler.getWarnings().size());
assertEquals(6, handler.getWarnings().size());
for(ProblemReport error : handler.getErrors()) {
assertTrue(errorCodes.contains(error.getErrorcode()));
}
......@@ -136,8 +140,9 @@ public class MontiSecArcAnalysisTest extends TestWithSymtabAnalysis<MontiSecArcA
errorCodes.add(MontiSecArcAnalysisErrorCodes.ListOutgoingPorts);
errorCodes.add(MontiSecArcAnalysisErrorCodes.ListAllCriticalPorts);
errorCodes.add(MontiSecArcAnalysisErrorCodes.DerivedRolesComponent);
errorCodes.add(MontiSecArcAnalysisErrorCodes.TaintPropergation);
assertEquals(9, handler.getWarnings().size());
assertEquals(23, handler.getWarnings().size());
for(ProblemReport error : handler.getErrors()) {
assertTrue(errorCodes.contains(error.getErrorcode()));
}
......
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