File tree Expand file tree Collapse file tree 4 files changed +27
-4
lines changed
test/query-tests/security/CWE-829/semmle/tests Expand file tree Collapse file tree 4 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,7 @@ private class DeclaredRepository extends PomElement {
2525 string getUrl ( ) { result = getAChild ( "url" ) .( PomElement ) .getValue ( ) }
2626
2727 predicate isInsecureRepositoryUsage ( ) {
28- getUrl ( ) .matches ( "http://%" ) or
29- getUrl ( ) .matches ( "ftp://%" )
28+ getUrl ( ) .regexpMatch ( "(?i)^(http|ftp)://(?!localhost[:/]).*" )
3029 }
3130}
3231
Original file line number Diff line number Diff line change 11| insecure-pom.xml:19:9:24:22 | repository | Downloading or uploading artifacts over insecure protocol (eg. http or ftp) to/from repository http://insecure-repository.example |
22| insecure-pom.xml:25:9:30:30 | snapshotRepository | Downloading or uploading artifacts over insecure protocol (eg. http or ftp) to/from repository http://insecure-repository.example |
3- | insecure-pom.xml:33:9:38:22 | repository | Downloading or uploading artifacts over insecure protocol (eg. http or ftp) to/from repository http://insecure-repository.example |
4- | insecure-pom.xml:41:9:46:28 | pluginRepository | Downloading or uploading artifacts over insecure protocol (eg. http or ftp) to/from repository http://insecure-repository.example |
3+ | insecure-pom.xml:31:9:36:30 | snapshotRepository | Downloading or uploading artifacts over insecure protocol (eg. http or ftp) to/from repository http://localhost.example |
4+ | insecure-pom.xml:39:9:44:22 | repository | Downloading or uploading artifacts over insecure protocol (eg. http or ftp) to/from repository http://insecure-repository.example |
5+ | insecure-pom.xml:47:9:52:28 | pluginRepository | Downloading or uploading artifacts over insecure protocol (eg. http or ftp) to/from repository http://insecure-repository.example |
Original file line number Diff line number Diff line change 2828 <!-- BAD! Use HTTPS -->
2929 <url >http://insecure-repository.example</url >
3030 </snapshotRepository >
31+ <snapshotRepository >
32+ <id >insecure-snapshots</id >
33+ <name >Insecure Repository Snapshots</name >
34+ <!-- BAD! Use HTTPS -->
35+ <url >http://localhost.example</url >
36+ </snapshotRepository >
3137 </distributionManagement >
3238 <repositories >
3339 <repository >
Original file line number Diff line number Diff line change 2828 <!-- GOOD! Use HTTPS -->
2929 <url >https://insecure-repository.example</url >
3030 </snapshotRepository >
31+ <snapshotRepository >
32+ <id >insecure-snapshots</id >
33+ <name >Secure Repository Snapshots</name >
34+ <!-- GOOD! Use HTTP, but for localhost -->
35+ <url >http://localhost/snaphots</url >
36+ </snapshotRepository >
37+ <snapshotRepository >
38+ <id >insecure-snapshots</id >
39+ <name >Secure Repository Snapshots</name >
40+ <!-- GOOD! Use HTTP, but for localhost -->
41+ <url >http://localhost:82</url >
42+ </snapshotRepository >
3143 </distributionManagement >
3244 <repositories >
3345 <repository >
3648 <!-- GOOD! Use HTTPS -->
3749 <url >https://insecure-repository.example</url >
3850 </repository >
51+ <repository >
52+ <id >test</id >
53+ <!-- GOOD! Use HTTP, but for localhost -->
54+ <url >http://localhost:${deploy.webserver.port}/repo</url >
55+ </repository >
3956 </repositories >
4057 <pluginRepositories >
4158 <pluginRepository >
You can’t perform that action at this time.
0 commit comments