Commit 60fa678e authored by Paff's avatar Paff
Browse files

analysisL: list all third party components

parent ac9d3beb
/**
* Generated on Mon Oct 20 15:05:10 CEST 2014
* Generated on Mon Oct 20 17:02:36 CEST 2014
*/
config {
Require-Model:
......
......@@ -125,4 +125,5 @@ public enum MontiSecArcErrorCodes implements IErrorCode {
* Checks if the components have the correct relation regarding the trustlevel
*/
CorrectRelationBetweenTrustlevel,
}
/**
* Generated on Mon Oct 20 15:05:31 CEST 2014
* Generated on Mon Oct 20 17:02:55 CEST 2014
*/
config {
Require-Model:
......
......@@ -126,4 +126,9 @@ public enum MontiSecArcAnalysisErrorCodes implements IErrorCode {
*/
RepeatFilteringInHigherTrustlevel,
/**
* Lists all third party components
*/
ListThirdPartyComponents,
}
package secarc.ets.analysis.component;
import interfaces2.resolvers.AmbigousException;
import mc.IErrorCode;
import mc.umlp.arcd._ast.ASTArcComponent;
import secarc.error.MontiSecArcAnalysisErrorCodes;
import secarc.ets.analysis.checker.Analysis;
import secarc.ets.analysis.checker.ISecAnalysisComponentChecker;
import secarc.ets.check.MontiSecArcAnalysisConstants;
import secarc.ets.entries.SecComponentEntry;
/**
* Lists all third party components with configuration and version
*
* <br>
* <br>
* Copyright (c) 2011 RWTH Aachen. All rights reserved
*
* @author (last commit) $Author$
* @version $Date$<br>
* $Revision$
*
*/
public class ListThirdPartyComponents extends Analysis implements
ISecAnalysisComponentChecker {
public ListThirdPartyComponents() {
super(MontiSecArcAnalysisConstants.LIST_THIRD_PARTY_COMPONENTS);
}
/*
* (non-Javadoc)
* @see secarc.ets.analysis.checker.ISecAnalysisComponentChecker#check(mc.umlp.arcd._ast.ASTArcComponent, secarc.ets.entries.SecComponentEntry)
*/
@Override
public void check(ASTArcComponent node, SecComponentEntry entry)
throws AmbigousException {
if(entry.getConfiguration() != null && entry.getVersion() != null) {
addReport("The third party component " + entry.getName() + " has the version " + entry.getVersion().getVersion() + " and configuration " + entry.getConfiguration().getName() + ".", node.get_SourcePositionStart());
}
}
/*
* (non-Javadoc)
* @see interfaces2.coco.ContextCondition#getErrorCode()
*/
@Override
public IErrorCode getErrorCode() {
return MontiSecArcAnalysisErrorCodes.ListThirdPartyComponents;
}
}
......@@ -78,4 +78,8 @@ public final class MontiSecArcAnalysisConstants {
public static final String DERIVED_TRUSTLEVEL = "Drives turstlevel for components which do not have a trustlevel.";
public static final String ALL_COMPONENT = "Checks all analysis related to components";
public static final String LIST_THIRD_PARTY_COMPONENTS = "Lists all third party components of the system.";
}
......@@ -6,6 +6,7 @@ import interfaces2.coco.CompositeContextCondition;
import java.util.HashMap;
import java.util.Map;
import secarc.ets.analysis.component.ListThirdPartyComponents;
import secarc.ets.analysis.configuration.ReviewedConfiguration;
import secarc.ets.analysis.connect.EncryptedPathWithUnencryptedPart;
import secarc.ets.analysis.connect.UnencryptedConnectorThroughLowTurstlevel;
......@@ -187,6 +188,12 @@ public final class MontiSecArcAnalysisCreator {
//Dervied trustlevel for components without trustlevel
trustlevelAnalysis.addChild(new DerivedTrustlevel());
//Analysis for components
CompositeContextCondition componentAnalysis = new CompositeContextCondition(MontiSecArcAnalysisConstants.ALL_COMPONENT);
//Lists all third party componnts
componentAnalysis.addChild(new ListThirdPartyComponents());
analysis.addChild(connectorAnalysis);
analysis.addChild(filterAnalysis);
analysis.addChild(portAnalysis);
......@@ -194,6 +201,7 @@ public final class MontiSecArcAnalysisCreator {
analysis.addChild(roleAnalysis);
analysis.addChild(identityAnalysis);
analysis.addChild(trustlevelAnalysis);
analysis.addChild(componentAnalysis);
}
return analysis;
......
......@@ -44,15 +44,12 @@ public class MontiSecArcAnalysisTest extends TestWithSymtabAnalysis<MontiSecArcA
assertTrue(tool.run());
List<MontiSecArcAnalysisErrorCodes> errorCodes = new ArrayList<MontiSecArcAnalysisErrorCodes>();
// errorCodes.add(MontiSecArcAnalysisErrorCodes.ListEncryptedConnected);
errorCodes.add(MontiSecArcAnalysisErrorCodes.ListIncomingtPorts);
errorCodes.add(MontiSecArcAnalysisErrorCodes.EncryptedPathWithUnencryptedPart);
errorCodes.add(MontiSecArcAnalysisErrorCodes.EncryptedPathEndInLowTrustlevel);
errorCodes.add(MontiSecArcAnalysisErrorCodes.UnencryptedConnectorThroughLowTrustlevel);
errorCodes.add(MontiSecArcAnalysisErrorCodes.TaintPropergation);
errorCodes.add(MontiSecArcAnalysisErrorCodes.TrustlevelPathHigherThanEnvironment);
errorCodes.add(MontiSecArcAnalysisErrorCodes.ListThirdPartyComponents);
assertEquals(3, handler.getWarnings().size());
assertEquals(4, handler.getWarnings().size());
for(ProblemReport error : handler.getErrors()) {
assertTrue(errorCodes.contains(error.getErrorcode()));
}
......@@ -78,7 +75,7 @@ public class MontiSecArcAnalysisTest extends TestWithSymtabAnalysis<MontiSecArcA
tool.init();
assertTrue(tool.run());
assertEquals(5, handler.getWarnings().size());
assertEquals(6, handler.getWarnings().size());
for(ProblemReport error : handler.getErrors()) {
assertTrue(errorCodes.contains(error.getErrorcode()));
}
......@@ -91,7 +88,7 @@ public class MontiSecArcAnalysisTest extends TestWithSymtabAnalysis<MontiSecArcA
tool.init();
assertTrue(tool.run());
assertEquals(2, handler.getWarnings().size());
assertEquals(3, handler.getWarnings().size());
for(ProblemReport error : handler.getErrors()) {
assertTrue(errorCodes.contains(error.getErrorcode()));
}
......@@ -147,8 +144,9 @@ public class MontiSecArcAnalysisTest extends TestWithSymtabAnalysis<MontiSecArcA
List<MontiSecArcAnalysisErrorCodes> errorCodes = new ArrayList<MontiSecArcAnalysisErrorCodes>();
errorCodes.add(MontiSecArcAnalysisErrorCodes.ReviewedConfiguration);
errorCodes.add(MontiSecArcAnalysisErrorCodes.ListThirdPartyComponents);
assertEquals(1, handler.getWarnings().size());
assertEquals(2, handler.getWarnings().size());
for(ProblemReport error : handler.getErrors()) {
assertTrue(errorCodes.contains(error.getErrorcode()));
}
......@@ -160,8 +158,10 @@ public class MontiSecArcAnalysisTest extends TestWithSymtabAnalysis<MontiSecArcA
tool = createTestToolWithoutJava(new String[] { "src/test/resources/secarc/analysis/configuration/ConfigurationReviewed.secarc" });
tool.init();
assertTrue(tool.run());
errorCodes.add(MontiSecArcAnalysisErrorCodes.ListThirdPartyComponents);
assertEquals(0, handler.getWarnings().size());
assertEquals(1, handler.getWarnings().size());
for(ProblemReport error : handler.getErrors()) {
assertTrue(errorCodes.contains(error.getErrorcode()));
}
......@@ -185,8 +185,9 @@ public class MontiSecArcAnalysisTest extends TestWithSymtabAnalysis<MontiSecArcA
errorCodes.add(MontiSecArcAnalysisErrorCodes.IdentityWithEncryption);
errorCodes.add(MontiSecArcAnalysisErrorCodes.DerivedRolesPort);
errorCodes.add(MontiSecArcAnalysisErrorCodes.RoleAccess);
errorCodes.add(MontiSecArcAnalysisErrorCodes.ListThirdPartyComponents);
assertEquals(6, handler.getWarnings().size());
assertEquals(7, 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