use of org.iobserve.service.privacy.violation.transformation.analysisgraph.Edge in project iobserve-analysis by research-iobserve.
the class PrivacyChecker method determineSetPotentialWarnings.
/**
* Computes potential warning WARNING TMP.
*
* @param graph
* the graph
* @param policy
* the policy model
* @return returns list of edges
*/
// TODO better method name
private List<Edge> determineSetPotentialWarnings(final PrivacyGraph graph, final Policy policy) {
final List<Edge> warnings = new ArrayList<>();
final Vertex excludedGeolocationVertice = graph.getVertexByName(policy.getEisocode().getName());
if (excludedGeolocationVertice != null) {
final Map<String, Vertex> componentVerticesDeployedAt = graph.getComponentVerticesDeployedAt(policy.getEisocode());
for (final String verticeName : componentVerticesDeployedAt.keySet()) {
final Vertex verticeAtExcludedGeolocation = componentVerticesDeployedAt.get(verticeName);
warnings.addAll(verticeAtExcludedGeolocation.getIncomingEdges());
final List<Edge> relevantDatatransfers = verticeAtExcludedGeolocation.getOutgoingEdgesClassifiedAtLeast(policy.getDataClassification());
warnings.addAll(relevantDatatransfers);
}
} else {
PrivacyChecker.LOGGER.debug("Policy's geo location not included in the runtime model");
}
return warnings;
}
use of org.iobserve.service.privacy.violation.transformation.analysisgraph.Edge in project iobserve-analysis by research-iobserve.
the class PrivacyChecker method determineSetWARNING.
private List<Edge> determineSetWARNING(final List<Edge> potentialWarnings, final Policy policy) {
final List<Edge> warnings = new ArrayList<>();
for (final Edge edge : potentialWarnings) {
this.violatedByWalkthrough = false;
final Vertex startNode = edge.getTarget();
final List<Vertex> walkthrough = new ArrayList<>();
this.walkthroughFromToDatabase(startNode, policy.getDataClassification(), walkthrough);
if (this.violatedByWalkthrough) {
warnings.add(edge);
}
}
return warnings;
}
use of org.iobserve.service.privacy.violation.transformation.analysisgraph.Edge in project iobserve-analysis by research-iobserve.
the class PrivacyChecker method walkthroughFromToDatabase.
private void walkthroughFromToDatabase(final Vertex node, final EDataClassification dataClassification, final List<Vertex> walkthrough) {
walkthrough.add(node);
if (node.getStereoType().equals(Vertex.EStereoType.DATASOURCE)) {
this.violatedByWalkthrough = true;
return;
}
final List<Edge> outgoingEdgesClassifiedAtLeast = node.getOutgoingEdgesClassifiedAtLeast(dataClassification);
for (final Edge edge : outgoingEdgesClassifiedAtLeast) {
final Vertex targetNode = edge.getTarget();
if (!walkthrough.contains(targetNode)) {
this.walkthroughFromToDatabase(targetNode, dataClassification, walkthrough);
}
}
}
use of org.iobserve.service.privacy.violation.transformation.analysisgraph.Edge in project iobserve-analysis by research-iobserve.
the class DataProtectionWarner method computePrivacyLevelsAndAddEdge.
private void computePrivacyLevelsAndAddEdge(final PrivacyGraph graph, final OperationInterface operationInterface, final RepositoryComponent providingComponent, final RepositoryComponent requiringComponent) throws InvocationException, DBException {
for (final OperationSignature operationSignature : operationInterface.getSignatures__OperationInterface()) {
final IDataProtectionAnnotation operationSignaturePrivacyAnnotation = this.returntypeprivacy.get(operationSignature.getId());
EDataProtectionLevel inEdgeDataProtectionLevel = null;
EDataProtectionLevel outEdgePrivacyLevel = null;
/**
* Check parameter.
*/
for (final Parameter proxyParameter : operationSignature.getParameters__OperationSignature()) {
final Parameter parameter = this.repositoryResource.resolve(proxyParameter);
final ParameterModifier mod = parameter.getModifier__Parameter();
if (mod == ParameterModifier.IN || mod == ParameterModifier.INOUT) {
final String parameterName = parameter.getParameterName();
outEdgePrivacyLevel = this.updateDataProtectionLevel(outEdgePrivacyLevel, this.parameterprivacy.get(parameterName).getLevel());
}
if (mod == ParameterModifier.OUT || mod == ParameterModifier.INOUT) {
inEdgeDataProtectionLevel = this.updateDataProtectionLevel(inEdgeDataProtectionLevel, this.parameterprivacy.get(parameter.getParameterName()).getLevel());
}
}
/**
* Check return type.
*/
if (operationSignaturePrivacyAnnotation != null) {
inEdgeDataProtectionLevel = this.updateDataProtectionLevel(inEdgeDataProtectionLevel, operationSignaturePrivacyAnnotation.getLevel());
}
final Vertex providingComponentVertex = this.vertices.get(providingComponent.getId());
final Vertex requiringComponentVertex = this.vertices.get(requiringComponent.getId());
if (providingComponentVertex != null && requiringComponentVertex != null) {
// Add Edges
if (inEdgeDataProtectionLevel != null) {
final Edge edge = new Edge(providingComponentVertex, requiringComponentVertex);
edge.setDPC(Policy.getDataClassification(inEdgeDataProtectionLevel));
edge.setOperationSignature(operationSignature);
graph.addEdge(edge);
}
if (outEdgePrivacyLevel != null) {
final Edge edge = new Edge(requiringComponentVertex, providingComponentVertex);
edge.setDPC(Policy.getDataClassification(outEdgePrivacyLevel));
edge.setOperationSignature(operationSignature);
graph.addEdge(edge);
}
if (inEdgeDataProtectionLevel == null && outEdgePrivacyLevel == null) {
this.logger.error("Missing privacy level");
}
}
}
}
use of org.iobserve.service.privacy.violation.transformation.analysisgraph.Edge in project iobserve-analysis by research-iobserve.
the class DataProtectionWarner method print.
private void print(final PrivacyGraph graph) {
java.lang.System.out.println("Graph-Name " + graph.getName());
java.lang.System.out.println("Vertices");
for (final Entry<String, Vertex> entry : graph.getVertices().entrySet()) {
final String entityName;
final AllocationContext context = entry.getValue().getAllocationContext();
if (context != null) {
entityName = context.getEntityName();
} else {
entityName = "<missing allocation context>";
}
java.lang.System.out.println("\t" + entry.getKey() + " = " + entry.getValue().getName() + " : " + entityName);
}
java.lang.System.out.println("Edges");
for (final Edge value : graph.getEdges()) {
final String entityName;
final OperationSignature context = value.getOperationSignature();
if (context != null) {
entityName = context.getEntityName();
} else {
entityName = "<missing operation signature>";
}
java.lang.System.out.println("\t" + entityName + " " + value.getSource().getName() + " -> " + value.getTarget().getName());
}
}
Aggregations