Skip to content
This repository was archived by the owner on Nov 13, 2023. It is now read-only.

Commit 14611a1

Browse files
committed
Initial commit
0 parents  commit 14611a1

File tree

10 files changed

+833
-0
lines changed

10 files changed

+833
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Project exclude paths
2+
/target/

.mvn/wrapper/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
maven-wrapper.jar
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import java.io.IOException;
21+
import java.io.InputStream;
22+
import java.net.Authenticator;
23+
import java.net.PasswordAuthentication;
24+
import java.net.URL;
25+
import java.nio.file.Files;
26+
import java.nio.file.Path;
27+
import java.nio.file.Paths;
28+
import java.nio.file.StandardCopyOption;
29+
30+
public final class MavenWrapperDownloader {
31+
private static final String WRAPPER_VERSION = "3.2.0";
32+
33+
private static final boolean VERBOSE = Boolean.parseBoolean(System.getenv("MVNW_VERBOSE"));
34+
35+
public static void main(String[] args) {
36+
log("Apache Maven Wrapper Downloader " + WRAPPER_VERSION);
37+
38+
if (args.length != 2) {
39+
System.err.println(" - ERROR wrapperUrl or wrapperJarPath parameter missing");
40+
System.exit(1);
41+
}
42+
43+
try {
44+
log(" - Downloader started");
45+
final URL wrapperUrl = new URL(args[0]);
46+
final String jarPath = args[1].replace("..", ""); // Sanitize path
47+
final Path wrapperJarPath = Paths.get(jarPath).toAbsolutePath().normalize();
48+
downloadFileFromURL(wrapperUrl, wrapperJarPath);
49+
log("Done");
50+
} catch (IOException e) {
51+
System.err.println("- Error downloading: " + e.getMessage());
52+
if (VERBOSE) {
53+
e.printStackTrace();
54+
}
55+
System.exit(1);
56+
}
57+
}
58+
59+
private static void downloadFileFromURL(URL wrapperUrl, Path wrapperJarPath)
60+
throws IOException {
61+
log(" - Downloading to: " + wrapperJarPath);
62+
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
63+
final String username = System.getenv("MVNW_USERNAME");
64+
final char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
65+
Authenticator.setDefault(new Authenticator() {
66+
@Override
67+
protected PasswordAuthentication getPasswordAuthentication() {
68+
return new PasswordAuthentication(username, password);
69+
}
70+
});
71+
}
72+
try (InputStream inStream = wrapperUrl.openStream()) {
73+
Files.copy(inStream, wrapperJarPath, StandardCopyOption.REPLACE_EXISTING);
74+
}
75+
log(" - Downloader complete");
76+
}
77+
78+
private static void log(String msg) {
79+
if (VERBOSE) {
80+
System.out.println(msg);
81+
}
82+
}
83+
84+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
18+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Quarkiverse Logging JSON: Property pollution reproducer
2+
3+
4+
5+
## To reproduce
6+
7+
```shell script
8+
./mvnw verify
9+
```
10+
11+
Look for the string `Something from resource` in log output.
12+
13+
## Details
14+
The following code
15+
```java
16+
Log.infov("Something from resource",
17+
kv("timestamp", "timestamp from resource"),
18+
kv("sequence", "sequence from resource"),
19+
kv("loggerClassName", "loggerClassName from resource"),
20+
kv("loggerName", "loggerName from resource"),
21+
kv("level", "level from resource"),
22+
kv("message", "message from resource"),
23+
kv("threadName", "threadName from resource"),
24+
kv("threadId", "threadId from resource"),
25+
kv("hostName", "hostName from resource"),
26+
kv("processName", "processName from resource"),
27+
kv("processId", "processId from resource"),
28+
kv("else", "else from resource"));
29+
```
30+
31+
produces the following log output which is illegal JSON due to duplicate property names:
32+
```json
33+
{
34+
"timestamp": "2023-11-13T16:46:28.178Z",
35+
"sequence":45,
36+
"loggerClassName": "org.jboss.logging.Logger",
37+
"loggerName": "com.example.DefaultResource",
38+
"level": "INFO",
39+
"message": "Something from resource",
40+
"threadName": "executor-thread-1",
41+
"threadId":100,
42+
"hostName": "circulationsolo",
43+
"processName": "JUnitStarter",
44+
"processId":10188,
45+
"timestamp": "timestamp from resource",
46+
"sequence": "sequence from resource",
47+
"loggerClassName": "loggerClassName from resource",
48+
"loggerName": "loggerName from resource",
49+
"level": "level from resource",
50+
"message": "message from resource",
51+
"threadName": "threadName from resource",
52+
"threadId": "threadId from resource",
53+
"hostName": "hostName from resource",
54+
"processName": "processName from resource",
55+
"processId": "processId from resource",
56+
"else": "else from resource"
57+
}
58+
```

0 commit comments

Comments
 (0)