Search in sources :

Example 1 with Edge

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;
}
Also used : Vertex(org.iobserve.service.privacy.violation.transformation.analysisgraph.Vertex) ArrayList(java.util.ArrayList) Edge(org.iobserve.service.privacy.violation.transformation.analysisgraph.Edge)

Example 2 with Edge

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;
}
Also used : Vertex(org.iobserve.service.privacy.violation.transformation.analysisgraph.Vertex) ArrayList(java.util.ArrayList) Edge(org.iobserve.service.privacy.violation.transformation.analysisgraph.Edge)

Example 3 with Edge

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);
        }
    }
}
Also used : Vertex(org.iobserve.service.privacy.violation.transformation.analysisgraph.Vertex) Edge(org.iobserve.service.privacy.violation.transformation.analysisgraph.Edge)

Example 4 with Edge

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");
            }
        }
    }
}
Also used : Vertex(org.iobserve.service.privacy.violation.transformation.analysisgraph.Vertex) EDataProtectionLevel(org.iobserve.model.privacy.EDataProtectionLevel) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) ParameterModifier(org.palladiosimulator.pcm.repository.ParameterModifier) Parameter(org.palladiosimulator.pcm.repository.Parameter) Edge(org.iobserve.service.privacy.violation.transformation.analysisgraph.Edge) IDataProtectionAnnotation(org.iobserve.model.privacy.IDataProtectionAnnotation)

Example 5 with Edge

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());
    }
}
Also used : AllocationContext(org.palladiosimulator.pcm.allocation.AllocationContext) Vertex(org.iobserve.service.privacy.violation.transformation.analysisgraph.Vertex) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) Edge(org.iobserve.service.privacy.violation.transformation.analysisgraph.Edge)

Aggregations

Edge (org.iobserve.service.privacy.violation.transformation.analysisgraph.Edge)9 Vertex (org.iobserve.service.privacy.violation.transformation.analysisgraph.Vertex)6 OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)5 AllocationContext (org.palladiosimulator.pcm.allocation.AllocationContext)4 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 Set (java.util.Set)3 ArrayList (java.util.ArrayList)2 WarningModel (org.iobserve.service.privacy.violation.data.WarningModel)2 Date (java.util.Date)1 LinkedHashSet (java.util.LinkedHashSet)1 LinkedList (java.util.LinkedList)1 EDataProtectionLevel (org.iobserve.model.privacy.EDataProtectionLevel)1 IDataProtectionAnnotation (org.iobserve.model.privacy.IDataProtectionAnnotation)1 ProbeManagementData (org.iobserve.service.privacy.violation.data.ProbeManagementData)1 ModelProbeController (org.iobserve.service.privacy.violation.filter.ModelProbeController)1 PrivacyChecker (org.iobserve.service.privacy.violation.transformation.privacycheck.PrivacyChecker)1 Test (org.junit.Test)1 Parameter (org.palladiosimulator.pcm.repository.Parameter)1 ParameterModifier (org.palladiosimulator.pcm.repository.ParameterModifier)1