Skip to content

Commit ef9b6a1

Browse files
authored
Merge pull request #8679 from erik-krogh/getUrl
Java: rename existing getUrl predicate to getRepositoryUrl
2 parents 72d4c97 + 489d4cb commit ef9b6a1

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: breaking
3+
---
4+
* The `getUrl` predicate of `DeclaredRepository` in `MavenPom.qll` has been renamed to `getRepositoryUrl`.

java/ql/lib/semmle/code/xml/MavenPom.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ class DeclaredRepository extends PomElement {
380380
* Gets the url for this repository. If the `url` tag is present, this will
381381
* be the string contents of that tag.
382382
*/
383-
string getUrl() { result = this.getAChild("url").(PomElement).getValue() }
383+
string getRepositoryUrl() { result = this.getAChild("url").(PomElement).getValue() }
384384
}
385385

386386
/**

java/ql/src/Security/CWE/CWE-1104/MavenPomDependsOnBintray.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import java
1414
import semmle.code.xml.MavenPom
1515

1616
predicate isBintrayRepositoryUsage(DeclaredRepository repository) {
17-
repository.getUrl().matches("%.bintray.com%")
17+
repository.getRepositoryUrl().matches("%.bintray.com%")
1818
}
1919

2020
from DeclaredRepository repository
2121
where isBintrayRepositoryUsage(repository)
2222
select repository,
23-
"Downloading or uploading artifacts to deprecated repository " + repository.getUrl()
23+
"Downloading or uploading artifacts to deprecated repository " + repository.getRepositoryUrl()

java/ql/src/Security/CWE/CWE-829/InsecureDependencyResolution.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ import java
1717
import semmle.code.xml.MavenPom
1818

1919
predicate isInsecureRepositoryUsage(DeclaredRepository repository) {
20-
repository.getUrl().regexpMatch("(?i)^(http|ftp)://(?!localhost[:/]).*")
20+
repository.getRepositoryUrl().regexpMatch("(?i)^(http|ftp)://(?!localhost[:/]).*")
2121
}
2222

2323
from DeclaredRepository repository
2424
where isInsecureRepositoryUsage(repository)
2525
select repository,
2626
"Downloading or uploading artifacts over insecure protocol (eg. http or ftp) to/from repository " +
27-
repository.getUrl()
27+
repository.getRepositoryUrl()

0 commit comments

Comments
 (0)