Skip to content

Commit

Permalink
Remove PointsTo With CodeGen (ShiftLeftSecurity#1718)
Browse files Browse the repository at this point in the history
* Import Node Tag & Remove Points To
* In Joern's new import resolution, descriptions of entities referred to by imports are described by `Tag` nodes. Since `Import` nodes cannot be tagged, their optional call node is tagged instead. Not all languages use call imports so this excludes languages like Java. This allows import nodes to be tagged to avoid this exclusion.
* Removed the `POINTS_TO` edge as it is no longer used, this was initially brought in as an experimental alias analysis edge but realistically this would likely be done on-the-fly or via `Tag` nodes until a better motivation for this edge is given.

* Remove `PointsTo` Edge Class
This should fix the failing test, seems that this removal will complete PR ShiftLeftSecurity#1716

* Remove `PointsTo` Factory
I have additionally staged and ran +test which now pass. Seems that this will complete PR ShiftLeftSecurity#1717

* Remove `PointsTo` With CodeGen
I have additionally staged and ran +test which now pass. Seems that this will complete PR ShiftLeftSecurity#1717
  • Loading branch information
DavidBakerEffendi authored Jun 26, 2023
1 parent a4e7365 commit 26e6169
Show file tree
Hide file tree
Showing 26 changed files with 431 additions and 996 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ other words, there is a (name, signature) pair that can be resolved for the type
method output parameter. */
public static final String PARAMETER_LINK = "PARAMETER_LINK";

/** Used for calculating points-to sets for resolving object aliasing. */
public static final String POINTS_TO = "POINTS_TO";

/** This edge indicates that the source node immediately post dominates the destination node. */
public static final String POST_DOMINATE = "POST_DOMINATE";

Expand Down Expand Up @@ -130,7 +127,6 @@ other words, there is a (name, signature) pair that can be resolved for the type
add(INHERITS_FROM);
add(IS_CALL_FOR_IMPORT);
add(PARAMETER_LINK);
add(POINTS_TO);
add(POST_DOMINATE);
add(REACHING_DEF);
add(RECEIVER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ object Factories {
InheritsFrom.factory,
IsCallForImport.factory,
ParameterLink.factory,
PointsTo.factory,
PostDominate.factory,
ReachingDef.factory,
Receiver.factory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,18 @@ object Annotation {
PropertyNames.allAsJava,
List(
io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation,
io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation,
io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation
io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation
).asJava,
List(
io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation,
io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation,
io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation,
io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation
).asJava
)

object Edges {
val Out: Array[String] = Array("ARGUMENT", "AST", "POINTS_TO")
val In: Array[String] = Array("AST", "CFG", "POINTS_TO", "REACHING_DEF")
val Out: Array[String] = Array("ARGUMENT", "AST")
val In: Array[String] = Array("AST", "CFG", "REACHING_DEF")
}

val factory = new NodeFactory[AnnotationDb] {
Expand Down Expand Up @@ -120,9 +118,6 @@ class Annotation(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/
def _annotationParameterAssignViaAstOut: overflowdb.traversal.Traversal[AnnotationParameterAssign] =
get()._annotationParameterAssignViaAstOut

def pointsToOut: Iterator[CfgNode] = get().pointsToOut
override def _pointsToOut = get()._pointsToOut

def astIn: Iterator[AstNode] = get().astIn
override def _astIn = get()._astIn

Expand Down Expand Up @@ -150,9 +145,6 @@ class Annotation(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/
def cfgIn: Iterator[CfgNode] = get().cfgIn
override def _cfgIn = get()._cfgIn

def pointsToIn: Iterator[CfgNode] = get().pointsToIn
override def _pointsToIn = get()._pointsToIn

def reachingDefIn: Iterator[TemplateDom] = get().reachingDefIn
override def _reachingDefIn = get()._reachingDefIn

Expand Down Expand Up @@ -263,11 +255,8 @@ class AnnotationDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode wit
def _annotationParameterAssignViaAstOut: overflowdb.traversal.Traversal[AnnotationParameterAssign] =
astOut.collectAll[AnnotationParameterAssign]

def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](2)
override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2)

def astIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](3)
override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3)
def astIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](2)
override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2)
def _annotationParameterAssignViaAstIn: overflowdb.traversal.Traversal[AnnotationParameterAssign] =
astIn.collectAll[AnnotationParameterAssign]
def _memberViaAstIn: overflowdb.traversal.Traversal[Member] = astIn.collectAll[Member]
Expand All @@ -276,14 +265,11 @@ class AnnotationDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode wit
astIn.collectAll[MethodParameterIn]
def _typeDeclViaAstIn: overflowdb.traversal.Traversal[TypeDecl] = astIn.collectAll[TypeDecl]

def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](4)
override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4)

def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](5)
override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5)
def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](3)
override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3)

def reachingDefIn: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](6)
override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6)
def reachingDefIn: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](4)
override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4)

override def label: String = {
Annotation.Label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,17 @@ object AnnotationLiteral {
val layoutInformation = new NodeLayoutInformation(
Label,
PropertyNames.allAsJava,
List(
io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation,
io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation
).asJava,
List(io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation).asJava,
List(
io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation,
io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation,
io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation,
io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation
).asJava
)

object Edges {
val Out: Array[String] = Array("ARGUMENT", "POINTS_TO")
val In: Array[String] = Array("AST", "CFG", "POINTS_TO", "REACHING_DEF")
val Out: Array[String] = Array("ARGUMENT")
val In: Array[String] = Array("AST", "CFG", "REACHING_DEF")
}

val factory = new NodeFactory[AnnotationLiteralDb] {
Expand Down Expand Up @@ -105,9 +101,6 @@ class AnnotationLiteral(graph_4762: Graph, id_4762: Long /*cf https://github.com
def argumentOut: Iterator[TemplateDom] = get().argumentOut
override def _argumentOut = get()._argumentOut

def pointsToOut: Iterator[CfgNode] = get().pointsToOut
override def _pointsToOut = get()._pointsToOut

def astIn: Iterator[AstNode] = get().astIn
override def _astIn = get()._astIn

Expand All @@ -119,9 +112,6 @@ class AnnotationLiteral(graph_4762: Graph, id_4762: Long /*cf https://github.com
def cfgIn: Iterator[CfgNode] = get().cfgIn
override def _cfgIn = get()._cfgIn

def pointsToIn: Iterator[CfgNode] = get().pointsToIn
override def _pointsToIn = get()._pointsToIn

def reachingDefIn: Iterator[TemplateDom] = get().reachingDefIn
override def _reachingDefIn = get()._reachingDefIn

Expand Down Expand Up @@ -224,22 +214,16 @@ class AnnotationLiteralDb(ref: NodeRef[NodeDb])
def argumentOut: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](0)
override def _argumentOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0)

def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](1)
override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1)

def astIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](2)
override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2)
def astIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](1)
override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](1)
def _annotationParameterAssignViaAstIn: overflowdb.traversal.Traversal[AnnotationParameterAssign] =
astIn.collectAll[AnnotationParameterAssign]

def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](3)
override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3)

def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](4)
override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4)
def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](2)
override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2)

def reachingDefIn: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](5)
override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5)
def reachingDefIn: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](3)
override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3)

override def label: String = {
AnnotationLiteral.Label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,18 @@ object ArrayInitializer {
List(
io.shiftleft.codepropertygraph.generated.edges.Argument.layoutInformation,
io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation,
io.shiftleft.codepropertygraph.generated.edges.EvalType.layoutInformation,
io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation
io.shiftleft.codepropertygraph.generated.edges.EvalType.layoutInformation
).asJava,
List(
io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation,
io.shiftleft.codepropertygraph.generated.edges.Cfg.layoutInformation,
io.shiftleft.codepropertygraph.generated.edges.PointsTo.layoutInformation,
io.shiftleft.codepropertygraph.generated.edges.ReachingDef.layoutInformation
).asJava
)

object Edges {
val Out: Array[String] = Array("ARGUMENT", "AST", "EVAL_TYPE", "POINTS_TO")
val In: Array[String] = Array("AST", "CFG", "POINTS_TO", "REACHING_DEF")
val Out: Array[String] = Array("ARGUMENT", "AST", "EVAL_TYPE")
val In: Array[String] = Array("AST", "CFG", "REACHING_DEF")
}

val factory = new NodeFactory[ArrayInitializerDb] {
Expand Down Expand Up @@ -116,9 +114,6 @@ class ArrayInitializer(graph_4762: Graph, id_4762: Long /*cf https://github.com/
*/
def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = get()._typeViaEvalTypeOut

def pointsToOut: Iterator[CfgNode] = get().pointsToOut
override def _pointsToOut = get()._pointsToOut

def astIn: Iterator[AstNode] = get().astIn
override def _astIn = get()._astIn

Expand All @@ -130,9 +125,6 @@ class ArrayInitializer(graph_4762: Graph, id_4762: Long /*cf https://github.com/
def cfgIn: Iterator[CfgNode] = get().cfgIn
override def _cfgIn = get()._cfgIn

def pointsToIn: Iterator[CfgNode] = get().pointsToIn
override def _pointsToIn = get()._pointsToIn

def reachingDefIn: Iterator[TemplateDom] = get().reachingDefIn
override def _reachingDefIn = get()._reachingDefIn

Expand Down Expand Up @@ -238,22 +230,16 @@ class ArrayInitializerDb(ref: NodeRef[NodeDb])
override def _evalTypeOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](2)
def _typeViaEvalTypeOut: overflowdb.traversal.Traversal[Type] = evalTypeOut.collectAll[Type]

def pointsToOut: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](3)
override def _pointsToOut = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3)

def astIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](4)
override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4)
def astIn: Iterator[AstNode] = createAdjacentNodeScalaIteratorByOffSet[AstNode](3)
override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](3)
def _annotationParameterAssignViaAstIn: overflowdb.traversal.Traversal[AnnotationParameterAssign] =
astIn.collectAll[AnnotationParameterAssign]

def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](5)
override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5)

def pointsToIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](6)
override def _pointsToIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](6)
def cfgIn: Iterator[CfgNode] = createAdjacentNodeScalaIteratorByOffSet[CfgNode](4)
override def _cfgIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](4)

def reachingDefIn: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](7)
override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](7)
def reachingDefIn: Iterator[TemplateDom] = createAdjacentNodeScalaIteratorByOffSet[TemplateDom](5)
override def _reachingDefIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](5)

override def label: String = {
ArrayInitializer.Label
Expand Down
Loading

0 comments on commit 26e6169

Please sign in to comment.