From eef3442866d7c944a9710558ad7b82a4cb29a6ad Mon Sep 17 00:00:00 2001 From: csviri Date: Mon, 21 Feb 2022 13:51:59 +0100 Subject: [PATCH 1/3] fix: no sonar fix experiment --- .../javaoperatorsdk/operator/sample/MySQLSchemaReconciler.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/MySQLSchemaReconciler.java b/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/MySQLSchemaReconciler.java index 8965ae2a89..c2e33f5810 100644 --- a/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/MySQLSchemaReconciler.java +++ b/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/MySQLSchemaReconciler.java @@ -43,8 +43,7 @@ public MySQLSchemaReconciler() {} @Override public void initContext(MySQLSchema primary, Context context) { final var name = primary.getMetadata().getName(); - // NOSONAR we don't need cryptographically-strong randomness here - final var password = RandomStringUtils.randomAlphanumeric(16); + final var password = RandomStringUtils.randomAlphanumeric(16); // NOSONAR final var secretName = String.format(SECRET_FORMAT, name); final var userName = String.format(USERNAME_FORMAT, name); From e72e343b283625ac8c57ab46651df1fbf714bc56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Attila=20M=C3=A9sz=C3=A1ros?= Date: Mon, 21 Feb 2022 14:54:13 +0100 Subject: [PATCH 2/3] Update sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/MySQLSchemaReconciler.java Co-authored-by: Chris Laprun --- .../javaoperatorsdk/operator/sample/MySQLSchemaReconciler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/MySQLSchemaReconciler.java b/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/MySQLSchemaReconciler.java index c2e33f5810..62c6b91ba0 100644 --- a/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/MySQLSchemaReconciler.java +++ b/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/MySQLSchemaReconciler.java @@ -43,7 +43,7 @@ public MySQLSchemaReconciler() {} @Override public void initContext(MySQLSchema primary, Context context) { final var name = primary.getMetadata().getName(); - final var password = RandomStringUtils.randomAlphanumeric(16); // NOSONAR + final var password = RandomStringUtils.randomAlphanumeric(16); // NOSONAR: we don't need cryptographically-strong randomness here final var secretName = String.format(SECRET_FORMAT, name); final var userName = String.format(USERNAME_FORMAT, name); From d58f447162b901622bcfe00caa87b5e7d1885660 Mon Sep 17 00:00:00 2001 From: csviri Date: Mon, 21 Feb 2022 15:30:16 +0100 Subject: [PATCH 3/3] fix: format security issue --- .../operator/sample/MySQLSchemaReconciler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/MySQLSchemaReconciler.java b/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/MySQLSchemaReconciler.java index 62c6b91ba0..5952a1508f 100644 --- a/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/MySQLSchemaReconciler.java +++ b/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/MySQLSchemaReconciler.java @@ -43,7 +43,9 @@ public MySQLSchemaReconciler() {} @Override public void initContext(MySQLSchema primary, Context context) { final var name = primary.getMetadata().getName(); - final var password = RandomStringUtils.randomAlphanumeric(16); // NOSONAR: we don't need cryptographically-strong randomness here + final var password = RandomStringUtils + .randomAlphanumeric(16); // NOSONAR: we don't need cryptographically-strong randomness here + final var secretName = String.format(SECRET_FORMAT, name); final var userName = String.format(USERNAME_FORMAT, name);