Class FlowComm

java.lang.Object
org.eclipse.viatra.query.runtime.api.impl.BaseQuerySpecification<FlowComm.Matcher>
org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification<FlowComm.Matcher>
be.kuleuven.cs.distrinet.sparta.queries.FlowComm
All Implemented Interfaces:
org.eclipse.viatra.query.runtime.api.IQuerySpecification<FlowComm.Matcher>, org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQueryHeader

public final class FlowComm extends org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification<FlowComm.Matcher>
A pattern-specific query specification that can instantiate Matcher in a type-safe way.

Original source:

         ////////////////////////////////////////////////////////////////////////////////////////////////////
         // SPARTA DFD threat-elicitation pattern catalog
         //
         // This file is the built-in catalog of VIATRA patterns used for threat elicitation. The generated
         // matcher classes of every public Comm pattern are referenced BY NAME from Java
         // (Engine.getPatternMatchers in be.kuleuven.cs.distrinet.sparta.core), so do not rename patterns or
         // change their signatures without updating those call sites.
         //
         // == Pattern families ==
         //
         // <X>To<Y>Comm       (e.g. processToDataStoreComm)
         //   Matches a directed communication over a DataFlow `df` between an element of type X and an
         //   element of type Y. The `location` parameter is the DFD element the elicited threat is
         //   attached to.
         //
         // <X>Through<Y>Comm  (e.g. processThroughDataStoreComm)
         //   Same as the To variant, but additionally requires the flow to cross a trust boundary: some
         //   TrustBoundaryContainer (transitively) contains one endpoint but not the other
         //   (see flowContainerDiff below).
         //
         // flowComm / flowThroughComm
         //   Generic variants that attach the threat to the DataFlow itself (`location : DataFlow`)
         //   instead of to one of its endpoints.
         //
         // == Applicability strings ==
         //
         // Every pattern body guards itself with
         //     find threatApplicable(location, t, "<key>");
         // The <key> string is compared literally — by plain map-key equality, the `` is part of the key,
         // NOT a wildcard — against the keys of the AbstractThreatType.patterns map (EStringToEBooleanMap)
         // of the threat type or of one of its CompositeThreatType ancestors. A threat catalog enables a
         // body by mapping that key to true, and vetoes it by mapping it to false (see the cascade below).
         //
         // Key naming conventions (Through keys behave identically, with the added boundary-crossing
         // requirement):
         //
         // - "XToY" (no asterisk): forward-direction body. The threat is attached to the flow's SENDER:
         //   `location` (of type X) sends `df` to `p2` (of type Y) — find communication(location, df, p2).
         //   The key equals the name of the pattern hosting the body (e.g. "ProcessToDataStore" in
         //   processToDataStoreComm).
         //
         // - "XToY" (trailing asterisk): inverse-direction body. The flow still runs X -> Y, but the
         //   threat is attached to the flow's RECIPIENT (the Y endpoint). Such a body therefore lives in
         //   the pattern whose `location` type is Y: e.g. "DataStoreToProcess" is the second body of
         //   processToDataStoreComm — `p2` (DataStore) sends `df` to `location` (Process).
         //
         // - "XToY" (asterisk in the middle): used only by the generic flowComm / flowThroughComm
         //   patterns. The `` marks the position of the threat: it is attached to the DataFlow itself,
         //   flowing from an X sender to a Y recipient. Direction matters (e.g. "ProcessToDataStore" and
         //   "DataStoreToProcess" are distinct keys), and only pairs involving a Process are provided.
         //   The fully generic keys "DataFlow" (flowComm) and "DataFlowThrough" (flowThroughComm) match a
         //   flow regardless of its endpoint types.
         //
         // == Enable/disable cascade (threatApplicable) ==
         //
         // A body matches threat type `t` for key `k` if and only if ALL of the following hold:
         //  1. `t` itself is enabled (ThreatType.enabled == true);
         //  2. `t` or one of its ancestors maps `k` to true in its patterns map (threatPattern). The
         //     ancestor chain is `t` itself plus every CompositeThreatType that (transitively) contains it
         //     via subThreatTypes (threatTypeParent / threatTypeAncestor), so enablement is inherited;
         //  3. no ancestor in that chain is disabled (neg threatTypeParentDisabled);
         //  4. no enabled ancestor maps `k` to false (neg threatPatternDisabled) — an explicit false
         //     anywhere in the hierarchy vetoes a true inherited from elsewhere;
         //  5. no ThreatSpecification whose `threat` targets `t` or an ancestor
         //     - disables the threat outright (enabled == false, threatSpecDisable),
         //     - maps `k` to false in its own patterns map (threatSpecPatternDisable), or
         //     - disables the element type of `location` — "Process" / "DataStore" / "ExternalEntity" /
         //       "DataFlow" mapped to false in its types map (threatSpecTypeDisable).
         //     ThreatSpecifications are per-model overrides: a model can switch off catalog threats,
         //     individual pattern keys, or whole element types without editing the catalog itself.
         //
         // == Supporting helper patterns ==
         //
         // - communication(sender, flow, recipient): resolves the logical endpoints of a DataFlow through
         //   chains of SenderSpecification / RecipientSpecification indirections
         //   (sendSpecReachable / receiveSpecReachable).
         // - flowContainerDiff(sender, recipient): the two entities communicate (in either direction) and
         //   some TrustBoundaryContainer contains exactly one of them, i.e. the flow crosses that trust
         //   boundary. Containment is resolved transitively (contains / containment).
         ////////////////////////////////////////////////////////////////////////////////////////////////////
         
         pattern flowComm(location : DataFlow, p : DataFlowEntity, p2 : DataFlowEntity,
                                                                t : ThreatType) {
                DataFlow(location);DataFlowEntity(p);DataFlowEntity(p2);
         
                find threatApplicable(location,t,"DataFlow");
                find communication(p,location,p2);
         } or {
                Process(p);
                Process(p2);
                find threatApplicable(location,t,"ProcessToProcess");
                find communication(p,location,p2);
         } or {
                Process(p);
                DataStore(p2);
                find threatApplicable(location,t,"ProcessToDataStore");
                find communication(p,location,p2);
         } or {
                DataStore(p);
                Process(p2);
                find threatApplicable(location,t,"DataStoreToProcess");
                find communication(p,location,p2);
         } or {
                Process(p);
                ExternalEntity(p2);
                find threatApplicable(location,t,"ProcessToExternalEntity");
                find communication(p,location,p2);
         } or {
                ExternalEntity(p);
                Process(p2);
                find threatApplicable(location,t,"ExternalEntityToProcess");
                find communication(p,location,p2);
         }
 
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Pattern-specific match representation of the be.kuleuven.cs.distrinet.sparta.queries.flowComm pattern, to be used in conjunction with FlowComm.Matcher.
    static class 
    Generated pattern matcher API of the be.kuleuven.cs.distrinet.sparta.queries.flowComm pattern, providing pattern-specific query methods.
  • Field Summary

    Fields inherited from class org.eclipse.viatra.query.runtime.api.impl.BaseQuerySpecification

    wrappedPQuery
  • Method Summary

    Modifier and Type
    Method
    Description
    static FlowComm
     
     
    instantiate(org.eclipse.viatra.query.runtime.api.ViatraQueryEngine engine)
     
     
    newMatch(Object... parameters)
     

    Methods inherited from class org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification

    getPreferredScopeClass

    Methods inherited from class org.eclipse.viatra.query.runtime.api.impl.BaseQuerySpecification

    ensureInitializedInternal, getAllAnnotations, getAnnotationsByName, getFirstAnnotationByName, getFullyQualifiedName, getInternalQueryRepresentation, getMatcher, getParameterNames, getParameters, getPositionOfParameter, getVisibility, processInitializerError

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.eclipse.viatra.query.runtime.api.IQuerySpecification

    getPProblems, getStatus

    Methods inherited from interface org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQueryHeader

    getParameter, getSimpleName
  • Method Details

    • instance

      public static FlowComm instance()
      Returns:
      the singleton instance of the query specification
    • instantiate

      protected FlowComm.Matcher instantiate(org.eclipse.viatra.query.runtime.api.ViatraQueryEngine engine)
      Specified by:
      instantiate in class org.eclipse.viatra.query.runtime.api.impl.BaseQuerySpecification<FlowComm.Matcher>
    • instantiate

      public FlowComm.Matcher instantiate()
      Specified by:
      instantiate in interface org.eclipse.viatra.query.runtime.api.IQuerySpecification<FlowComm.Matcher>
      Overrides:
      instantiate in class org.eclipse.viatra.query.runtime.api.impl.BaseQuerySpecification<FlowComm.Matcher>
    • newEmptyMatch

      public FlowComm.Match newEmptyMatch()
    • newMatch

      public FlowComm.Match newMatch(Object... parameters)