Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .cirrus/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion analysis-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core-parent</artifactId>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>
</parent>
<artifactId>sonarlint-analysis-engine</artifactId>
<name>SonarLint Core - Analysis Engine</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,8 @@ public WriteCache nextCache() {
throw unsupported();
}

@Override
public void addTelemetryProperty(String property, String value) {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
Expand All @@ -41,6 +43,7 @@
import org.sonarsource.sonarlint.core.analysis.container.analysis.issue.SensorQuickFix;
import org.sonarsource.sonarlint.plugin.api.issue.NewQuickFix;
import org.sonarsource.sonarlint.plugin.api.issue.NewSonarLintIssue;
import org.sonar.api.issue.impact.SoftwareQuality;

import static java.util.Objects.requireNonNull;

Expand Down Expand Up @@ -223,4 +226,16 @@ public boolean isQuickFixAvailable() {
public Optional<String> ruleDescriptionContextKey() {
return ruleDescriptionContextKey;
}


@Override
public NewIssue overrideImpact(SoftwareQuality var1, org.sonar.api.issue.impact.Severity var2) {
return null;
}

@Override
public Map<SoftwareQuality, org.sonar.api.issue.impact.Severity> overridenImpacts() {
return new HashMap<SoftwareQuality, org.sonar.api.issue.impact.Severity>();
}

}
2 changes: 1 addition & 1 deletion client-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core-parent</artifactId>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>
</parent>
<artifactId>sonarlint-client-api</artifactId>
<name>SonarLint Core - Client API</name>
Expand Down
2 changes: 1 addition & 1 deletion commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core-parent</artifactId>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>
</parent>
<artifactId>sonarlint-commons</artifactId>
<name>SonarLint Core - Commons</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
public class HashingPathMapper implements PathMapper<String> {

private static final String HEX_LETTERS = "0123456789abcdef";
private static final String HASHING_ALGORITHM = "SHA1";
private static final String HASHING_ALGORITHM = "SHA-256";
private static final int HASH_LENGTH = 40;

private final Path base;
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core-parent</artifactId>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>
</parent>
<artifactId>sonarlint-core</artifactId>
<name>SonarLint Core - Implementation</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,19 @@ private AnalysisContext loadAnalysisContext() {
var pluginDetails = loadingResult.getPluginCheckResultByKeys().values().stream().map(p -> new PluginDetails(p.getPlugin().getKey(), p.getPlugin().getName(),
Optional.ofNullable(p.getPlugin().getVersion()).map(Version::toString).orElse(null), p.getSkipReason().orElse(null))).collect(Collectors.toList());

loadingResult.getLoadedPlugins().getPluginInstancesByKeys().forEach((k, v) -> {
LOG.debug("Plugin k: {}", k);
});

var allRulesDefinitionsByKey = loadPluginMetadata(loadingResult.getLoadedPlugins(), globalConfig.getEnabledLanguages(), true, globalConfig.isHotspotsEnabled());

LOG.debug("In all rules by key size: {}", allRulesDefinitionsByKey.size());

allRulesDefinitionsByKey.forEach((r, sonarLintRuleDefinition) -> {
if (r.startsWith("sf")) {
LOG.debug("Key: {} Val: {}", r, sonarLintRuleDefinition.getKey());
}
});
var analysisGlobalConfig = AnalysisEngineConfiguration.builder()
.setClientPid(globalConfig.getClientPid())
.setExtraProperties(globalConfig.extraProperties())
Expand All @@ -137,6 +148,11 @@ private PluginsLoadResult loadPlugins() {
pluginsToLoadByKey.putAll(globalConfig.getEmbeddedPluginPathsByKey());
Set<Path> plugins = new HashSet<>(pluginsToLoadByKey.values());

plugins.forEach(f -> {
LOG.debug("LoadPlugins: {}", f.toAbsolutePath());
});

globalConfig.getEnabledLanguages().forEach(f -> LOG.debug("Global Language: {}", f.getLanguageKey()));
var config = new Configuration(plugins, globalConfig.getEnabledLanguages(), Optional.ofNullable(globalConfig.getNodeJsVersion()));
return new PluginsLoader().load(config);
}
Expand Down Expand Up @@ -251,6 +267,7 @@ private ActiveRulesContext buildActiveRulesContext(ConnectedAnalysisConfiguratio
}
} else {
ruleOrTemplateDefinition = analysisContext.get().findRule(activeRuleFromStorage.getRuleKey()).orElse(null);
LOG.debug(" * Rule check: rulekey: {}, obj: {}", activeRuleFromStorage.getRuleKey(), ruleOrTemplateDefinition);
if (ruleOrTemplateDefinition == null) {
LOG.debug("Rule {} is enabled on the server, but not available in CodeScan", activeRuleFromStorage.getRuleKey());
continue;
Expand Down
2 changes: 1 addition & 1 deletion http/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core-parent</artifactId>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>
</parent>
<artifactId>sonarlint-http</artifactId>
<name>SonarLint Core - HTTP</name>
Expand Down
2 changes: 1 addition & 1 deletion issue-tracking/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core-parent</artifactId>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>
</parent>
<artifactId>sonarlint-issue-tracking</artifactId>
<name>SonarLint Issue Tracking</name>
Expand Down
8 changes: 4 additions & 4 deletions its/plugins/custom-sensor-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
<parent>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core-its</artifactId>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<groupId>org.sonarsource.plugins.example</groupId>
<artifactId>custom-sensor-plugin</artifactId>
<packaging>sonar-plugin</packaging>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>

<name>Example Plugin for SonarQube</name>
<description>Example of plugin for SonarQube</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.apiVersion>5.6</sonar.apiVersion>
<jdk.min.version>11</jdk.min.version>
<sonar.apiVersion>9.14.0.375</sonar.apiVersion>
<jdk.min.version>17</jdk.min.version>
</properties>

<dependencies>
Expand Down
6 changes: 3 additions & 3 deletions its/plugins/global-extension-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core-its</artifactId>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand All @@ -18,8 +18,8 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.apiVersion>7.0</sonar.apiVersion>
<jdk.min.version>11</jdk.min.version>
<sonar.apiVersion>9.14.0.375</sonar.apiVersion>
<jdk.min.version>17</jdk.min.version>
</properties>

<dependencies>
Expand Down
8 changes: 4 additions & 4 deletions its/plugins/java-custom-rules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core-its</artifactId>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand All @@ -18,15 +18,15 @@
<description>Java Custom Rules</description>

<properties>
<sonarjava.version>5.13.1.18282</sonarjava.version>
<analyzer.commons.version>1.14.1.690</analyzer.commons.version>
<sonarjava.version>7.16.0.30901</sonarjava.version>
<analyzer.commons.version>2.11.0.2861</analyzer.commons.version>
</properties>

<dependencies>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-plugin-api</artifactId>
<version>7.9</version>
<version>9.14.0.375</version>
<scope>provided</scope>
</dependency>

Expand Down
2 changes: 1 addition & 1 deletion its/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core-parent</artifactId>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>
</parent>
<artifactId>sonarlint-core-its</artifactId>
<name>SonarLint Core - ITs</name>
Expand Down
2 changes: 1 addition & 1 deletion its/tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core-its</artifactId>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>
</parent>
<artifactId>sonarlint-core-its-tests</artifactId>
<name>SonarLint Core - ITs - Tests</name>
Expand Down
2 changes: 1 addition & 1 deletion osgi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core-parent</artifactId>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>
</parent>
<artifactId>sonarlint-core-osgi</artifactId>
<name>SonarLint Core - OSGi bundle</name>
Expand Down
2 changes: 1 addition & 1 deletion plugin-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core-parent</artifactId>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>
</parent>
<artifactId>sonarlint-plugin-api</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion plugin-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core-parent</artifactId>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>
</parent>
<artifactId>sonarlint-plugin-commons</artifactId>
<name>SonarLint Core - Plugin Commons</name>
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</parent>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core-parent</artifactId>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>
<packaging>pom</packaging>
<name>SonarLint Core</name>
<description>Library used by SonarLint flavors (Eclipse, IntelliJ, VSCode...)</description>
Expand Down Expand Up @@ -43,7 +43,7 @@
</modules>

<properties>
<sonar-plugin-api.version>9.15-CODESCAN</sonar-plugin-api.version>
<sonar-plugin-api.version>10.14-CODESCAN</sonar-plugin-api.version>
<sonar-plugin-api-impl.version>9.9.3.79811</sonar-plugin-api-impl.version>
<sonar-ws.version>9.9.1.69595</sonar-ws.version>
<sonar-markdown.version>9.9.0.65466</sonar-markdown.version>
Expand All @@ -57,7 +57,7 @@
<jdk.min.version>11</jdk.min.version>
<gson.version>2.10</gson.version>
<mockito.version>4.9.0</mockito.version>
<kotlin.version>1.6.21</kotlin.version>
<kotlin.version>1.9.25</kotlin.version>
<lsp4j.version>0.19.0</lsp4j.version>

<version.surefire.plugin>3.1.2</version.surefire.plugin>
Expand Down
2 changes: 1 addition & 1 deletion report-aggregate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core-parent</artifactId>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>
</parent>
<artifactId>sonarlint-report-aggregate</artifactId>
<name>SonarLint Coverage Reports Aggregator</name>
Expand Down
2 changes: 1 addition & 1 deletion rule-extractor-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core-parent</artifactId>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>
</parent>
<artifactId>sonarlint-rule-extractor-cli</artifactId>
<name>SonarLint Core - Rule Extractor - CLI</name>
Expand Down
2 changes: 1 addition & 1 deletion rule-extractor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core-parent</artifactId>
<version>9.2.0-CODESCAN</version>
<version>9.2.1-CODESCAN</version>
</parent>
<artifactId>sonarlint-rule-extractor</artifactId>
<name>SonarLint Core - Rule Extractor</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public final class SecurityStandards {

public static final String UNKNOWN_STANDARD = "unknown";
private static final String CWE_PREFIX = "cwe:";
private static final String CVSS_PREFIX = "cvss:";

public enum SLCategory {
BUFFER_OVERFLOW("buffer-overflow", HIGH),
Expand Down Expand Up @@ -111,12 +112,14 @@ public VulnerabilityProbability getVulnerability() {

private final Set<String> standards;
private final Set<String> cwe;
private final Set<String> cvss;
private final SLCategory sLCategory;
private final Set<SLCategory> ignoredSLCategories;

private SecurityStandards(Set<String> standards, Set<String> cwe, SLCategory sLCategory, Set<SLCategory> ignoredSLCategories) {
private SecurityStandards(Set<String> standards, Set<String> cwe, Set<String> cvss, SLCategory sLCategory, Set<SLCategory> ignoredSLCategories) {
this.standards = standards;
this.cwe = cwe;
this.cvss = cvss;
this.sLCategory = sLCategory;
this.ignoredSLCategories = ignoredSLCategories;
}
Expand All @@ -140,16 +143,21 @@ public Set<String> getCwe() {
return cwe;
}

public Set<String> getCvss() {
return cvss;
}

/**
* @throws IllegalStateException if {@code securityStandards} maps to multiple {@link SLCategory SLCategories}
*/
public static SecurityStandards fromSecurityStandards(Set<String> securityStandards) {
Set<String> standards = securityStandards.stream().filter(Objects::nonNull).collect(toSet());
Set<String> cwe = toCwes(standards);
Set<String> cvss = toCvsss(standards);
List<SLCategory> sl = toSLCategories(cwe);
var slCategory = sl.iterator().next();
Set<SLCategory> ignoredSLCategories = sl.stream().skip(1).collect(toSet());
return new SecurityStandards(standards, cwe, slCategory, ignoredSLCategories);
return new SecurityStandards(standards, cwe, cvss, slCategory, ignoredSLCategories);
}

private static Set<String> toCwes(Collection<String> securityStandards) {
Expand All @@ -160,6 +168,14 @@ private static Set<String> toCwes(Collection<String> securityStandards) {
return result.isEmpty() ? singleton(UNKNOWN_STANDARD) : result;
}

private static Set<String> toCvsss(Collection<String> securityStandards) {
Set<String> result = securityStandards.stream()
.filter(s -> s.startsWith(CVSS_PREFIX))
.map(s -> s.substring(CVSS_PREFIX.length()))
.collect(toSet());
return result.isEmpty() ? singleton(UNKNOWN_STANDARD) : result;
}

private static List<SLCategory> toSLCategories(Collection<String> cwe) {
List<SLCategory> result = CWES_BY_SL_CATEGORY
.keySet()
Expand Down
Loading