Commit e4c33ae7 authored by Paff's avatar Paff

analysis: list critical ports

parent 976450c2
/**
* Generated on Mon Oct 06 11:12:14 CEST 2014
* Generated on Mon Oct 06 12:26:32 CEST 2014
*/
config {
Require-Model:
......
/**
* Generated on Mon Oct 06 11:12:33 CEST 2014
* Generated on Mon Oct 06 12:26:53 CEST 2014
*/
config {
Require-Model:
......
......@@ -64,4 +64,9 @@ public enum MontiSecArcAnalysisErrorCodes implements IErrorCode {
* Derives all roles for a third party component
*/
DerivedRolesThirdParty,
/**
* Lists all critical ports
*/
ListAllCriticalPorts,
}
package secarc.ets.analysis.port;
import interfaces2.resolvers.AmbigousException;
import mc.IErrorCode;
import mc.umlp.arcd._ast.ASTArcPort;
import secarc.error.MontiSecArcAnalysisErrorCodes;
import secarc.ets.analysis.checker.Analysis;
import secarc.ets.analysis.checker.ISecAnalysisPortChecker;
import secarc.ets.check.MontiSecArcAnalysisConstants;
import secarc.ets.entries.SecPortEntry;
import secarc.ets.graph.ArchitectureGraph;
/**
* Lists all critical ports of the system
*
* <br>
* <br>
* Copyright (c) 2011 RWTH Aachen. All rights reserved
*
* @author (last commit) $Author$
* @version $Date$<br>
* $Revision$
*
*/
public class ListCriticalPorts extends Analysis implements
ISecAnalysisPortChecker {
public ListCriticalPorts() {
super(MontiSecArcAnalysisConstants.LIST_CRITICAL_PORTS);
}
/*
* (non-Javadoc)
* @see secarc.ets.analysis.checker.ISecAnalysisPortChecker#check(mc.umlp.arcd._ast.ASTArcPort, secarc.ets.entries.SecPortEntry, secarc.ets.graph.ArchitectureGraph)
*/
@Override
public void check(ASTArcPort node, SecPortEntry entry,
ArchitectureGraph graph) throws AmbigousException {
if(entry.isCritical()) {
addReport("The port " + entry.getName() + " is critical.", node.get_SourcePositionEnd());
}
}
/*
* (non-Javadoc)
* @see interfaces2.coco.ContextCondition#getErrorCode()
*/
@Override
public IErrorCode getErrorCode() {
return MontiSecArcAnalysisErrorCodes.ListAllCriticalPorts;
}
}
......@@ -38,9 +38,11 @@ public final class MontiSecArcAnalysisConstants {
public static final String ALL_PORT_ANALYSIS = "Checks all analysis related to ports.";
public static final String LIST_INCOMING_PORTS = "Lists all incoming ports of the system";
public static final String LIST_INCOMING_PORTS = "Lists all incoming ports of the system.";
public static final String LIST_OUTGOING_PORTS = "Lists all outgoing ports of the system";
public static final String LIST_OUTGOING_PORTS = "Lists all outgoing ports of the system.";
public static final String LIST_CRITICAL_PORTS = "Lists all critical ports of the system.";
public static final String ALL_CONFIGURATION_ANALYSIS = "Checks all analysis related to configuration.";
......
......@@ -13,6 +13,7 @@ import secarc.ets.analysis.connect.ListEncryptedData;
import secarc.ets.analysis.connect.UnencryptedConnectorThroughLowTurstlevel;
import secarc.ets.analysis.filter.ListFilters;
import secarc.ets.analysis.filter.TaintTracking;
import secarc.ets.analysis.port.ListCriticalPorts;
import secarc.ets.analysis.port.ListSystemIncomingPorts;
import secarc.ets.analysis.port.ListSystemOutgoingPorts;
import secarc.ets.analysis.role.DerivedRolesThirdParty;
......@@ -126,6 +127,9 @@ public final class MontiSecArcAnalysisCreator {
//List all outgoing ports
portAnalysis.addChild(new ListSystemOutgoingPorts());
//List all ciritcal ports
portAnalysis.addChild(new ListCriticalPorts());
//Analysis for configurations
CompositeContextCondition configurationAnalysis = new CompositeContextCondition(MontiSecArcAnalysisConstants.ALL_CONFIGURATION_ANALYSIS);
......
......@@ -130,8 +130,9 @@ public class MontiSecArcAnalysisTest extends TestWithSymtabAnalysis<MontiSecArcA
List<MontiSecArcAnalysisErrorCodes> errorCodes = new ArrayList<MontiSecArcAnalysisErrorCodes>();
errorCodes.add(MontiSecArcAnalysisErrorCodes.ListIncomingtPorts);
errorCodes.add(MontiSecArcAnalysisErrorCodes.ListOutgoingPorts);
errorCodes.add(MontiSecArcAnalysisErrorCodes.ListAllCriticalPorts);
assertEquals(2, handler.getWarnings().size());
assertEquals(3, handler.getWarnings().size());
for(ProblemReport error : handler.getErrors()) {
assertTrue(errorCodes.contains(error.getErrorcode()));
}
......
package secarc.analysis.port;
component CriticalPort {
accesscontrol on;
trustlevel +1;
component Help help {
trustlevel +1;
identity weak help -> targetHelp;
}
component TargetHelp targetHelp {
port critical in String inputTarget;
access user;
}
component SubEncryptedConnector subEncryptedConnector {
trustlevel +1;
port
in String inputSub,
in String inputSub2,
out String outputSub;
}
}
\ No newline at end of file
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