Skip to content

Bump CLI version to 2.1.9 (AST-000) #309

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions .github/scripts/extract_cli_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ fi
echo "CLI version being packed is $CLI_VERSION"

# Export CLI version as an environment variable
echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV

`echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV
`
echo "CLI version extraction for $BINARY_NAME completed successfully."
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ dependencies {
implementation 'com.miglayout:miglayout-swing:11.3'

if (javaWrapperVersion == "" || javaWrapperVersion == null) {
implementation('com.checkmarx.ast:ast-cli-java-wrapper:2.1.8'){
implementation('com.checkmarx.ast:ast-cli-java-wrapper:2.1.9'){
exclude group: 'junit', module: 'junit'
}
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/checkmarx/intellij/ASCA/AscaService.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.checkmarx.ast.asca.ScanResult;
import com.checkmarx.ast.wrapper.CxConfig;
import com.checkmarx.ast.wrapper.CxException;
import com.checkmarx.intellij.Exceptions.InvalidCLIConfigException;
import com.checkmarx.intellij.Utils;
import com.checkmarx.intellij.commands.ASCA;
import com.intellij.openapi.application.ApplicationManager;
Expand Down Expand Up @@ -56,7 +57,6 @@ public ScanResult runAscaScan(PsiFile file, Project project, boolean ascLatestVe
if (file == null) {
return null;
}

VirtualFile virtualFile = file.getVirtualFile();

if (ignoreFiles(virtualFile)) {
Expand Down Expand Up @@ -198,12 +198,12 @@ private boolean ignoreFiles(VirtualFile file) {
*
* @return a message indicating the result of the installation
* @throws CxException if an error occurs during installation
* @throws CxConfig.InvalidCLIConfigException if the CLI configuration is invalid
* @throws InvalidCLIConfigException if the CLI configuration is invalid
* @throws IOException if an I/O error occurs
* @throws URISyntaxException if a URI syntax error occurs
* @throws InterruptedException if the installation is interrupted
*/
public boolean installAsca() throws CxException, CxConfig.InvalidCLIConfigException, IOException, URISyntaxException, InterruptedException {
public boolean installAsca() throws CxException, InvalidCLIConfigException, IOException, URISyntaxException, InterruptedException {
ScanResult res = ASCA.installAsca();
if (res.getError() != null) {
LOGGER.warn(Strings.join("ASCA installation error: ", res.getError().getDescription()));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.checkmarx.intellij.Exceptions;

public final class InvalidCLIConfigException extends Exception {
public InvalidCLIConfigException(String message) {
super(message);
}
}
5 changes: 3 additions & 2 deletions src/main/java/com/checkmarx/intellij/commands/ASCA.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.checkmarx.ast.wrapper.CxConfig;
import com.checkmarx.ast.wrapper.CxException;
import com.checkmarx.intellij.Constants;
import com.checkmarx.intellij.Exceptions.InvalidCLIConfigException;
import com.checkmarx.intellij.settings.global.CxWrapperFactory;

import java.io.IOException;
Expand All @@ -12,7 +13,7 @@
public class ASCA {
public static ScanResult scanAsca(String path, boolean ascaLatestVersion, String agent)
throws
CxConfig.InvalidCLIConfigException,
InvalidCLIConfigException,
IOException,
URISyntaxException,
CxException,
Expand All @@ -21,7 +22,7 @@ public static ScanResult scanAsca(String path, boolean ascaLatestVersion, String
}

public static ScanResult installAsca()
throws CxConfig.InvalidCLIConfigException,
throws InvalidCLIConfigException,
IOException,
URISyntaxException,
CxException,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.checkmarx.ast.wrapper.CxConfig;
import com.checkmarx.ast.wrapper.CxException;
import com.checkmarx.intellij.Exceptions.InvalidCLIConfigException;
import com.checkmarx.intellij.settings.global.CxWrapperFactory;
import com.checkmarx.intellij.settings.global.GlobalSettingsSensitiveState;
import com.checkmarx.intellij.settings.global.GlobalSettingsState;
Expand Down Expand Up @@ -30,7 +31,7 @@ public static String validateConnection(GlobalSettingsState state,
IOException,
URISyntaxException,
InterruptedException,
CxConfig.InvalidCLIConfigException,
InvalidCLIConfigException,
CxException {

return CxWrapperFactory.build(state, sensitiveState).authValidate();
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/checkmarx/intellij/commands/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.checkmarx.ast.wrapper.CxConfig;
import com.checkmarx.ast.wrapper.CxException;
import com.checkmarx.intellij.Constants;
import com.checkmarx.intellij.Exceptions.InvalidCLIConfigException;
import com.checkmarx.intellij.Utils;
import com.checkmarx.intellij.settings.global.CxWrapperFactory;
import lombok.NonNull;
Expand All @@ -22,7 +23,7 @@ public static List<com.checkmarx.ast.project.Project> getList()
IOException,
URISyntaxException,
InterruptedException,
CxConfig.InvalidCLIConfigException,
InvalidCLIConfigException,
CxException {

return CxWrapperFactory.build().projectList("limit=10000");
Expand All @@ -33,7 +34,7 @@ public static List<String> getBranches(@NonNull UUID projectId, boolean isSCMPro
IOException,
URISyntaxException,
InterruptedException,
CxConfig.InvalidCLIConfigException,
InvalidCLIConfigException,
CxException {

List<String> branches = CxWrapperFactory.build().projectBranches(projectId, "");
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/com/checkmarx/intellij/commands/Scan.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.checkmarx.ast.wrapper.CxConfig;
import com.checkmarx.ast.wrapper.CxException;
import com.checkmarx.intellij.Constants;
import com.checkmarx.intellij.Exceptions.InvalidCLIConfigException;
import com.checkmarx.intellij.settings.global.CxWrapperFactory;
import org.jetbrains.annotations.NotNull;

Expand All @@ -25,7 +26,7 @@ public class Scan {
*/
@NotNull
public static String getLatestScanId() throws
CxConfig.InvalidCLIConfigException,
InvalidCLIConfigException,
IOException,
URISyntaxException,
CxException,
Expand All @@ -46,7 +47,7 @@ public static List<com.checkmarx.ast.scan.Scan> getList(String projectId, String
IOException,
URISyntaxException,
InterruptedException,
CxConfig.InvalidCLIConfigException,
InvalidCLIConfigException,
CxException {

return CxWrapperFactory.build()
Expand All @@ -66,14 +67,14 @@ public static com.checkmarx.ast.scan.Scan scanShow(String scanId)
IOException,
URISyntaxException,
InterruptedException,
CxConfig.InvalidCLIConfigException,
InvalidCLIConfigException,
CxException {
return CxWrapperFactory.build().scanShow(UUID.fromString(scanId));
}

@NotNull
public static com.checkmarx.ast.scan.Scan scanCreate(String sourcePath, String projectName, String branchName) throws
CxConfig.InvalidCLIConfigException,
InvalidCLIConfigException,
IOException,
URISyntaxException,
CxException,
Expand All @@ -91,7 +92,7 @@ public static com.checkmarx.ast.scan.Scan scanCreate(String sourcePath, String p
}

public static void scanCancel(String scanId) throws
CxConfig.InvalidCLIConfigException,
InvalidCLIConfigException,
IOException,
URISyntaxException,
CxException,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.checkmarx.ast.wrapper.CxConfig;
import com.checkmarx.ast.wrapper.CxException;
import com.checkmarx.intellij.Exceptions.InvalidCLIConfigException;
import com.checkmarx.intellij.settings.global.CxWrapperFactory;
import org.jetbrains.annotations.NotNull;

Expand All @@ -20,7 +21,7 @@ public class TenantSetting {
*/
@NotNull
public static boolean isScanAllowed() throws
CxConfig.InvalidCLIConfigException,
InvalidCLIConfigException,
IOException,
URISyntaxException,
CxException,
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/checkmarx/intellij/commands/Triage.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.checkmarx.ast.wrapper.CxConfig;
import com.checkmarx.ast.wrapper.CxException;
import com.checkmarx.intellij.Exceptions.InvalidCLIConfigException;
import com.checkmarx.intellij.settings.global.CxWrapperFactory;
import lombok.NonNull;

Expand All @@ -20,7 +21,7 @@ public static List<com.checkmarx.ast.predicate.Predicate> triageShow(@NonNull UU
IOException,
URISyntaxException,
InterruptedException,
CxConfig.InvalidCLIConfigException,
InvalidCLIConfigException,
CxException {

return CxWrapperFactory.build().triageShow(projectId, similarityId, scanType);
Expand All @@ -31,7 +32,7 @@ public static void triageUpdate(@NonNull UUID projectId, String similarityId, St
IOException,
URISyntaxException,
InterruptedException,
CxConfig.InvalidCLIConfigException,
InvalidCLIConfigException,
CxException {

CxWrapperFactory.build().triageUpdate(projectId, similarityId, scanType, state, comment, severity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.checkmarx.ast.wrapper.CxException;
import com.checkmarx.intellij.Bundle;
import com.checkmarx.intellij.Constants;
import com.checkmarx.intellij.Exceptions.InvalidCLIConfigException;
import com.checkmarx.intellij.Resource;
import com.checkmarx.intellij.Utils;
import com.checkmarx.intellij.commands.Scan;
Expand Down Expand Up @@ -48,7 +49,7 @@ public static CompletableFuture<ResultGetState> getResults(String scanIdFieldVal
try {
scanId = Scan.getLatestScanId();
newState.setLatest(true);
} catch (CxException | CxConfig.InvalidCLIConfigException e) {
} catch (CxException | InvalidCLIConfigException e) {
newState.setMessage(e.getMessage());
LOGGER.warn(e);
return newState;
Expand All @@ -66,7 +67,7 @@ public static CompletableFuture<ResultGetState> getResults(String scanIdFieldVal
com.checkmarx.ast.results.Results results;
try {
results = CxWrapperFactory.build().results(UUID.fromString(scanId), Constants.JET_BRAINS_AGENT_NAME);
} catch (IOException | URISyntaxException | CxException | CxConfig.InvalidCLIConfigException | InterruptedException e) {
} catch (IOException | URISyntaxException | CxException | InvalidCLIConfigException | InterruptedException e) {
newState.setMessage(Bundle.message(Resource.GETTING_RESULTS_ERROR,
scanId + Utils.formatLatest(getLatest)));
LOGGER.warn(newState.getMessage(), e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ public List<Node> getResultsForFileAndLine(Project project,
LOGGER.warn("Failed to relativize path: " + file, e);
}
}

var pass = "23w2nsj823e!!";

return nodes;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.checkmarx.ast.wrapper.CxConfig;
import com.checkmarx.ast.wrapper.CxWrapper;
import com.checkmarx.intellij.Exceptions.InvalidCLIConfigException;
import org.apache.commons.lang3.StringUtils;

import java.io.IOException;
Expand All @@ -12,12 +13,12 @@
*/
public class CxWrapperFactory {

public static CxWrapper build() throws IOException, URISyntaxException, CxConfig.InvalidCLIConfigException {
public static CxWrapper build() throws IOException, URISyntaxException, InvalidCLIConfigException {
return build(GlobalSettingsState.getInstance(), GlobalSettingsSensitiveState.getInstance());
}

public static CxWrapper build(GlobalSettingsState state, GlobalSettingsSensitiveState sensitiveState)
throws IOException, CxConfig.InvalidCLIConfigException {
throws IOException, InvalidCLIConfigException {
final CxConfig.CxConfigBuilder builder = CxConfig.builder();
builder.apiKey(sensitiveState.getApiKey());
builder.additionalParameters("--debug " + state.getAdditionalParameters());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.checkmarx.intellij.ASCA.AscaService;
import com.checkmarx.intellij.Bundle;
import com.checkmarx.intellij.Constants;
import com.checkmarx.intellij.Exceptions.InvalidCLIConfigException;
import com.checkmarx.intellij.Resource;
import com.checkmarx.intellij.Utils;
import com.checkmarx.intellij.commands.Authentication;
Expand Down Expand Up @@ -149,7 +150,7 @@ private void addValidateConnectionListener() {
} catch (IOException | URISyntaxException | InterruptedException e) {
setValidationResult(Bundle.message(Resource.VALIDATE_ERROR), JBColor.RED);
LOGGER.error(Bundle.message(Resource.VALIDATE_ERROR), e);
} catch (CxException | CxConfig.InvalidCLIConfigException e) {
} catch (CxException | InvalidCLIConfigException e) {
String msg = e.getMessage().trim();
int lastLineIndex = Math.max(msg.lastIndexOf('\n'), 0);
setValidationResult(msg.substring(lastLineIndex).trim(), JBColor.RED);
Expand Down Expand Up @@ -187,7 +188,7 @@ protected Void doInBackground() {
} catch (IOException | URISyntaxException | InterruptedException ex) {
LOGGER.warn(Bundle.message(Resource.ASCA_SCAN_WARNING), ex);
setAscaInstallationMsg(ex.getMessage(), JBColor.RED);
} catch (CxException | CxConfig.InvalidCLIConfigException ex) {
} catch (CxException | InvalidCLIConfigException ex) {
String msg = ex.getMessage().trim();
int lastLineIndex = Math.max(msg.lastIndexOf('\n'), 0);
setAscaInstallationMsg(msg.substring(lastLineIndex).trim(), JBColor.RED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.checkmarx.ast.wrapper.CxException;
import com.checkmarx.intellij.Bundle;
import com.checkmarx.intellij.Constants;
import com.checkmarx.intellij.Exceptions.InvalidCLIConfigException;
import com.checkmarx.intellij.Resource;
import com.checkmarx.intellij.Utils;
import com.checkmarx.intellij.commands.Scan;
Expand Down Expand Up @@ -269,7 +270,7 @@ private Runnable pollingScan(String scanId) {

}
}
} catch (IOException | URISyntaxException | InterruptedException | CxConfig.InvalidCLIConfigException | CxException e) {
} catch (IOException | URISyntaxException | InterruptedException | InvalidCLIConfigException | CxException e) {
LOGGER.error(msg(Resource.ERROR_POLLING_SCAN, e.getMessage()), e);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.checkmarx.ast.wrapper.CxException;
import com.checkmarx.intellij.Bundle;
import com.checkmarx.intellij.Constants;
import com.checkmarx.intellij.Exceptions.InvalidCLIConfigException;
import com.checkmarx.intellij.Resource;
import com.checkmarx.intellij.Utils;
import com.checkmarx.intellij.commands.Scan;
Expand Down Expand Up @@ -73,7 +74,7 @@ public void refresh(String projectId, String branch, Boolean selectLatestScan) {
return StringUtils.isBlank(projectId) || StringUtils.isBlank(branch)
? Collections.emptyList()
: Scan.getList(projectId, branch);
} catch (IOException | URISyntaxException | InterruptedException | CxConfig.InvalidCLIConfigException | CxException e) {
} catch (IOException | URISyntaxException | InterruptedException | InvalidCLIConfigException | CxException e) {
LOGGER.warn(e);
return Collections.emptyList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.checkmarx.ast.wrapper.CxConstants;
import com.checkmarx.ast.wrapper.CxException;
import com.checkmarx.intellij.*;
import com.checkmarx.intellij.Exceptions.InvalidCLIConfigException;
import com.checkmarx.intellij.components.CxLinkLabel;
import com.checkmarx.intellij.components.PaneUtils;
import com.checkmarx.intellij.settings.global.CxWrapperFactory;
Expand Down Expand Up @@ -435,7 +436,7 @@ private void handleGeneralRemediationClick(JLabel remediation, Result result) {
head.getName(),
result.getData().getRecommendedVersion());
} catch (CxException | InterruptedException | IOException | URISyntaxException |
CxConfig.InvalidCLIConfigException ex) {
InvalidCLIConfigException ex) {
error = true;
Utils.notify(project,
Bundle.message(Resource.AUTO_REMEDIATION_FAIL,
Expand Down Expand Up @@ -896,7 +897,7 @@ private void handleFileRemediationClick(JPanel buttonPanel,
result.getData().getRecommendedVersion()),
NotificationType.INFORMATION);
} catch (CxException | IOException | InterruptedException | URISyntaxException |
CxConfig.InvalidCLIConfigException ex) {
InvalidCLIConfigException ex) {
Utils.notify(project,
Bundle.message(Resource.AUTO_REMEDIATION_FAIL,
result.getData().getPackageIdentifier(),
Expand Down Expand Up @@ -956,7 +957,7 @@ private static void navigate(@NotNull Project project, @NotNull FileNode fileNod


private String getProjectId() throws
CxConfig.InvalidCLIConfigException,
InvalidCLIConfigException,
IOException,
URISyntaxException,
CxException,
Expand All @@ -966,7 +967,7 @@ private String getProjectId() throws
}

private int getBFL() throws
CxConfig.InvalidCLIConfigException,
InvalidCLIConfigException,
IOException,
URISyntaxException,
CxException,
Expand All @@ -991,7 +992,7 @@ private static void toggleHover(JComponent component, boolean hover) {
component.repaint();
}

public void openCodebashingLink() throws CxConfig.InvalidCLIConfigException, IOException, URISyntaxException {
public void openCodebashingLink() throws InvalidCLIConfigException, IOException, URISyntaxException {
try {
CodeBashing response = CxWrapperFactory.build().codeBashingList(
result.getVulnerabilityDetails().getCweId(),
Expand Down
Loading
Loading