Skip to content

Java: rename existing getUrl predicate to getRepositoryUrl #8679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion java/ql/lib/semmle/code/xml/MavenPom.qll
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ class DeclaredRepository extends PomElement {
* Gets the url for this repository. If the `url` tag is present, this will
* be the string contents of that tag.
*/
string getUrl() { result = this.getAChild("url").(PomElement).getValue() }
string getRepositoryUrl() { result = this.getAChild("url").(PomElement).getValue() }
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import java
import semmle.code.xml.MavenPom

predicate isBintrayRepositoryUsage(DeclaredRepository repository) {
repository.getUrl().matches("%.bintray.com%")
repository.getRepositoryUrl().matches("%.bintray.com%")
}

from DeclaredRepository repository
where isBintrayRepositoryUsage(repository)
select repository,
"Downloading or uploading artifacts to deprecated repository " + repository.getUrl()
"Downloading or uploading artifacts to deprecated repository " + repository.getRepositoryUrl()
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import java
import semmle.code.xml.MavenPom

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

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