From 810e5b045586a6e4584aa219cc7f03a80497e562 Mon Sep 17 00:00:00 2001 From: Jacek Date: Wed, 24 Nov 2021 16:49:01 +0100 Subject: SONAR-15690 Add check for default configuration in sonar.properties file --- sonar-application/build.gradle | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sonar-application/build.gradle b/sonar-application/build.gradle index 2a70c75b0a4..9cbb3c7f3fa 100644 --- a/sonar-application/build.gradle +++ b/sonar-application/build.gradle @@ -74,6 +74,19 @@ dependencies { // declare dependencies in configuration bundledPlugin to be packaged in lib/extensions apply from: 'bundled_plugins.gradle' +//verify if sonar.properties files does not have any external input +task verifySonarProperties(type: Verify) { + def propertiesFile = file('src/main/assembly/conf/sonar.properties') + propertiesFile.withReader { reader -> + def line + while ((line = reader.readLine()) != null) { + if (!line.startsWith('#') && !line.isEmpty()) { + throw new GradleException('sonar.properties file by default must not provide any user configuration.') + } + } + } +} + task verifyElasticSearchDownload(type: Verify) { src new File(buildDir, "$elasticsearchDownloadUrlFile") algorithm 'SHA-512' -- cgit v1.2.3