From 665ac90d892345223a086a5a2993e42116d93137 Mon Sep 17 00:00:00 2001 From: Quentin Date: Fri, 1 Nov 2024 22:18:12 +0100 Subject: [PATCH] Sonar: Reactivate rule - Run container as default user --- .../server/sonar/sonar-project.properties.mustache | 6 +----- .../cassandra/Cassandra-Migration.Dockerfile.mustache | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/resources/generator/server/sonar/sonar-project.properties.mustache b/src/main/resources/generator/server/sonar/sonar-project.properties.mustache index 9d0492d0270..8ac1547b545 100644 --- a/src/main/resources/generator/server/sonar/sonar-project.properties.mustache +++ b/src/main/resources/generator/server/sonar/sonar-project.properties.mustache @@ -21,7 +21,7 @@ sonar.exclusions=\ src/main/webapp/app/index.tsx,\ src/main/webapp/main.ts -sonar.issue.ignore.multicriteria=S117,S119,S125_1,S125_2,S3437,S4502,S4684,S4032,S5778,S6206,S6548,S6437,S6471,UndocumentedApi,S2301,S7027 +sonar.issue.ignore.multicriteria=S117,S119,S125_1,S125_2,S3437,S4502,S4684,S4032,S5778,S6206,S6548,S6437,UndocumentedApi,S2301,S7027 # Rule: Local variable and method parameter names should comply with a naming convention # Handled with checkstyle. Should be revisited with java 25 once Unnamed Patterns and Variables are available (JEP 443) @@ -74,10 +74,6 @@ sonar.issue.ignore.multicriteria.S6548.ruleKey=java:S6548 sonar.issue.ignore.multicriteria.S6437.resourceKey=src/main/resources/config/application.yml sonar.issue.ignore.multicriteria.S6437.ruleKey=java:S6437 -# Rule: Run container as default user -sonar.issue.ignore.multicriteria.S6471.resourceKey=src/main/docker/cassandra/**/* -sonar.issue.ignore.multicriteria.S6471.ruleKey=docker:S6471 - # Rule: Methods should not contain selector parameters sonar.issue.ignore.multicriteria.S2301.resourceKey=src/main/webapp/app/auth/oauth2-auth.service.ts sonar.issue.ignore.multicriteria.S2301.ruleKey=typescript:S2301 diff --git a/src/main/resources/generator/server/springboot/dbmigration/cassandra/Cassandra-Migration.Dockerfile.mustache b/src/main/resources/generator/server/springboot/dbmigration/cassandra/Cassandra-Migration.Dockerfile.mustache index e4b74a94b81..ebbc4b338dd 100644 --- a/src/main/resources/generator/server/springboot/dbmigration/cassandra/Cassandra-Migration.Dockerfile.mustache +++ b/src/main/resources/generator/server/springboot/dbmigration/cassandra/Cassandra-Migration.Dockerfile.mustache @@ -1,5 +1,7 @@ FROM {{ cassandraDockerImage }} +RUN useradd -m cassandra_user + # script to orchestrate the automatic keyspace creation and apply all migration scripts COPY cassandra/scripts/autoMigrate.sh /usr/local/bin/autoMigrate RUN chmod 755 /usr/local/bin/autoMigrate @@ -8,4 +10,6 @@ RUN chmod 755 /usr/local/bin/autoMigrate COPY cassandra/scripts/execute-cql.sh /usr/local/bin/execute-cql RUN chmod 755 /usr/local/bin/execute-cql +USER cassandra_user + ENTRYPOINT ["autoMigrate"]