Skip to content

Commit 56ece06

Browse files
authored
Add EVIDENCE_DESCRIPTION property to FINDING nodes. (#1821)
1 parent 0499cd5 commit 56ece06

File tree

112 files changed

+1548
-1429
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+1548
-1429
lines changed

domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/GraphSchema.scala

Lines changed: 691 additions & 686 deletions
Large diffs are not rendered by default.

domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/Properties.scala

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -99,176 +99,181 @@ object Properties {
9999
val EvaluationStrategy =
100100
flatgraph.SinglePropertyKey[String](kind = 19, name = "EVALUATION_STRATEGY", default = "<empty>")
101101

102+
/** Optional description for nodes in evidence. Used to give a hint about the kind of evidence provided by a node. The
103+
* evidence description and evidence nodes are associated by index.
104+
*/
105+
val EvidenceDescription = flatgraph.MultiPropertyKey[String](kind = 20, name = "EVIDENCE_DESCRIPTION")
106+
102107
/** Specifies whether the IMPORTED_AS property was explicitly present in the code. For languages like Java which do
103108
* not allow a renaming during import this is always false. For e.g. Kotlin it depends on the existence of the "as"
104109
* keyword.
105110
*/
106-
val ExplicitAs = flatgraph.OptionalPropertyKey[Boolean](kind = 20, name = "EXPLICIT_AS")
111+
val ExplicitAs = flatgraph.OptionalPropertyKey[Boolean](kind = 21, name = "EXPLICIT_AS")
107112

108113
/** The path of the source file this node was generated from, relative to the root path in the meta data node. This
109114
* field must be set but may be set to the value `<unknown>` to indicate that no source file can be associated with
110115
* the node, e.g., because the node represents an entity known to exist because it is referenced, but for which the
111116
* file that is is declared in is unknown.
112117
*/
113-
val Filename = flatgraph.SinglePropertyKey[String](kind = 21, name = "FILENAME", default = "<empty>")
118+
val Filename = flatgraph.SinglePropertyKey[String](kind = 22, name = "FILENAME", default = "<empty>")
114119

115120
/** This is the fully-qualified name of an entity, e.g., the fully-qualified name of a method or type. The details of
116121
* what constitutes a fully-qualified name are language specific. This field SHOULD be human readable.
117122
*/
118-
val FullName = flatgraph.SinglePropertyKey[String](kind = 22, name = "FULL_NAME", default = "<empty>")
123+
val FullName = flatgraph.SinglePropertyKey[String](kind = 23, name = "FULL_NAME", default = "<empty>")
119124

120125
/** This field is experimental. It will likely be removed in the future without any notice. It stores type information
121126
* for generic types and methods as well as type information for members and locals where the type either contains a
122127
* type parameter reference or an instantiated type reference.
123128
*/
124-
val GenericSignature = flatgraph.SinglePropertyKey[String](kind = 23, name = "GENERIC_SIGNATURE", default = "<empty>")
129+
val GenericSignature = flatgraph.SinglePropertyKey[String](kind = 24, name = "GENERIC_SIGNATURE", default = "<empty>")
125130

126131
/** This property contains a hash value in the form of a string. Hashes can be used to summarize data, e.g., to
127132
* summarize the contents of source files or sub graphs. Such summaries are useful to determine whether code has
128133
* already been analyzed in incremental analysis pipelines. This property is optional to allow its calculation to be
129134
* deferred or skipped if the hash is not needed.
130135
*/
131-
val Hash = flatgraph.OptionalPropertyKey[String](kind = 24, name = "HASH")
136+
val Hash = flatgraph.OptionalPropertyKey[String](kind = 25, name = "HASH")
132137

133138
/** The identifier under which the import can be accessed in the importing context. For a Java import this is always
134139
* identical to the class name. But e.g. for a Kotlin import like "import java.nio.ByteBuffer as BBuffer" this would
135140
* be "BBuffer". This property is ignored if IS_WILDCARD is true.
136141
*/
137-
val ImportedAs = flatgraph.OptionalPropertyKey[String](kind = 25, name = "IMPORTED_AS")
142+
val ImportedAs = flatgraph.OptionalPropertyKey[String](kind = 26, name = "IMPORTED_AS")
138143

139144
/** The identifying string of the imported entity. For a Java import like "import java.nio.ByteBuffer;" this would be
140145
* "java.nio.ByteBuffer".
141146
*/
142-
val ImportedEntity = flatgraph.OptionalPropertyKey[String](kind = 26, name = "IMPORTED_ENTITY")
147+
val ImportedEntity = flatgraph.OptionalPropertyKey[String](kind = 27, name = "IMPORTED_ENTITY")
143148

144149
/** Specifies an index, e.g., for a parameter or argument. Explicit parameters are numbered from 1 to N, while index 0
145150
* is reserved for implicit self / this parameter.
146151
*/
147-
val Index = flatgraph.SinglePropertyKey[Int](kind = 27, name = "INDEX", default = -1: Int)
152+
val Index = flatgraph.SinglePropertyKey[Int](kind = 28, name = "INDEX", default = -1: Int)
148153

149154
/** The static types a TYPE_DECL inherits from. This property is matched against the FULL_NAME of TYPE nodes and thus
150155
* it is required to have at least one TYPE node for each TYPE_FULL_NAME
151156
*/
152-
val InheritsFromTypeFullName = flatgraph.MultiPropertyKey[String](kind = 28, name = "INHERITS_FROM_TYPE_FULL_NAME")
157+
val InheritsFromTypeFullName = flatgraph.MultiPropertyKey[String](kind = 29, name = "INHERITS_FROM_TYPE_FULL_NAME")
153158

154159
/** Specifies whether this is an explicit import. Most languages have implicit default imports of some standard
155160
* library elements and this flag is used to distinguish those from explicit imports found in the code base.
156161
*/
157-
val IsExplicit = flatgraph.OptionalPropertyKey[Boolean](kind = 29, name = "IS_EXPLICIT")
162+
val IsExplicit = flatgraph.OptionalPropertyKey[Boolean](kind = 30, name = "IS_EXPLICIT")
158163

159164
/** Indicates that the construct (METHOD or TYPE_DECL) is external, that is, it is referenced but not defined in the
160165
* code (applies both to insular parsing and to library functions where we have header files only)
161166
*/
162-
val IsExternal = flatgraph.SinglePropertyKey[Boolean](kind = 30, name = "IS_EXTERNAL", default = false)
167+
val IsExternal = flatgraph.SinglePropertyKey[Boolean](kind = 31, name = "IS_EXTERNAL", default = false)
163168

164169
/** Specifies whether a parameter is the variadic argument handling parameter of a variadic method. Only one parameter
165170
* of a method is allowed to have this property set to true.
166171
*/
167-
val IsVariadic = flatgraph.SinglePropertyKey[Boolean](kind = 31, name = "IS_VARIADIC", default = false)
172+
val IsVariadic = flatgraph.SinglePropertyKey[Boolean](kind = 32, name = "IS_VARIADIC", default = false)
168173

169174
/** Specifies whether this is a wildcard import. For a Java import like "import java.nio.*;" IS_WILDCARD would be
170175
* "true" and IMPORTED_ENTITY would be "java.nio". For wildcard imports the IMPORTED_AS property is ignored.
171176
*/
172-
val IsWildcard = flatgraph.OptionalPropertyKey[Boolean](kind = 32, name = "IS_WILDCARD")
177+
val IsWildcard = flatgraph.OptionalPropertyKey[Boolean](kind = 33, name = "IS_WILDCARD")
173178

174179
/** This property denotes a key of a key-value pair. */
175-
val Key = flatgraph.SinglePropertyKey[String](kind = 33, name = "KEY", default = "<empty>")
180+
val Key = flatgraph.SinglePropertyKey[String](kind = 34, name = "KEY", default = "<empty>")
176181

177182
/** This field indicates which CPG language frontend generated the CPG. Frontend developers may freely choose a value
178183
* that describes their frontend so long as it is not used by an existing frontend. Reserved values are to date: C,
179184
* LLVM, GHIDRA, PHP.
180185
*/
181-
val Language = flatgraph.SinglePropertyKey[String](kind = 34, name = "LANGUAGE", default = "<empty>")
186+
val Language = flatgraph.SinglePropertyKey[String](kind = 35, name = "LANGUAGE", default = "<empty>")
182187

183188
/** This optional field provides the line number of the program construct represented by the node.
184189
*/
185-
val LineNumber = flatgraph.OptionalPropertyKey[Int](kind = 35, name = "LINE_NUMBER")
190+
val LineNumber = flatgraph.OptionalPropertyKey[Int](kind = 36, name = "LINE_NUMBER")
186191

187192
/** This optional fields provides the line number at which the program construct represented by the node ends.
188193
*/
189-
val LineNumberEnd = flatgraph.OptionalPropertyKey[Int](kind = 36, name = "LINE_NUMBER_END")
194+
val LineNumberEnd = flatgraph.OptionalPropertyKey[Int](kind = 37, name = "LINE_NUMBER_END")
190195

191196
/** The FULL_NAME of a method. Used to link CALL and METHOD nodes. It is required to have exactly one METHOD node for
192197
* each METHOD_FULL_NAME
193198
*/
194-
val MethodFullName = flatgraph.SinglePropertyKey[String](kind = 37, name = "METHOD_FULL_NAME", default = "<empty>")
199+
val MethodFullName = flatgraph.SinglePropertyKey[String](kind = 38, name = "METHOD_FULL_NAME", default = "<empty>")
195200

196-
val MethodShortName = flatgraph.SinglePropertyKey[String](kind = 38, name = "METHOD_SHORT_NAME", default = "<empty>")
201+
val MethodShortName = flatgraph.SinglePropertyKey[String](kind = 39, name = "METHOD_SHORT_NAME", default = "<empty>")
197202

198203
/** The modifier type is a free-form string. The following are known modifier types: `STATIC`, `PUBLIC`, `PROTECTED`,
199204
* `PRIVATE`, `ABSTRACT`, `NATIVE`, `CONSTRUCTOR`, `VIRTUAL`.
200205
*/
201-
val ModifierType = flatgraph.SinglePropertyKey[String](kind = 39, name = "MODIFIER_TYPE", default = "<empty>")
206+
val ModifierType = flatgraph.SinglePropertyKey[String](kind = 40, name = "MODIFIER_TYPE", default = "<empty>")
202207

203208
/** Name of represented object, e.g., method name (e.g. "run") */
204-
val Name = flatgraph.SinglePropertyKey[String](kind = 40, name = "NAME", default = "<empty>")
209+
val Name = flatgraph.SinglePropertyKey[String](kind = 41, name = "NAME", default = "<empty>")
205210

206-
val NodeLabel = flatgraph.SinglePropertyKey[String](kind = 41, name = "NODE_LABEL", default = "<empty>")
211+
val NodeLabel = flatgraph.SinglePropertyKey[String](kind = 42, name = "NODE_LABEL", default = "<empty>")
207212

208213
/** Start offset into the CONTENT property of the corresponding FILE node. The offset is such that parts of the
209214
* content can easily be accessed via `content.substring(offset, offsetEnd)`. This means that the offset must be
210215
* measured in utf16 encoding (i.e. neither in characters/codeunits nor in byte-offsets into a utf8 encoding). E.g.
211216
* for METHOD nodes this start offset points to the start of the methods source code in the string holding the source
212217
* code of the entire file.
213218
*/
214-
val Offset = flatgraph.OptionalPropertyKey[Int](kind = 42, name = "OFFSET")
219+
val Offset = flatgraph.OptionalPropertyKey[Int](kind = 43, name = "OFFSET")
215220

216221
/** End offset (exclusive) into the CONTENT property of the corresponding FILE node. See OFFSET documentation for
217222
* finer details. E.g. for METHOD nodes this end offset points to the first code position which is not part of the
218223
* method.
219224
*/
220-
val OffsetEnd = flatgraph.OptionalPropertyKey[Int](kind = 43, name = "OFFSET_END")
225+
val OffsetEnd = flatgraph.OptionalPropertyKey[Int](kind = 44, name = "OFFSET_END")
221226

222227
/** This integer indicates the position of the node among its siblings in the AST. The left-most child has an order of
223228
* 0.
224229
*/
225-
val Order = flatgraph.SinglePropertyKey[Int](kind = 44, name = "ORDER", default = -1: Int)
230+
val Order = flatgraph.SinglePropertyKey[Int](kind = 45, name = "ORDER", default = -1: Int)
226231

227232
/** The field contains the names of the overlays applied to this CPG, in order of their application. Names are
228233
* free-form strings, that is, this specification does not dictate them but rather requires tool producers and
229234
* consumers to communicate them between each other.
230235
*/
231-
val Overlays = flatgraph.MultiPropertyKey[String](kind = 45, name = "OVERLAYS")
236+
val Overlays = flatgraph.MultiPropertyKey[String](kind = 46, name = "OVERLAYS")
232237

233-
val PackageName = flatgraph.SinglePropertyKey[String](kind = 46, name = "PACKAGE_NAME", default = "<empty>")
238+
val PackageName = flatgraph.SinglePropertyKey[String](kind = 47, name = "PACKAGE_NAME", default = "<empty>")
234239

235240
/** AST node type name emitted by parser. */
236-
val ParserTypeName = flatgraph.SinglePropertyKey[String](kind = 47, name = "PARSER_TYPE_NAME", default = "<empty>")
241+
val ParserTypeName = flatgraph.SinglePropertyKey[String](kind = 48, name = "PARSER_TYPE_NAME", default = "<empty>")
237242

238243
/** Similar to `DYNAMIC_TYPE_HINT_FULL_NAME`, but that this makes no guarantee that types within this property are
239244
* correct. This property is used to capture observations between node interactions during a 'may-analysis'.
240245
*/
241-
val PossibleTypes = flatgraph.MultiPropertyKey[String](kind = 48, name = "POSSIBLE_TYPES")
246+
val PossibleTypes = flatgraph.MultiPropertyKey[String](kind = 49, name = "POSSIBLE_TYPES")
242247

243248
/** The path to the root directory of the source/binary this CPG is generated from. */
244-
val Root = flatgraph.SinglePropertyKey[String](kind = 49, name = "ROOT", default = "<empty>")
249+
val Root = flatgraph.SinglePropertyKey[String](kind = 50, name = "ROOT", default = "<empty>")
245250

246251
/** The method signature encodes the types of parameters in a string. The string SHOULD be human readable and suitable
247252
* for differentiating methods with different parameter types sufficiently to allow for resolving of function
248253
* overloading. The present specification does not enforce a strict format for the signature, that is, it can be
249254
* chosen by the frontend implementor to fit the source language.
250255
*/
251-
val Signature = flatgraph.SinglePropertyKey[String](kind = 50, name = "SIGNATURE", default = "")
256+
val Signature = flatgraph.SinglePropertyKey[String](kind = 51, name = "SIGNATURE", default = "")
252257

253-
val Symbol = flatgraph.SinglePropertyKey[String](kind = 51, name = "SYMBOL", default = "<empty>")
258+
val Symbol = flatgraph.SinglePropertyKey[String](kind = 52, name = "SYMBOL", default = "<empty>")
254259

255260
/** The static type decl of a TYPE. This property is matched against the FULL_NAME of TYPE_DECL nodes. It is required
256261
* to have exactly one TYPE_DECL for each different TYPE_DECL_FULL_NAME
257262
*/
258263
val TypeDeclFullName =
259-
flatgraph.SinglePropertyKey[String](kind = 52, name = "TYPE_DECL_FULL_NAME", default = "<empty>")
264+
flatgraph.SinglePropertyKey[String](kind = 53, name = "TYPE_DECL_FULL_NAME", default = "<empty>")
260265

261266
/** This field contains the fully-qualified static type name of the program construct represented by a node. It is the
262267
* name of an instantiated type, e.g., `java.util.List<Integer>`, rather than `java.util.List[T]`. If the type cannot
263268
* be determined, this field should be set to the empty string.
264269
*/
265-
val TypeFullName = flatgraph.SinglePropertyKey[String](kind = 53, name = "TYPE_FULL_NAME", default = "<empty>")
270+
val TypeFullName = flatgraph.SinglePropertyKey[String](kind = 54, name = "TYPE_FULL_NAME", default = "<empty>")
266271

267272
/** This property denotes a string value as used in a key-value pair. */
268-
val Value = flatgraph.SinglePropertyKey[String](kind = 54, name = "VALUE", default = "")
273+
val Value = flatgraph.SinglePropertyKey[String](kind = 55, name = "VALUE", default = "")
269274

270275
/** A version, given as a string. Used, for example, in the META_DATA node to indicate which version of the CPG spec
271276
* this CPG conforms to
272277
*/
273-
val Version = flatgraph.SinglePropertyKey[String](kind = 55, name = "VERSION", default = "<empty>")
278+
val Version = flatgraph.SinglePropertyKey[String](kind = 56, name = "VERSION", default = "<empty>")
274279
}

domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/PropertyNames.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ runtime as it may depend on the type of an object (as is the case for virtual me
9898
that it points to is not made. */
9999
public static final String EVALUATION_STRATEGY = "EVALUATION_STRATEGY";
100100

101+
/** Optional description for nodes in evidence. Used to give a hint about the kind of evidence
102+
provided by a node. The evidence description and evidence nodes are associated by index. */
103+
public static final String EVIDENCE_DESCRIPTION = "EVIDENCE_DESCRIPTION";
104+
101105
/** Specifies whether the IMPORTED_AS property was explicitly present in the code.
102106
For languages like Java which do not allow a renaming during import this is
103107
always false. For e.g. Kotlin it depends on the existence of the "as" keyword. */
@@ -300,6 +304,7 @@ This means that the offset must be measured in utf16 encoding (i.e. neither in
300304
add(DISPATCH_TYPE);
301305
add(DYNAMIC_TYPE_HINT_FULL_NAME);
302306
add(EVALUATION_STRATEGY);
307+
add(EVIDENCE_DESCRIPTION);
303308
add(EXPLICIT_AS);
304309
add(FILENAME);
305310
add(FULL_NAME);

0 commit comments

Comments
 (0)