Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
MontiSecArc
Commits
60fa678e
Commit
60fa678e
authored
Oct 20, 2014
by
Paff
Browse files
analysisL: list all third party components
parent
ac9d3beb
Changes
8
Hide whitespace changes
Inline
Side-by-side
lang-example/mc.cfg
View file @
60fa678e
/**
* Generated on Mon Oct 20 1
5
:0
5:10
CEST 2014
* Generated on Mon Oct 20 1
7
:0
2:36
CEST 2014
*/
config {
Require-Model:
...
...
lang-example/src/main/java/secarc/error/MontiSecArcErrorCodes.java
View file @
60fa678e
...
...
@@ -125,4 +125,5 @@ public enum MontiSecArcErrorCodes implements IErrorCode {
* Checks if the components have the correct relation regarding the trustlevel
*/
CorrectRelationBetweenTrustlevel
,
}
montiSecArcAnalysis/mc.cfg
View file @
60fa678e
/**
* Generated on Mon Oct 20 1
5
:0
5:31
CEST 2014
* Generated on Mon Oct 20 1
7
:0
2:55
CEST 2014
*/
config {
Require-Model:
...
...
montiSecArcAnalysis/src/main/java/secarc/error/MontiSecArcAnalysisErrorCodes.java
View file @
60fa678e
...
...
@@ -126,4 +126,9 @@ public enum MontiSecArcAnalysisErrorCodes implements IErrorCode {
*/
RepeatFilteringInHigherTrustlevel
,
/**
* Lists all third party components
*/
ListThirdPartyComponents
,
}
montiSecArcAnalysis/src/main/java/secarc/ets/analysis/component/ListThirdPartyComponents.java
0 → 100644
View file @
60fa678e
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
;
}
}
montiSecArcAnalysis/src/main/java/secarc/ets/check/MontiSecArcAnalysisConstants.java
View file @
60fa678e
...
...
@@ -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."
;
}
montiSecArcAnalysis/src/main/java/secarc/ets/check/MontiSecArcAnalysisCreator.java
View file @
60fa678e
...
...
@@ -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
;
...
...
montiSecArcAnalysis/src/test/java/secarc/MontiSecArcAnalysisTest.java
View file @
60fa678e
...
...
@@ -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
.
TrustlevelPathHigherThanEnvironm
ent
);
errorCodes
.
add
(
MontiSecArcAnalysisErrorCodes
.
ListThirdPartyCompon
ent
s
);
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
()));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment