File tree Expand file tree Collapse file tree 3 files changed +18
-28
lines changed Expand file tree Collapse file tree 3 files changed +18
-28
lines changed Original file line number Diff line number Diff line change 12
12
import java
13
13
import semmle.code.xml.MavenPom
14
14
15
- private class DeclaredRepository extends PomElement {
16
- DeclaredRepository ( ) {
17
- this .getName ( ) = "repository" or
18
- this .getName ( ) = "snapshotRepository" or
19
- this .getName ( ) = "pluginRepository"
20
- }
21
-
22
- string getUrl ( ) { result = getAChild ( "url" ) .( PomElement ) .getValue ( ) }
23
-
24
- predicate isBintrayRepositoryUsage ( ) {
25
- getUrl ( ) .matches ( "%.bintray.com%" )
26
- }
15
+ predicate isBintrayRepositoryUsage ( DeclaredRepository repository ) {
16
+ repository .getUrl ( ) .matches ( "%.bintray.com%" )
27
17
}
28
18
29
19
from DeclaredRepository repository
30
- where repository . isBintrayRepositoryUsage ( )
20
+ where isBintrayRepositoryUsage ( repository )
31
21
select repository ,
32
- "Downloading or uploading artifacts to deprecated repository " +
33
- repository .getUrl ( )
22
+ "Downloading or uploading artifacts to deprecated repository " + repository .getUrl ( )
Original file line number Diff line number Diff line change 15
15
import java
16
16
import semmle.code.xml.MavenPom
17
17
18
- private class DeclaredRepository extends PomElement {
19
- DeclaredRepository ( ) {
20
- this .getName ( ) = "repository" or
21
- this .getName ( ) = "snapshotRepository" or
22
- this .getName ( ) = "pluginRepository"
23
- }
24
-
25
- string getUrl ( ) { result = getAChild ( "url" ) .( PomElement ) .getValue ( ) }
26
-
27
- predicate isInsecureRepositoryUsage ( ) {
28
- getUrl ( ) .regexpMatch ( "(?i)^(http|ftp)://(?!localhost[:/]).*" )
29
- }
18
+ predicate isInsecureRepositoryUsage ( DeclaredRepository repository ) {
19
+ repository .getUrl ( ) .regexpMatch ( "(?i)^(http|ftp)://(?!localhost[:/]).*" )
30
20
}
31
21
32
22
from DeclaredRepository repository
33
- where repository . isInsecureRepositoryUsage ( )
23
+ where isInsecureRepositoryUsage ( repository )
34
24
select repository ,
35
25
"Downloading or uploading artifacts over insecure protocol (eg. http or ftp) to/from repository " +
36
26
repository .getUrl ( )
Original file line number Diff line number Diff line change @@ -365,6 +365,17 @@ class PomProperty extends PomElement {
365
365
PomProperty ( ) { getParent ( ) instanceof PomProperties }
366
366
}
367
367
368
+ /**
369
+ * A repository block inside of a maven pom.
370
+ */
371
+ class DeclaredRepository extends PomElement {
372
+ DeclaredRepository ( ) {
373
+ this .getName ( ) = [ "repository" , "snapshotRepository" , "pluginRepository" ]
374
+ }
375
+
376
+ string getUrl ( ) { result = getAChild ( "url" ) .( PomElement ) .getValue ( ) }
377
+ }
378
+
368
379
/**
369
380
* A folder that represents a maven local repository using the standard layout. Any folder called
370
381
* "repository" with a parent name ".m2" is considered to be a maven repository.
You can’t perform that action at this time.
0 commit comments