Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
keyjoana
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mihai.herda
keyjoana
Commits
da14fc5e
Commit
da14fc5e
authored
Nov 21, 2019
by
Joachim Müssig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clear up code, javadoc
parent
a146dc5b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
70 deletions
+6
-70
src/joanakey/annotations/ExtractAnnotations.java
src/joanakey/annotations/ExtractAnnotations.java
+1
-2
src/joanakey/annotations/SDGNodeAnnotation.java
src/joanakey/annotations/SDGNodeAnnotation.java
+0
-3
src/joanakey/annotations/SDGNodeAnnotationApplicator.java
src/joanakey/annotations/SDGNodeAnnotationApplicator.java
+1
-37
src/joanakey/annotations/SDGNodeAnnotationManager.java
src/joanakey/annotations/SDGNodeAnnotationManager.java
+4
-28
No files found.
src/joanakey/annotations/ExtractAnnotations.java
View file @
da14fc5e
...
...
@@ -15,7 +15,6 @@ import edu.kit.joana.api.lattice.BuiltinLattices;
import
edu.kit.joana.api.sdg.SDGCall
;
import
edu.kit.joana.api.sdg.SDGCallPart
;
import
edu.kit.joana.api.sdg.SDGProgram
;
import
edu.kit.joana.ifc.sdg.graph.SDG
;
public
class
ExtractAnnotations
{
...
...
@@ -25,7 +24,7 @@ public class ExtractAnnotations {
public
static
Collection
<
IFCAnnotation
>
loadAnnotations
(
InputStream
source
,
SDGProgram
program
)
throws
IOException
{
SDG
sdg
=
program
.
getSDG
();
//
SDG sdg = program.getSDG();
Set
<
IFCAnnotation
>
toAnnotate
=
new
LinkedHashSet
<
IFCAnnotation
>();
// SDGProgram program = new SDGProgram(sdg,null);
...
...
src/joanakey/annotations/SDGNodeAnnotation.java
View file @
da14fc5e
...
...
@@ -23,9 +23,6 @@ public class SDGNodeAnnotation extends IFCAnnotation {
private
SDGNode
annotatedNode
;
public
SDGNodeAnnotation
(
SDGNode
annotatedNode
,
AnnotationType
type
,
String
level
,
SDGProgramPart
annotatedPart
)
{
super
(
type
,
level
,
annotatedPart
);
this
.
annotatedNode
=
annotatedNode
;
...
...
src/joanakey/annotations/SDGNodeAnnotationApplicator.java
View file @
da14fc5e
/**
* This file is part of the Joana IFC project. It is developed at the
* Programming Paradigms Group of the Karlsruhe Institute of Technology.
*
* For further details on licensing please read the information at
* http://joana.ipd.kit.edu or contact the authors.
*/
package
joanakey.annotations
;
import
java.util.Collection
;
...
...
@@ -17,18 +10,10 @@ import edu.kit.joana.api.sdg.SDGProgram;
import
edu.kit.joana.ifc.sdg.graph.SDGNode
;
/**
*
TODO: @author muessig.
*
@author joachim
*/
public
class
SDGNodeAnnotationApplicator
extends
IFCAnnotationApplicator
{
// private final SDGProgram program;
// protected SDGAnalysis analysis;
// private final Map<SecurityNode, Set<NodeAnnotationInfo>> annotatedNodes = new HashMap<SecurityNode, Set<NodeAnnotationInfo>>();
//private final IFCAnalysis analysis;
//private final Map<SecurityNode, Set<NodeAnnotationInfo>> annotatedNodes = new HashMap<SecurityNode, Set<NodeAnnotationInfo>>();
public
SDGNodeAnnotationApplicator
(
SDGProgram
program
,
IFCAnalysis
analysis
)
{
super
(
program
,
analysis
);
}
...
...
@@ -47,13 +32,7 @@ public class SDGNodeAnnotationApplicator extends IFCAnnotationApplicator {
if
(
ann
.
getType
()
==
AnnotationType
.
SOURCE
||
ann
.
getType
()
==
AnnotationType
.
SINK
)
{
annotationDebug
.
outln
(
String
.
format
(
"Annnotation nodes for %s '%s' of security level %s..."
,
ann
.
getType
().
toString
(),
ann
.
getProgramPart
(),
ann
.
getLevel1
()));
}
// IFCAnnotationApplicator thisApp = (IFCAnnotationApplicator) this;
// ann.accept(thisApp);
//TODO: muessig test this. Alternatively "instance of" -.-
ann
.
accept
(
this
);
// applyAnnotation(ann);
}
}
...
...
@@ -61,19 +40,4 @@ public class SDGNodeAnnotationApplicator extends IFCAnnotationApplicator {
annotateNode
(
ann
.
getAnnotatedNode
(),
ann
);
}
// public void applyAnnotations(Collection<IFCAnnotation> anns) {
// for (IFCAnnotation ann : anns) {
// if (ann instanceof SDGNodeAnnotation) {
// SDGNodeAnnotation annSDG = (SDGNodeAnnotation) ann;
// if (ann.getType() == AnnotationType.SOURCE || annSDG.getType() == AnnotationType.SINK) {
// // annotationDebug.outln(String.format("Annnotation nodes for %s '%s' of security level %s...", ann.getType().toString(), ann.getProgramPart(), ann.getLevel1()));
// }
// annotateNode(annSDG);
// } else {
// System.out.println("!");
// super.applyAnnotations(anns);
// }
// }
// }
}
src/joanakey/annotations/SDGNodeAnnotationManager.java
View file @
da14fc5e
...
...
@@ -17,51 +17,31 @@ import edu.kit.joana.api.sdg.SDGProgramPart;
import
edu.kit.joana.ifc.sdg.graph.SDGNode
;
/**
* TODO: @author muessig
*
*@author joachim
*/
public
class
SDGNodeAnnotationManager
extends
IFCAnnotationManager
{
// private final SDGNodeAnnotationApplicator app;
// private final Map<SDGNode, SDGNodeAnnotation> sourceAnnotations;
// private final Map<SDGNode, SDGNodeAnnotation> sinkAnnotations;
// private final Map<SDGNode, SDGNodeAnnotation> declassAnnotations;
/**
*
*/
//TODO: sourceAnnotations/sinkAnnotations really needed with hash<NOde, annotation> ?
public
SDGNodeAnnotationManager
(
SDGProgram
program
,
IFCAnalysis
analysis
)
{
super
(
program
,
analysis
);
// sourceAnnotations = new HashMap<SDGNode, SDGNodeAnnotation>();
// sinkAnnotations = new HashMap<SDGNode, SDGNodeAnnotation>();
// declassAnnotations = new HashMap<SDGNode, SDGNodeAnnotation>();
this
.
app
=
new
SDGNodeAnnotationApplicator
(
program
,
analysis
);
}
//TODO: sourceAnnotations/sinkAnnotations really needed with hash<NOde, annotation> ?
/**
* remove the annotation with the given sdg node
* @param annotated node you want to remove the annotation from
*/
//TODO: Test
public
void
removeAnnotation
(
SDGNode
node
)
{
sourceAnnotations
.
remove
(
node
);
sinkAnnotations
.
remove
(
node
);
declassAnnotations
.
remove
(
node
);
}
//TODO: sourceAnnotations/sinkAnnotations really needed with hash<NOde, annotation> ? add
public
void
addAnnotation
(
SDGNodeAnnotation
ann
)
{
if
(!
isAnnotationLegal
(
ann
))
{
throw
new
IllegalArgumentException
();
}
// if (ann.getType() == AnnotationType.SOURCE) {
// sourceAnnotations.put(ann.getAnnotatedNode(), ann);
// } else if (ann.getType() == AnnotationType.SINK) {
// this.sinkAnnotations.put(ann.getAnnotatedNode(), ann);
// } else {
// this.declassAnnotations.put(ann.getAnnotatedNode(), ann);
// }
if
(
ann
.
getType
()
==
AnnotationType
.
SOURCE
)
{
sourceAnnotations
.
put
(
ann
.
getProgramPart
(),
ann
);
}
else
if
(
ann
.
getType
()
==
AnnotationType
.
SINK
)
{
...
...
@@ -97,12 +77,8 @@ public class SDGNodeAnnotationManager extends IFCAnnotationManager {
// return ret;
// }
//TODO test
public
boolean
isAnnotated
(
SDGNode
node
)
{
return
sourceAnnotations
.
keySet
().
contains
(
node
)
||
sinkAnnotations
.
keySet
().
contains
(
node
)
||
declassAnnotations
.
keySet
().
contains
(
node
);
}
//TODO: removeAllAnnotation etc. correct ?
}
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