Skip to content

Commit f38d077

Browse files
senivamhrstoyanov
authored andcommitted
security review for archetypes (helidon-io#8445)
Signed-off-by: Maxim Nesen <[email protected]>
1 parent ce7c26e commit f38d077

File tree

8 files changed

+29
-29
lines changed

8 files changed

+29
-29
lines changed

archetypes/archetypes/src/main/archetype/mp/custom/database-outputs.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ docker run --rm --name mysql -p 3306:3306 \
292292
-e MYSQL_ROOT_PASSWORD=root \
293293
-e MYSQL_DATABASE=pokemon \
294294
-e MYSQL_USER=user \
295-
-e MYSQL_PASSWORD=password \
295+
-e MYSQL_PASSWORD=changeit \
296296
mysql:5.7
297297
```
298298
]]></value>
@@ -318,7 +318,7 @@ docker run --rm --name mysql -p 3306:3306 \
318318
<value key="jdbcDataSource">com.mysql.cj.jdbc.MysqlDataSource</value>
319319
<value key="databaseUrl">jdbc:mysql://127.0.0.1:3306/pokemon?useSSL=false</value>
320320
<value key="dbUser">user</value>
321-
<value key="userPassword">password</value>
321+
<value key="userPassword">changeit</value>
322322
</model>
323323
</output>
324324
</method>

archetypes/archetypes/src/main/archetype/mp/custom/files/application.http-signature.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- key-id: "service1-hmac"
66
principal-name: "Service1 - HMAC signature"
77
# See [EncryptionFilter](https://helidon.io/docs/latest/apidocs/io.helidon.config.encryption/io/helidon/config/encryption/EncryptionFilter.html) for details about encrypting passwords in configuration files.
8-
hmac.secret: "somePasswordForHmacShouldBeEncrypted"
8+
hmac.secret: "changeit"
99
- key-id: "service1-rsa"
1010
principal-name: "Service1 - RSA signature"
1111
public-key:
@@ -17,6 +17,6 @@
1717
# defaults to jdk default
1818
# keystore-type: "PKCS12"
1919
# password of the keystore
20-
passphrase: "password"
20+
passphrase: "changeit"
2121
# alias of the certificate to get public key from
2222
cert.alias: "service_cert"

archetypes/archetypes/src/main/archetype/se/custom/database-output.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ For details, see https://www.h2database.com/html/cheatSheet.html
6969
<list key="db-connection">
7070
<value><![CDATA[ url: jdbc:mysql://127.0.0.1:3306/pokemon?useSSL=false
7171
username: user
72-
password: password]]></value>
72+
password: changeit]]></value>
7373
</list>
7474
<value key="start-db" template="mustache"><![CDATA[
7575
MySQL:
@@ -78,7 +78,7 @@ docker run --rm --name mysql -p 3306:3306 \
7878
-e MYSQL_ROOT_PASSWORD=root \
7979
-e MYSQL_DATABASE=pokemon \
8080
-e MYSQL_USER=user \
81-
-e MYSQL_PASSWORD=password \
81+
-e MYSQL_PASSWORD=changeit \
8282
mysql:5.7
8383
```
8484
]]></value>

archetypes/archetypes/src/main/archetype/se/custom/files/src/main/resources/client-service-jwt.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ security:
1010
- http-basic-auth:
1111
users:
1212
- login: "john"
13-
password: "johnnyPassword"
13+
password: "changeit"
1414
roles: ["admin"]
1515
- login: "jack"
16-
password: "password"
16+
password: "changeit"
1717
roles: ["user", "admin"]
1818
- login: "jill"
19-
password: "anotherPassword"
19+
password: "changeit"
2020
roles: ["user"]
2121
- jwt:
2222
allow-impersonation: true

archetypes/archetypes/src/main/archetype/se/custom/files/src/test/java/__pkg__/OutboundOverrideJwtTest.java.mustache

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class OutboundOverrideJwtTest {
4747
try (Http1ClientResponse response = client.get()
4848
.path("/override")
4949
.property(EndpointConfig.PROPERTY_OUTBOUND_ID, "jack")
50-
.property(EndpointConfig.PROPERTY_OUTBOUND_SECRET, "password")
50+
.property(EndpointConfig.PROPERTY_OUTBOUND_SECRET, "changeit")
5151
.request()) {
5252
5353
assertThat(response.status().code(), is(200));
@@ -62,7 +62,7 @@ public class OutboundOverrideJwtTest {
6262
try (Http1ClientResponse response = client.get()
6363
.path("/propagate")
6464
.property(EndpointConfig.PROPERTY_OUTBOUND_ID, "jack")
65-
.property(EndpointConfig.PROPERTY_OUTBOUND_SECRET, "password")
65+
.property(EndpointConfig.PROPERTY_OUTBOUND_SECRET, "changeit")
6666
.request()) {
6767
6868
assertThat(response.status().code(), is(200));

archetypes/archetypes/src/main/archetype/se/custom/files/src/test/java/__pkg__/SignatureMainTest.java.mustache

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public abstract class SignatureMainTest {
5151
private void test(String uri, Set<String> expectedRoles, Set<String> invalidRoles, String service) {
5252
try (Http1ClientResponse response = client.get(uri)
5353
.property(PROPERTY_OUTBOUND_ID, "jack")
54-
.property(PROPERTY_OUTBOUND_SECRET, "password")
54+
.property(PROPERTY_OUTBOUND_SECRET, "changeit")
5555
.request()) {
5656
5757
assertThat(response.status().code(), is(200));

archetypes/archetypes/src/main/archetype/se/custom/security-outputs.xml

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright (c) 2023 Oracle and/or its affiliates.
4+
Copyright (c) 2023, 2024 Oracle and/or its affiliates.
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@
2727
<value><![CDATA[
2828
- oidc:
2929
client-id: "your-client-id"
30-
client-secret: "your-client-secret"
30+
client-secret: "changeit"
3131
identity-uri: "https://your-tenant-id.identity.oracle.com"
3232
# A prefix used for custom scopes
3333
scope-audience: "http://localhost:7987/test-application"
@@ -49,7 +49,7 @@
4949
# IDCS serves both as open ID connect authenticator and
5050
# as a role mapper. Using minimal configuration here
5151
client-id: "your-client-id"
52-
client-secret: "your-client-secret"
52+
client-secret: "changeit"
5353
identity-uri: "https://your-tenant-id.identity.oracle.com"]]></value>
5454
</list>
5555
<list key="paths-config-entries">
@@ -348,10 +348,10 @@ Update the following files with your client id (it should support http://localho
348348
## Try JWT
349349
350350
```bash
351-
curl -u "jack:password" http://localhost:8080/propagate
352-
curl -u "jack:password" http://localhost:8080/override
353-
curl -u "jill:anotherPassword" http://localhost:8080/propagate
354-
curl -u "jill:anotherPassword" http://localhost:8080/override
351+
curl -u "jack:changeit" http://localhost:8080/propagate
352+
curl -u "jack:changeit" http://localhost:8080/override
353+
curl -u "jill:changeit" http://localhost:8080/propagate
354+
curl -u "jill:changeit" http://localhost:8080/override
355355
```
356356
]]></value>
357357
</list>
@@ -411,9 +411,9 @@ curl -u "jill:anotherPassword" http://localhost:8080/override
411411
private static final Map<String, SecureUserStore.User> USERS = new HashMap<>();
412412
413413
static {
414-
addUser("jack", "password", List.of("user", "admin"));
415-
addUser("jill", "password", List.of("user"));
416-
addUser("john", "password", List.of());
414+
addUser("jack", "changeit", List.of("user", "admin"));
415+
addUser("jill", "changeit", List.of("user"));
416+
addUser("john", "changeit", List.of());
417417
}
418418
419419
private static void addUser(String user, String password, List<String> roles) {
@@ -479,15 +479,15 @@ private static void routing2(HttpRouting.Builder routing) {
479479
.addInbound(InboundClientDefinition
480480
.builder("service1-hmac")
481481
.principalName("Service1 - HMAC signature")
482-
.hmacSecret("somePasswordForHmacShouldBeEncrypted")
482+
.hmacSecret("changeit")
483483
.build())
484484
.addInbound(InboundClientDefinition
485485
.builder("service1-rsa")
486486
.principalName("Service1 - RSA signature")
487487
.publicKeyConfig(Keys.builder()
488488
.keystore(k -> k
489489
.keystore(Resource.create("keystore.p12"))
490-
.passphrase("password")
490+
.passphrase("changeit")
491491
.certAlias("service_cert")
492492
.build())
493493
.build())
@@ -529,7 +529,7 @@ private static void routing2(HttpRouting.Builder routing) {
529529
.privateKeyConfig(Keys.builder()
530530
.keystore(k -> k
531531
.keystore(Resource.create("keystore.p12"))
532-
.passphrase("password")
532+
.passphrase("changeit")
533533
.keyAlias("myPrivateKey")
534534
.build())
535535
.build())
@@ -545,7 +545,7 @@ private static void routing2(HttpRouting.Builder routing) {
545545
OutboundTargetDefinition.class,
546546
OutboundTargetDefinition
547547
.builder("service1-hmac")
548-
.hmacSecret("somePasswordForHmacShouldBeEncrypted")
548+
.hmacSecret("changeit")
549549
.build())
550550
.build();
551551
}
@@ -575,9 +575,9 @@ private static void routing2(HttpRouting.Builder routing) {
575575
## Try Signature
576576
577577
```bash
578-
curl -u "jack:password" http://localhost:8080/service1
579-
curl -u "jill:password" http://localhost:8080/service1-rsa
580-
curl -v -u "john:password" http://localhost:8080/service1
578+
curl -u "jack:changeit" http://localhost:8080/service1
579+
curl -u "jill:changeit" http://localhost:8080/service1-rsa
580+
curl -v -u "john:changeit" http://localhost:8080/service1
581581
```
582582
]]></value>
583583
</list>

0 commit comments

Comments
 (0)