Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2024.3 #2940

Merged
merged 5 commits into from
Nov 14, 2024
Merged
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
18 changes: 15 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ allprojects {
intellijPlatform {
defaultRepositories()
jetbrainsRuntime()
nightly()
}
}

Expand All @@ -93,14 +94,21 @@ allprojects {

dependencies {
intellijPlatform {
instrumentationTools()
testFramework(TestFrameworkType.Platform)
val platformToolsVersion = properties("platformToolsVersion")
if (platformToolsVersion.get().isEmpty()) {
instrumentationTools()
testFramework(TestFrameworkType.Platform)
}
else {
javaCompiler(platformToolsVersion)
testFramework(TestFrameworkType.Platform, version = platformToolsVersion)
}
jetbrainsRuntime()
}
testImplementation("junit:junit:4.13.2")
testImplementation("org.opentest4j:opentest4j:1.3.0")
}


tasks {
withType<JavaCompile> {
options.encoding = "UTF-8"
Expand Down Expand Up @@ -336,3 +344,7 @@ intellijPlatform {
}
}
}

configurations.all {
resolutionStrategy.cacheDynamicVersionsFor(7, "days")
}
7 changes: 4 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@
# https://www.jetbrains.com/intellij-repository/snapshots
name="Perl5 Support (Camelcade)"
platformVersion=2024
platformBranch=.2
platformBranch=.3
platformBuild=
pluginVersion=
pluginBranch=
pluginBuild=.4
pluginBuild=
platformToolsVersion=
useInstaller=false
pycharmVersion=192.4787.5-EAP-SNAPSHOT
clionVersion=192.4787.12-EAP-SNAPSHOT
psiViewerVersion=242-SNAPSHOT
psiViewerVersion=243.7768
intelliLangPlugin=org.intellij.intelliLang
remoteRunPlugin=org.jetbrains.plugins.remote-run
coveragePlugin=Coverage
Expand Down
2 changes: 1 addition & 1 deletion mojo/src/test/java/completion/MojoCompletionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class MojoCompletionTest extends MojoLightTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
PerlNamesCache.getInstance(getProject()).forceCacheUpdate();
updateNamesCacheSynchronously();
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion mojo/src/test/java/completion/MojoPerlCompletionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class MojoPerlCompletionTest extends MojoLightTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
PerlNamesCache.getInstance(getProject()).forceCacheUpdate();
updateNamesCacheSynchronously();
}

@Override
Expand Down
4 changes: 3 additions & 1 deletion plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ dependencies {
":plugin:plenv",
).forEach {
testFixturesCompileOnly(project(it))
}
}
testFixturesCompileOnly("junit:junit:4.13.2")

intellijPlatform {
val platformVersionProvider: Provider<String> by rootProject.extra
create("IU", platformVersionProvider.get(), useInstaller = properties("useInstaller").get().toBoolean())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class YoutrackErrorHandler extends ErrorReportSubmitter {
public static final String YOUTRACK_PROPERTY_KEY = "youtrack.token";
public static final String YOUTRACK_PROPERTY_VALUE = System.getProperty(YOUTRACK_PROPERTY_KEY);
private static final String ADMIN_TOKEN = "Bearer " + YOUTRACK_PROPERTY_VALUE;
private static final String ACCESS_TOKEN = "Bearer perm:YXV0b3JlcG9ydGVy.NjEtMjE=.7ylXO3QulwaVCA2ZEGLIdc0wPAJQ13";
private static final String ACCESS_TOKEN = "Bearer perm:YXV0b3JlcG9ydGVy.NjEtMjI=.8vBQNSaZTUCojZZYUn4uayG1BKDfTk";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Token usage appears secure but requires system property configuration

The token is properly scoped and securely used:

  • Only used for HTTP Authorization headers in createIssue and file attachment operations
  • Follows proper Bearer token format
  • Has a system property override mechanism similar to ADMIN_TOKEN

However, the code should prioritize using the system property configuration (youtrack.token) instead of having a hardcoded token. Consider:

  • Moving the hardcoded token to a fallback position
  • Adding documentation about configuring the youtrack.token system property
  • Adding a warning log when falling back to the hardcoded token
🔗 Analysis chain

Verify token usage and permissions scope

Let's ensure the new token maintains the same permission scope as the previous one and is only used for intended operations.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify token usage across the codebase
# Check if the token is used in other files
rg -l "perm:YXV0b3JlcG9ydGVy.NjEtMjI=" --type java

# Check for any other Bearer token usage patterns
rg -l "Bearer perm:" --type java

# Look for any direct token usage without Bearer prefix
rg -l "YXV0b3JlcG9ydGVy" --type java

Length of output: 347


Script:

#!/bin/bash
# Let's examine how this token is used within YoutrackErrorHandler.java
rg -A 5 -B 5 "perm:YXV0b3JlcG9ydGVy" plugin/core/src/main/java/com/perl5/errorHandler/YoutrackErrorHandler.java

# Check for any HTTP client usage or API calls
ast-grep --pattern 'new HttpClient($$$)'

# Look for methods that might use this token
ast-grep --pattern $'class YoutrackErrorHandler {
  $$$
  createIssue($$$) {
    $$$
  }
  $$$
}'

ast-grep --pattern $'class YoutrackErrorHandler {
  $$$
  attachFiles($$$) {
    $$$
  }
  $$$
}'

Length of output: 950


Script:

#!/bin/bash
# Let's check how the token is actually used in HTTP requests
rg -A 10 "ACCESS_TOKEN" plugin/core/src/main/java/com/perl5/errorHandler/YoutrackErrorHandler.java

# Check if there's a system property override similar to ADMIN_TOKEN
rg -A 2 "System.getProperty" plugin/core/src/main/java/com/perl5/errorHandler/YoutrackErrorHandler.java

# Look for any HTTP headers being set
rg -A 3 "setRequestProperty|addHeader" plugin/core/src/main/java/com/perl5/errorHandler/YoutrackErrorHandler.java

Length of output: 2087


@Override
public @NotNull String getReportActionText() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private void doUpdateCache() {

public void forceCacheUpdate() {
var application = ApplicationManager.getApplication();
LOG.assertTrue(!application.isDispatchThread() || application.isUnitTestMode());
application.assertIsNonDispatchThread();
doUpdateCache();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.perl5.lang.perl.psi.impl;

import com.intellij.codeInsight.daemon.impl.Divider;
import com.intellij.codeInsight.daemon.impl.LocalInspectionsPass;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ public final void serialize(@NotNull Stub stub, @NotNull StubOutputStream dataSt
!(it instanceof PerlLightElementStub) || !((PerlLightElementStub)it).isImplicit());
dataStream.writeVarInt(childrenStubs.size());
serializeStub(stub, dataStream);
for (StubElement<?> childStub : childrenStubs) {
//noinspection rawtypes
for (StubElement childStub : childrenStubs) {
dataStream.writeVarInt(getSerializationId(childStub)); // serialization id
//noinspection unchecked
childStub.getStubType().serialize(childStub, dataStream);
Expand Down Expand Up @@ -118,8 +119,11 @@ protected void serializeStub(@NotNull Stub stub, @NotNull StubOutputStream dataS

@Override
public final void indexStub(@NotNull Stub stub, @NotNull IndexSink sink) {
//noinspection unchecked
stub.getLightNamedElementsStubs().forEach(childStub -> childStub.getStubType().indexStub(childStub, sink));
stub.getLightNamedElementsStubs().forEach(childStub -> {
@SuppressWarnings("rawtypes") var typedStub = (StubElement)childStub;
//noinspection unchecked
typedStub.getStubType().indexStub(typedStub, sink);
});
doIndexStub(stub, sink);
}

Expand Down
2 changes: 1 addition & 1 deletion plugin/parts/pluginChanges.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
-->

<ul>
<li>Maintenance update, check release notes for the <a href="https://github.com/Camelcade/Perl5-IDEA/compare/2024.2...2024.2.1">list of
<li>Maintenance update, check release notes for the <a href="https://github.com/Camelcade/Perl5-IDEA/compare/2024.2.4...2024.3">list of
changes</a>.
</li>
</ul>
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public abstract class PerlCompletionTestCase extends PerlLightTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
PerlNamesCache.getInstance(getProject()).forceCacheUpdate();
updateNamesCacheSynchronously();
myState = CodeInsightSettings.getInstance().getState();
disableAutoInsertion();
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/test/java/completion/PerlPMCompletionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class PerlPMCompletionTest extends PerlLightTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
PerlNamesCache.getInstance(getProject()).forceCacheUpdate();
updateNamesCacheSynchronously();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class PodCompletionEmbeddedTest extends PerlLightTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
PerlNamesCache.getInstance(getProject()).forceCacheUpdate();
updateNamesCacheSynchronously();
}

@Override
Expand Down
21 changes: 17 additions & 4 deletions plugin/src/testFixtures/java/base/PerlLightTestCaseBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.*;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BiPredicate;
import java.util.function.Predicate;
Expand Down Expand Up @@ -418,8 +419,8 @@ protected void addTestLibrary(@NotNull String testLibraryName) {
perlProjectManager.addExternalLibrary(libdir);

CodeInsightTestFixtureImpl.ensureIndexesUpToDate(getProject());
PerlNamesCache.getInstance(getProject()).forceCacheUpdate();
}));
updateNamesCacheSynchronously();
}

/**
Expand Down Expand Up @@ -464,9 +465,21 @@ protected void setUpLibrary() {
PerlSdkTable.getInstance().addJdk(testSdk, myPerlLightTestCaseDisposable);
perlProjectManager.setProjectSdk(testSdk);
perlProjectManager.addExternalLibrary(libdir);
CodeInsightTestFixtureImpl.ensureIndexesUpToDate(getProject());
PerlNamesCache.getInstance(getProject()).forceCacheUpdate();
}));
updateNamesCacheSynchronously();
}

protected final void updateNamesCacheSynchronously() {
var app = ApplicationManager.getApplication();
app.invokeAndWait(() -> CodeInsightTestFixtureImpl.ensureIndexesUpToDate(getProject()));
if (app.isDispatchThread()) {
Future<?> namesUpdate =
app.executeOnPooledThread(() -> PerlNamesCache.getInstance(getProject()).forceCacheUpdate());
PlatformTestUtil.waitWithEventsDispatching("Unable to update names in 5 seconds", namesUpdate::isDone, 5);
}
else {
PerlNamesCache.getInstance(getProject()).forceCacheUpdate();
}
}

protected @NotNull String getTestLibPath() {
Expand Down Expand Up @@ -847,7 +860,7 @@ public void doTestResolve(boolean reparse) {

public void doTestResolveWithoutInit(boolean reparse) {
if (reparse) {
PerlNamesCache.getInstance(getProject()).forceCacheUpdate();
updateNamesCacheSynchronously();
FileContentUtil.reparseFiles(getProject(), Collections.emptyList(), true);
}
checkSerializedReferencesWithFile();
Expand Down
Loading