Skip to content

Commit 7b6f202

Browse files
committed
Java: Renaming.
1 parent 63e2206 commit 7b6f202

File tree

6 files changed

+46
-45
lines changed

6 files changed

+46
-45
lines changed

java/ql/lib/semmle/code/java/dataflow/ExternalFlow.qll

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
/**
22
* INTERNAL use only. This is an experimental API subject to change without notice.
33
*
4-
* Provides classes and predicates for dealing with flow models specified in CSV format.
4+
* Provides classes and predicates for dealing with flow models specified
5+
* in data extensions and CSV format.
56
*
67
* The CSV specification has the following columns:
78
* - Sources:
8-
* `namespace; type; subtypes; name; signature; ext; output; kind; provenance`
9+
* `package; type; subtypes; name; signature; ext; output; kind; provenance`
910
* - Sinks:
10-
* `namespace; type; subtypes; name; signature; ext; input; kind; provenance`
11+
* `package; type; subtypes; name; signature; ext; input; kind; provenance`
1112
* - Summaries:
12-
* `namespace; type; subtypes; name; signature; ext; input; output; kind; provenance`
13+
* `package; type; subtypes; name; signature; ext; input; output; kind; provenance`
1314
* - Negative Summaries:
14-
* `namespace; type; name; signature; provenance`
15+
* `package; type; name; signature; provenance`
1516
* A negative summary is used to indicate that there is no flow via a callable.
1617
*
1718
* The interpretation of a row is similar to API-graphs with a left-to-right
1819
* reading.
19-
* 1. The `namespace` column selects a package.
20+
* 1. The `package` column selects a package.
2021
* 2. The `type` column selects a type within that package.
2122
* 3. The `subtypes` is a boolean that indicates whether to jump to an
2223
* arbitrary subtype of that type.
@@ -433,12 +434,12 @@ predicate negativeSummaryModel(string row) { any(NegativeSummaryModelCsv s).row(
433434

434435
/** Holds if a source model exists for the given parameters. */
435436
predicate sourceModel(
436-
string namespace, string type, boolean subtypes, string name, string signature, string ext,
437+
string package, string type, boolean subtypes, string name, string signature, string ext,
437438
string output, string kind, string provenance
438439
) {
439440
exists(string row |
440441
sourceModel(row) and
441-
row.splitAt(";", 0) = namespace and
442+
row.splitAt(";", 0) = package and
442443
row.splitAt(";", 1) = type and
443444
row.splitAt(";", 2) = subtypes.toString() and
444445
subtypes = [true, false] and
@@ -453,12 +454,12 @@ predicate sourceModel(
453454

454455
/** Holds if a sink model exists for the given parameters. */
455456
predicate sinkModel(
456-
string namespace, string type, boolean subtypes, string name, string signature, string ext,
457+
string package, string type, boolean subtypes, string name, string signature, string ext,
457458
string input, string kind, string provenance
458459
) {
459460
exists(string row |
460461
sinkModel(row) and
461-
row.splitAt(";", 0) = namespace and
462+
row.splitAt(";", 0) = package and
462463
row.splitAt(";", 1) = type and
463464
row.splitAt(";", 2) = subtypes.toString() and
464465
subtypes = [true, false] and
@@ -473,19 +474,19 @@ predicate sinkModel(
473474

474475
/** Holds if a summary model exists for the given parameters. */
475476
predicate summaryModel(
476-
string namespace, string type, boolean subtypes, string name, string signature, string ext,
477+
string package, string type, boolean subtypes, string name, string signature, string ext,
477478
string input, string output, string kind, string provenance
478479
) {
479-
summaryModel(namespace, type, subtypes, name, signature, ext, input, output, kind, provenance, _)
480+
summaryModel(package, type, subtypes, name, signature, ext, input, output, kind, provenance, _)
480481
}
481482

482483
/** Holds if a summary model `row` exists for the given parameters. */
483484
predicate summaryModel(
484-
string namespace, string type, boolean subtypes, string name, string signature, string ext,
485+
string package, string type, boolean subtypes, string name, string signature, string ext,
485486
string input, string output, string kind, string provenance, string row
486487
) {
487488
summaryModel(row) and
488-
row.splitAt(";", 0) = namespace and
489+
row.splitAt(";", 0) = package and
489490
row.splitAt(";", 1) = type and
490491
row.splitAt(";", 2) = subtypes.toString() and
491492
subtypes = [true, false] and
@@ -500,11 +501,11 @@ predicate summaryModel(
500501

501502
/** Holds if a summary model exists indicating there is no flow for the given parameters. */
502503
predicate negativeSummaryModel(
503-
string namespace, string type, string name, string signature, string provenance
504+
string package, string type, string name, string signature, string provenance
504505
) {
505506
exists(string row |
506507
negativeSummaryModel(row) and
507-
row.splitAt(";", 0) = namespace and
508+
row.splitAt(";", 0) = package and
508509
row.splitAt(";", 1) = type and
509510
row.splitAt(";", 2) = name and
510511
row.splitAt(";", 3) = signature and
@@ -534,7 +535,7 @@ private predicate canonicalPkgLink(string package, string subpkg) {
534535
}
535536

536537
/**
537-
* Holds if CSV framework coverage of `package` is `n` api endpoints of the
538+
* Holds if MaD framework coverage of `package` is `n` api endpoints of the
538539
* kind `(kind, part)`.
539540
*/
540541
predicate modelCoverage(string package, int pkgs, string kind, string part, int n) {
@@ -566,8 +567,8 @@ predicate modelCoverage(string package, int pkgs, string kind, string part, int
566567
)
567568
}
568569

569-
/** Provides a query predicate to check the CSV data for validation errors. */
570-
module CsvValidation {
570+
/** Provides a query predicate to check the MaD models for validation errors. */
571+
module ModelValidation {
571572
private string getInvalidModelInput() {
572573
exists(string pred, string input, string part |
573574
sinkModel(_, _, _, _, _, _, input, _, _) and pred = "sink"
@@ -668,22 +669,22 @@ module CsvValidation {
668669

669670
private string getInvalidModelSignature() {
670671
exists(
671-
string pred, string namespace, string type, string name, string signature, string ext,
672+
string pred, string package, string type, string name, string signature, string ext,
672673
string provenance
673674
|
674-
sourceModel(namespace, type, _, name, signature, ext, _, _, provenance) and pred = "source"
675+
sourceModel(package, type, _, name, signature, ext, _, _, provenance) and pred = "source"
675676
or
676-
sinkModel(namespace, type, _, name, signature, ext, _, _, provenance) and pred = "sink"
677+
sinkModel(package, type, _, name, signature, ext, _, _, provenance) and pred = "sink"
677678
or
678-
summaryModel(namespace, type, _, name, signature, ext, _, _, _, provenance) and
679+
summaryModel(package, type, _, name, signature, ext, _, _, _, provenance) and
679680
pred = "summary"
680681
or
681-
negativeSummaryModel(namespace, type, name, signature, provenance) and
682+
negativeSummaryModel(package, type, name, signature, provenance) and
682683
ext = "" and
683684
pred = "negative summary"
684685
|
685-
not namespace.regexpMatch("[a-zA-Z0-9_\\.]+") and
686-
result = "Dubious namespace \"" + namespace + "\" in " + pred + " model."
686+
not package.regexpMatch("[a-zA-Z0-9_\\.]+") and
687+
result = "Dubious package \"" + package + "\" in " + pred + " model."
687688
or
688689
not type.regexpMatch("[a-zA-Z0-9_\\$<>]+") and
689690
result = "Dubious type \"" + type + "\" in " + pred + " model."
@@ -702,7 +703,7 @@ module CsvValidation {
702703
)
703704
}
704705

705-
/** Holds if some row in a CSV-based flow model appears to contain typos. */
706+
/** Holds if some row in a MaD flow model appears to contain typos. */
706707
query predicate invalidModelRow(string msg) {
707708
msg =
708709
[
@@ -714,15 +715,15 @@ module CsvValidation {
714715

715716
pragma[nomagic]
716717
private predicate elementSpec(
717-
string namespace, string type, boolean subtypes, string name, string signature, string ext
718+
string package, string type, boolean subtypes, string name, string signature, string ext
718719
) {
719-
sourceModel(namespace, type, subtypes, name, signature, ext, _, _, _)
720+
sourceModel(package, type, subtypes, name, signature, ext, _, _, _)
720721
or
721-
sinkModel(namespace, type, subtypes, name, signature, ext, _, _, _)
722+
sinkModel(package, type, subtypes, name, signature, ext, _, _, _)
722723
or
723-
summaryModel(namespace, type, subtypes, name, signature, ext, _, _, _, _)
724+
summaryModel(package, type, subtypes, name, signature, ext, _, _, _, _)
724725
or
725-
negativeSummaryModel(namespace, type, name, signature, _) and ext = "" and subtypes = false
726+
negativeSummaryModel(package, type, name, signature, _) and ext = "" and subtypes = false
726727
}
727728

728729
private string paramsStringPart(Callable c, int i) {
@@ -747,10 +748,10 @@ cached
747748
string paramsString(Callable c) { result = concat(int i | | paramsStringPart(c, i) order by i) }
748749

749750
private Element interpretElement0(
750-
string namespace, string type, boolean subtypes, string name, string signature
751+
string package, string type, boolean subtypes, string name, string signature
751752
) {
752-
elementSpec(namespace, type, subtypes, name, signature, _) and
753-
exists(RefType t | t.hasQualifiedName(namespace, type) |
753+
elementSpec(package, type, subtypes, name, signature, _) and
754+
exists(RefType t | t.hasQualifiedName(package, type) |
754755
exists(Member m |
755756
(
756757
result = m
@@ -773,10 +774,10 @@ private Element interpretElement0(
773774

774775
/** Gets the source/sink/summary/negativesummary element corresponding to the supplied parameters. */
775776
Element interpretElement(
776-
string namespace, string type, boolean subtypes, string name, string signature, string ext
777+
string package, string type, boolean subtypes, string name, string signature, string ext
777778
) {
778-
elementSpec(namespace, type, subtypes, name, signature, ext) and
779-
exists(Element e | e = interpretElement0(namespace, type, subtypes, name, signature) |
779+
elementSpec(package, type, subtypes, name, signature, ext) and
780+
exists(Element e | e = interpretElement0(package, type, subtypes, name, signature) |
780781
ext = "" and result = e
781782
or
782783
ext = "Annotated" and result.(Annotatable).getAnAnnotation().getType() = e
@@ -831,7 +832,7 @@ predicate parseContent(AccessPathToken component, Content content) {
831832
cached
832833
private module Cached {
833834
/**
834-
* Holds if `node` is specified as a source with the given kind in a CSV flow
835+
* Holds if `node` is specified as a source with the given kind in a MaD flow
835836
* model.
836837
*/
837838
cached
@@ -840,7 +841,7 @@ private module Cached {
840841
}
841842

842843
/**
843-
* Holds if `node` is specified as a sink with the given kind in a CSV flow
844+
* Holds if `node` is specified as a sink with the given kind in a MaD flow
844845
* model.
845846
*/
846847
cached

java/ql/test/library-tests/dataflow/external-models/negativesummaries.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
import java
66
import semmle.code.java.dataflow.ExternalFlow
7-
import CsvValidation
7+
import ModelValidation
88
import semmle.code.java.dataflow.internal.NegativeSummary

java/ql/test/library-tests/dataflow/external-models/sinks.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import java
22
import semmle.code.java.dataflow.DataFlow
33
import semmle.code.java.dataflow.ExternalFlow
4-
import CsvValidation
4+
import ModelValidation
55

66
class SinkModelTest extends SinkModelCsv {
77
override predicate row(string row) {

java/ql/test/library-tests/dataflow/external-models/srcs.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import java
22
import semmle.code.java.dataflow.DataFlow
33
import semmle.code.java.dataflow.ExternalFlow
4-
import CsvValidation
4+
import ModelValidation
55

66
class SourceModelTest extends SourceModelCsv {
77
override predicate row(string row) {

java/ql/test/library-tests/dataflow/external-models/steps.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import java
22
import semmle.code.java.dataflow.DataFlow
33
import semmle.code.java.dataflow.ExternalFlow
4-
import CsvValidation
4+
import ModelValidation
55
import semmle.code.java.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
66

77
class SummaryModelTest extends SummaryModelCsv {

java/ql/test/library-tests/dataflow/synth-global/test.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import java
22
import TestUtilities.InlineFlowTest
3-
import CsvValidation
3+
import ModelValidation
44

55
class SummaryModelTest extends SummaryModelCsv {
66
override predicate row(string row) {

0 commit comments

Comments
 (0)