├── gradle.properties ├── src ├── main │ ├── resources │ │ ├── contrast.properties │ │ ├── icons │ │ │ ├── low.png │ │ │ ├── tag.png │ │ │ ├── high.png │ │ │ ├── note.png │ │ │ ├── critical.png │ │ │ ├── details.png │ │ │ ├── filter.png │ │ │ ├── medium.png │ │ │ ├── remove.png │ │ │ ├── settings.png │ │ │ ├── tag_2x.png │ │ │ ├── tag_dark.png │ │ │ ├── details@2x.png │ │ │ ├── filter@2x.png │ │ │ ├── first_page.png │ │ │ ├── last_page.png │ │ │ ├── next_page.png │ │ │ ├── remove@2x.png │ │ │ ├── unlicensed.png │ │ │ ├── contrastIcon.png │ │ │ ├── contrastLogo.png │ │ │ ├── details_dark.png │ │ │ ├── externalLink.png │ │ │ ├── filter_dark.png │ │ │ ├── first_page@2x.png │ │ │ ├── last_page@2x.png │ │ │ ├── next_page@2x.png │ │ │ ├── previous_page.png │ │ │ ├── refresh_tab.png │ │ │ ├── remove_dark.png │ │ │ ├── settings@2x.png │ │ │ ├── settings_dark.png │ │ │ ├── tag@2x_dark.png │ │ │ ├── unlicensed@2x.png │ │ │ ├── details@2x_dark.png │ │ │ ├── externalLink@2x.png │ │ │ ├── filter@2x_dark.png │ │ │ ├── first_page_dark.png │ │ │ ├── last_page_dark.png │ │ │ ├── next_page_dark.png │ │ │ ├── refresh_tab@2x.png │ │ │ ├── remove@2x_dark.png │ │ │ ├── unlicensed_dark.png │ │ │ ├── externalLink_dark.png │ │ │ ├── first_page@2x_dark.png │ │ │ ├── last_page@2x_dark.png │ │ │ ├── next_page@2x_dark.png │ │ │ ├── previous_page@2x.png │ │ │ ├── previous_page_dark.png │ │ │ ├── refresh_tab_dark.png │ │ │ ├── settings@2x_dark.png │ │ │ ├── unlicensed@2x_dark.png │ │ │ ├── externalLink@2x_dark.png │ │ │ ├── refresh_tab@2x_dark.png │ │ │ └── previous_page@2x_dark.png │ │ └── META-INF │ │ │ └── plugin.xml │ └── java │ │ ├── com │ │ └── contrastsecurity │ │ │ ├── config │ │ │ ├── ChangeActionNotifier.java │ │ │ ├── EventTypeIcon.java │ │ │ ├── EventTypeIconRect.java │ │ │ ├── ContrastPersistentStateComponent.java │ │ │ └── ContrastFilterPersistentStateComponent.java │ │ │ ├── core │ │ │ ├── OrganizationNotFoundException.java │ │ │ ├── UrlConstants.java │ │ │ ├── extended │ │ │ │ ├── Fragment.java │ │ │ │ ├── View.java │ │ │ │ ├── Line.java │ │ │ │ └── EventResource.java │ │ │ ├── internal │ │ │ │ └── preferences │ │ │ │ │ └── OrganizationConfig.java │ │ │ ├── cache │ │ │ │ ├── Key.java │ │ │ │ └── ContrastCache.java │ │ │ ├── Util.java │ │ │ └── Constants.java │ │ │ └── ui │ │ │ ├── com │ │ │ └── contrastsecurity │ │ │ │ └── ui │ │ │ │ └── toolwindow │ │ │ │ ├── ContrastTableRowSorter.java │ │ │ │ ├── ApplicationComboBoxItem.java │ │ │ │ ├── ServerComboBoxItem.java │ │ │ │ ├── OrganizationTableModel.java │ │ │ │ ├── TagTableModel.java │ │ │ │ ├── MessageDialog.java │ │ │ │ ├── MessageDialog.form │ │ │ │ ├── ContrastTableModel.java │ │ │ │ ├── StatusDialog.java │ │ │ │ ├── StatusDialog.form │ │ │ │ ├── TagDialog.form │ │ │ │ ├── TagDialog.java │ │ │ │ ├── EventTreeCellRenderer.java │ │ │ │ ├── FiltersDialog.form │ │ │ │ └── ContrastToolWindow.form │ │ │ └── settings │ │ │ ├── ContrastSearchableConfigurable.java │ │ │ ├── ContrastSearchableConfigurableGUI.form │ │ │ └── ContrastSearchableConfigurableGUI.java │ │ └── icons │ │ └── ContrastPluginIcons.java └── test │ └── java │ └── com │ └── contrastsecurity │ └── core │ ├── UnitTestSuite.java │ ├── ContrastUtilTest.java │ └── UtilTest.java ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── .github ├── dependabot.yml └── workflows │ ├── build.yml │ └── publish.yml ├── README.md ├── gradlew.bat └── gradlew /gradle.properties: -------------------------------------------------------------------------------- 1 | version=2.15.1 -------------------------------------------------------------------------------- /src/main/resources/contrast.properties: -------------------------------------------------------------------------------- 1 | version=2.10.0-SNAPSHOT -------------------------------------------------------------------------------- /src/main/resources/icons/low.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/low.png -------------------------------------------------------------------------------- /src/main/resources/icons/tag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/tag.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/icons/high.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/high.png -------------------------------------------------------------------------------- /src/main/resources/icons/note.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/note.png -------------------------------------------------------------------------------- /src/main/resources/icons/critical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/critical.png -------------------------------------------------------------------------------- /src/main/resources/icons/details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/details.png -------------------------------------------------------------------------------- /src/main/resources/icons/filter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/filter.png -------------------------------------------------------------------------------- /src/main/resources/icons/medium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/medium.png -------------------------------------------------------------------------------- /src/main/resources/icons/remove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/remove.png -------------------------------------------------------------------------------- /src/main/resources/icons/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/settings.png -------------------------------------------------------------------------------- /src/main/resources/icons/tag_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/tag_2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/tag_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/tag_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/details@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/details@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/filter@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/filter@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/first_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/first_page.png -------------------------------------------------------------------------------- /src/main/resources/icons/last_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/last_page.png -------------------------------------------------------------------------------- /src/main/resources/icons/next_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/next_page.png -------------------------------------------------------------------------------- /src/main/resources/icons/remove@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/remove@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/unlicensed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/unlicensed.png -------------------------------------------------------------------------------- /src/main/resources/icons/contrastIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/contrastIcon.png -------------------------------------------------------------------------------- /src/main/resources/icons/contrastLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/contrastLogo.png -------------------------------------------------------------------------------- /src/main/resources/icons/details_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/details_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/externalLink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/externalLink.png -------------------------------------------------------------------------------- /src/main/resources/icons/filter_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/filter_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/first_page@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/first_page@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/last_page@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/last_page@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/next_page@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/next_page@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/previous_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/previous_page.png -------------------------------------------------------------------------------- /src/main/resources/icons/refresh_tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/refresh_tab.png -------------------------------------------------------------------------------- /src/main/resources/icons/remove_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/remove_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/settings@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/settings@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/settings_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/settings_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/tag@2x_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/tag@2x_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/unlicensed@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/unlicensed@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/details@2x_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/details@2x_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/externalLink@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/externalLink@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/filter@2x_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/filter@2x_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/first_page_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/first_page_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/last_page_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/last_page_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/next_page_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/next_page_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/refresh_tab@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/refresh_tab@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/remove@2x_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/remove@2x_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/unlicensed_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/unlicensed_dark.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .gradle 3 | build/ 4 | lib/ 5 | out/ 6 | local.properties 7 | contrast-intellij-plugin.iml 8 | 9 | \.idea/ 10 | 11 | package-lock\.json 12 | -------------------------------------------------------------------------------- /src/main/resources/icons/externalLink_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/externalLink_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/first_page@2x_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/first_page@2x_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/last_page@2x_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/last_page@2x_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/next_page@2x_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/next_page@2x_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/previous_page@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/previous_page@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/previous_page_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/previous_page_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/refresh_tab_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/refresh_tab_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/settings@2x_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/settings@2x_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/unlicensed@2x_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/unlicensed@2x_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/externalLink@2x_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/externalLink@2x_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/refresh_tab@2x_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/refresh_tab@2x_dark.png -------------------------------------------------------------------------------- /src/main/resources/icons/previous_page@2x_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Contrast-Security-OSS/contrast-intellij-plugin/master/src/main/resources/icons/previous_page@2x_dark.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip 4 | networkTimeout=10000 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/config/ChangeActionNotifier.java: -------------------------------------------------------------------------------- 1 | package com.contrastsecurity.config; 2 | 3 | import com.intellij.util.messages.Topic; 4 | 5 | public interface ChangeActionNotifier { 6 | Topic CHANGE_ACTION_TOPIC = Topic.create("Organization change", ChangeActionNotifier.class); 7 | 8 | void beforeAction(); 9 | 10 | void afterAction(); 11 | } 12 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gradle" 4 | directory: "/" 5 | target-branch: master 6 | schedule: 7 | interval: "daily" 8 | time: "07:00" 9 | labels: 10 | - "dependencies" 11 | open-pull-requests-limit: 5 12 | reviewers: 13 | - "Contrast-Security-OSS/ecosystem-engineering" 14 | 15 | - package-ecosystem: "github-actions" 16 | directory: "/" 17 | target-branch: master 18 | schedule: 19 | interval: "daily" 20 | time: "07:00" 21 | labels: 22 | - "dependencies" 23 | open-pull-requests-limit: 5 24 | reviewers: 25 | - "Contrast-Security-OSS/ecosystem-engineering" 26 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/core/OrganizationNotFoundException.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.core; 16 | 17 | public class OrganizationNotFoundException extends Exception { 18 | 19 | public OrganizationNotFoundException(String message) { 20 | super(message); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/core/UrlConstants.java: -------------------------------------------------------------------------------- 1 | package com.contrastsecurity.core; 2 | 3 | public final class UrlConstants { 4 | 5 | public final static String EVENT_DETAILS = "/ng/%s/traces/%s/events/%s/details?expand=skip_links"; 6 | public final static String EVENT_SUMMARY = "/ng/%s/traces/%s/events/summary?expand=skip_links"; 7 | public final static String HTTP_REQUEST = "/ng/%s/traces/%s/httprequest?expand=skip_links"; 8 | public final static String RECOMMENDATION = "/ng/%s/traces/%s/recommendation"; 9 | public final static String TRACE = "/ng/%s/traces/%s/story?expand=skip_links"; 10 | public final static String TRACE_TAGS = "/ng/%s/tags/traces/trace/%s"; 11 | public final static String ORG_TAGS = "/ng/%s/tags/traces"; 12 | public final static String TRACE_TAGS_DELETE = "/ng/%s/tags/trace/%s"; 13 | public final static String STATUS = "/ng/%s/orgtraces/mark"; 14 | public final static String APPLICATION_TRACE_FILTERS = "/ng/%s/traces/%s/filter/%s/listing"; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/test/java/com/contrastsecurity/core/UnitTestSuite.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.core; 16 | 17 | import org.junit.runner.RunWith; 18 | import org.junit.runners.Suite; 19 | 20 | @RunWith(Suite.class) 21 | @Suite.SuiteClasses({ 22 | UtilTest.class, 23 | ContrastUtilTest.class 24 | }) 25 | public class UnitTestSuite { 26 | } 27 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time 6 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle 7 | 8 | name: Java CI with Gradle 9 | 10 | on: 11 | push: 12 | branches: [ "master" ] 13 | pull_request: 14 | branches: [ "master" ] 15 | 16 | permissions: 17 | contents: read 18 | 19 | jobs: 20 | build: 21 | 22 | runs-on: ubuntu-latest 23 | 24 | steps: 25 | - uses: actions/checkout@v3 26 | - name: Set up JDK 17 27 | uses: actions/setup-java@v3 28 | with: 29 | java-version: '17' 30 | distribution: 'temurin' 31 | - name: Build with Gradle 32 | uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 33 | with: 34 | arguments: build 35 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/ui/com/contrastsecurity/ui/toolwindow/ContrastTableRowSorter.java: -------------------------------------------------------------------------------- 1 | package com.contrastsecurity.ui.com.contrastsecurity.ui.toolwindow; 2 | 3 | import javax.swing.*; 4 | import javax.swing.table.AbstractTableModel; 5 | import javax.swing.table.TableModel; 6 | import javax.swing.table.TableRowSorter; 7 | 8 | public class ContrastTableRowSorter extends TableRowSorter { 9 | 10 | private String columnToSort; 11 | 12 | ContrastTableRowSorter(AbstractTableModel model) { 13 | super(model); 14 | } 15 | 16 | @Override 17 | public void sort() { 18 | } 19 | 20 | @Override 21 | protected void fireSortOrderChanged() { 22 | final SortKey k = getSortKeys().get(0); 23 | 24 | final String colName = getModel().getColumnName(k.getColumn()); 25 | 26 | if (colName != null && !colName.isEmpty()) { 27 | columnToSort = (k.getSortOrder() == SortOrder.ASCENDING ? '+' : '-') + colName; 28 | } else { 29 | columnToSort = null; 30 | } 31 | 32 | super.fireSortOrderChanged(); 33 | } 34 | 35 | public String getColumnToSort() { 36 | return columnToSort; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/core/extended/Fragment.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.core.extended; 16 | 17 | public class Fragment { 18 | private String type; 19 | private String value; 20 | 21 | public String getType() { 22 | return type; 23 | } 24 | 25 | public void setType(String type) { 26 | this.type = type; 27 | } 28 | 29 | public String getValue() { 30 | return value; 31 | } 32 | 33 | public void setValue(String value) { 34 | this.value = value; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/core/extended/View.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.core.extended; 16 | 17 | import java.util.List; 18 | 19 | public class View { 20 | 21 | private List lines; 22 | private boolean nested; 23 | 24 | public List getLines() { 25 | return lines; 26 | } 27 | 28 | public void setLines(List lines) { 29 | this.lines = lines; 30 | } 31 | 32 | public boolean isNested() { 33 | return nested; 34 | } 35 | 36 | public void setNested(boolean nested) { 37 | this.nested = nested; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/core/extended/Line.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.core.extended; 16 | 17 | import java.util.List; 18 | 19 | public class Line { 20 | private List fragments; 21 | private String text; 22 | 23 | public List getFragments() { 24 | return fragments; 25 | } 26 | 27 | public void setFragments(List fragments) { 28 | this.fragments = fragments; 29 | } 30 | 31 | public String getText() { 32 | return text; 33 | } 34 | 35 | public void setText(String text) { 36 | this.text = text; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/ui/com/contrastsecurity/ui/toolwindow/ApplicationComboBoxItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Contrast Security. 3 | All rights reserved. 4 | 5 | This program and the accompanying materials are made available under 6 | the terms of the GNU Lesser General Public License as published by 7 | the Free Software Foundation; either version 3 of the License. 8 | 9 | The terms of the GNU GPL version 3 which accompanies this distribution 10 | and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | 12 | Contributors: 13 | Contrast Security - initial API and implementation 14 | */ 15 | package com.contrastsecurity.ui.com.contrastsecurity.ui.toolwindow; 16 | 17 | import com.contrastsecurity.models.Application; 18 | 19 | public class ApplicationComboBoxItem { 20 | private Application application; 21 | private String allApplicationsName; 22 | 23 | ApplicationComboBoxItem(Application application) { 24 | this.application = application; 25 | } 26 | 27 | ApplicationComboBoxItem(String allApplicationsName) { 28 | this.allApplicationsName = allApplicationsName; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | if (application == null) { 34 | return allApplicationsName; 35 | } else { 36 | return application.getName(); 37 | } 38 | } 39 | 40 | public Application getApplication() { 41 | return application; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/config/EventTypeIcon.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.config; 16 | 17 | import javax.swing.*; 18 | import java.awt.*; 19 | 20 | public class EventTypeIcon implements Icon { 21 | 22 | Color color; 23 | private int diameter = 10; 24 | 25 | public EventTypeIcon(Color color) { 26 | this.color = color; 27 | } 28 | 29 | public void paintIcon(Component c, Graphics g, int x, int y) { 30 | Graphics2D g2d = (Graphics2D) g.create(); 31 | g2d.setColor(color); 32 | g2d.fillOval(x, y, diameter, diameter); 33 | g2d.dispose(); 34 | } 35 | 36 | public int getIconWidth() { 37 | return diameter; 38 | } 39 | 40 | public int getIconHeight() { 41 | return diameter; 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/config/EventTypeIconRect.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.config; 16 | 17 | import javax.swing.*; 18 | import java.awt.*; 19 | 20 | public class EventTypeIconRect implements Icon { 21 | Color color; 22 | private int width = 350; 23 | private int height = 3; 24 | 25 | public EventTypeIconRect(Color color) { 26 | this.color = color; 27 | } 28 | 29 | public void paintIcon(Component c, Graphics g, int x, int y) { 30 | Graphics2D g2d = (Graphics2D) g.create(); 31 | g2d.setColor(color); 32 | g2d.fillRect(x, y, width, height); 33 | g2d.dispose(); 34 | } 35 | 36 | public int getIconWidth() { 37 | return width; 38 | } 39 | 40 | public int getIconHeight() { 41 | return height; 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/ui/com/contrastsecurity/ui/toolwindow/ServerComboBoxItem.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.ui.com.contrastsecurity.ui.toolwindow; 16 | 17 | import com.contrastsecurity.models.Server; 18 | 19 | public class ServerComboBoxItem { 20 | private Server server; 21 | private String allServersName; 22 | 23 | public ServerComboBoxItem(Server server) { 24 | this.server = server; 25 | } 26 | 27 | public ServerComboBoxItem(String name) { 28 | this.allServersName = name; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | if (server == null) { 34 | return allServersName; 35 | } else { 36 | return server.getName(); 37 | } 38 | } 39 | 40 | public Server getServer() { 41 | return server; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | # separate terms of service, privacy policy, and support 2 | # documentation. 3 | # This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created 4 | # For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle 5 | 6 | name: Gradle Package 7 | 8 | on: 9 | release: 10 | types: [created] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | permissions: 17 | contents: read 18 | packages: write 19 | 20 | steps: 21 | - uses: actions/checkout@v3 22 | - name: Set up JDK 8 23 | uses: actions/setup-java@v3 24 | with: 25 | java-version: '8' 26 | distribution: 'temurin' 27 | server-id: github # Value of the distributionManagement/repository/id field of the pom.xml 28 | settings-path: ${{ github.workspace }} # location for the settings.xml file 29 | 30 | - name: Build with Gradle 31 | uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 32 | with: 33 | arguments: build 34 | 35 | # Run intellij:verifyPlugin task. 36 | - name: Verify Plugin 37 | run: ./gradlew verifyPlugin 38 | 39 | # Publish plugin to beta channel 40 | - name: Publish Beta Plugin 41 | env: 42 | PUBLISH_TOKEN: ${{ secrets.JETBRAINS_TOKEN }} 43 | PUBLISH_CHANNEL: canary 44 | run: ./gradlew --stacktrace publishPlugin 45 | 46 | # Upload plugin artifact to make it available in the next jobs 47 | - name: Upload artifact 48 | uses: actions/upload-artifact@v1 49 | with: 50 | name: ${{ matrix.product }}-plugin-artifact 51 | path: ./build/distributions/${{ needs.build.outputs.artifact }} 52 | -------------------------------------------------------------------------------- /src/test/java/com/contrastsecurity/core/ContrastUtilTest.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.core; 16 | 17 | import com.contrastsecurity.config.ContrastUtil; 18 | import org.junit.Test; 19 | 20 | import static org.junit.Assert.assertEquals; 21 | 22 | public class ContrastUtilTest { 23 | 24 | @Test 25 | public void filterHeadersTest() { 26 | String authorizationString = "Authorization: Basic Z3Vl...Q6Z3Vlc3Q="; 27 | String intuitTidString = "intuit_tid: iasjdfjas9023423234lkj24"; 28 | String tokenString = "token : afskjfasdfljljasdfljasdf"; 29 | 30 | String goodString1 = "/plugin_extracted/plugin/DBCrossSiteScripting/jsp/EditProfile.jsp"; 31 | String goodString2 = "/plugin_extracted/plugin/DBCrossSiteScripting/jsp/DBCrossSiteScripting.jsp"; 32 | String goodString3 = "/plugin_extracted/plugin/SQLInjection/jsp/ViewProfile.jsp"; 33 | 34 | String separator = "\n"; 35 | String data = goodString1 + separator + authorizationString + separator + goodString2 + separator + 36 | intuitTidString + separator + goodString3 + separator + tokenString; 37 | 38 | String filtered = ContrastUtil.filterHeaders(data, separator); 39 | assertEquals(goodString1 + separator + goodString2 + separator + goodString3, filtered); 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/ui/com/contrastsecurity/ui/toolwindow/OrganizationTableModel.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2018 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.ui.com.contrastsecurity.ui.toolwindow; 16 | 17 | import javax.swing.table.AbstractTableModel; 18 | 19 | public class OrganizationTableModel extends AbstractTableModel { 20 | 21 | private String[] columnNames = {"Organizations"}; 22 | private String[] data = new String[0]; 23 | 24 | @Override 25 | public int getRowCount() { 26 | return data.length; 27 | } 28 | 29 | @Override 30 | public int getColumnCount() { 31 | return columnNames.length; 32 | } 33 | 34 | @Override 35 | public Object getValueAt(int rowIndex, int columnIndex) { 36 | Object obj = null; 37 | if (getRowCount() > rowIndex) { 38 | switch (columnIndex) { 39 | case 0: 40 | obj = data[rowIndex]; 41 | break; 42 | } 43 | 44 | } 45 | return obj; 46 | } 47 | 48 | public Class getColumnClass(int c) { 49 | if (getValueAt(0, c) != null) { 50 | return getValueAt(0, c).getClass(); 51 | } else { 52 | return "".getClass(); 53 | } 54 | 55 | } 56 | 57 | public String getColumnName(int col) { 58 | return columnNames[col]; 59 | } 60 | 61 | public void setData(String[] data) { 62 | this.data = data; 63 | } 64 | 65 | public String[] getData() { 66 | return data; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/core/internal/preferences/OrganizationConfig.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.core.internal.preferences; 16 | 17 | public class OrganizationConfig { 18 | 19 | private String teamServerUrl; 20 | private String username; 21 | private String serviceKey; 22 | private String apiKey; 23 | private String uuid; 24 | 25 | public OrganizationConfig(String teamServerUrl, String username, String serviceKey, String apiKey, String uuid) { 26 | this.teamServerUrl = teamServerUrl; 27 | this.username = username; 28 | this.serviceKey = serviceKey; 29 | this.apiKey = apiKey; 30 | this.uuid = uuid; 31 | } 32 | 33 | public String getTeamServerUrl() { 34 | return teamServerUrl; 35 | } 36 | 37 | public void setTeamServerUrl(String teamServerUrl) { 38 | this.teamServerUrl = teamServerUrl; 39 | } 40 | 41 | public String getUsername() { 42 | return username; 43 | } 44 | 45 | public void setUsername(String username) { 46 | this.username = username; 47 | } 48 | 49 | public String getServiceKey() { 50 | return serviceKey; 51 | } 52 | 53 | public void setServiceKey(String serviceKey) { 54 | this.serviceKey = serviceKey; 55 | } 56 | 57 | public String getApiKey() { 58 | return apiKey; 59 | } 60 | 61 | public void setApiKey(String apiKey) { 62 | this.apiKey = apiKey; 63 | } 64 | 65 | public String getUuid() { 66 | return uuid; 67 | } 68 | 69 | public void setUuid(String uuid) { 70 | this.uuid = uuid; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/test/java/com/contrastsecurity/core/UtilTest.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.core; 16 | 17 | import com.contrastsecurity.core.internal.preferences.OrganizationConfig; 18 | import org.junit.Test; 19 | 20 | import static org.junit.Assert.assertEquals; 21 | 22 | public class UtilTest { 23 | 24 | private final static String TEAMSERVER_URL = "TeamServer URL"; 25 | private final static String USERNAME = "username"; 26 | private final static String SERVICE_KEY = "service key"; 27 | private final static String API_KEY = "api key"; 28 | private final static String UUID = "uuid"; 29 | private final static String DELIMITER = Constants.DELIMITER; 30 | 31 | @Test 32 | public void getStringFromOrganizationConfigTest() { 33 | OrganizationConfig organizationConfig = new OrganizationConfig(TEAMSERVER_URL, USERNAME, SERVICE_KEY, API_KEY, UUID); 34 | String organizationConfigString = Util.getStringFromOrganizationConfig(organizationConfig, DELIMITER); 35 | assertEquals(organizationConfigString, TEAMSERVER_URL + DELIMITER + USERNAME + DELIMITER + 36 | SERVICE_KEY + DELIMITER + API_KEY + DELIMITER + UUID ); 37 | } 38 | 39 | @Test 40 | public void getOrganizationConfigFromStringTest() { 41 | String organizationConfigString = TEAMSERVER_URL + DELIMITER + USERNAME + DELIMITER + SERVICE_KEY + DELIMITER + API_KEY + DELIMITER + UUID; 42 | OrganizationConfig organizationConfig = Util.getOrganizationConfigFromString(organizationConfigString, DELIMITER); 43 | assertEquals(organizationConfig.getApiKey(), API_KEY); 44 | assertEquals(organizationConfig.getUuid(), UUID); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IntelliJ IDEA plugin connecting to Teamserver REST API. # 2 | 3 | ### Prerequisites ### 4 | * IntelliJ IDEA version 9.0 or later (either Community Edition or Ultimate) must be installed on your computer. 5 | * Plugin DevKit plugin must be enabled in IDE. Go to IntelliJ settings => Plugins => search for Plugin DevKit and make sure it is enabled. 6 | * IntelliJ Platform SDK must be configured for your IDEA project. Right click on project folder in IntelliJ => Open Module Settings => Project => Project SDK. 7 | If necessary add a new "IntelliJ Platform Plugin SDK". It should point to the installation folder of IntelliJ. 8 | * Project language level in project settings should be set to 8. Right click on project folder in IntelliJ => Open Module Settings => Project => Project language level. 9 | More information on setting up development environment: http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/setting_up_environment.html 10 | * Gradle must be installed and added to "Path" system environment variable: https://gradle.org/install/ 11 | * Java 17 12 | 13 | ### Build from the command line ### 14 | * Clone the project. 15 | * Run `./gradlew buildPlugin`in project root directory. 16 | * Plugin zip archive should be generated to project root folder/build/distributions. 17 | * To install the generated zip archive of the plugin go to File => Settings => Plugins => Install Plugin from disk. 18 | 19 | ### Build from IDE ### 20 | * Clone the project. 21 | * Open the project with IntelliJ IDEA. 22 | * In the "Event Log" notification, which should appear in the bottom right corner, click "Import Gradle project". 23 | * Fill in the import dialog. 24 | * Open Gradle tool window and run "buildPlugin" task, which is in the "intellij" task folder. 25 | * Plugin zip archive should be generated to project root folder/build/distributions. 26 | * To install the generated zip archive of the plugin go to File => Settings => Plugins => Install Plugin from disk. 27 | 28 | ### Run from the command line ### 29 | * Run ``` ./gradlew runIde ``` from the command line within the project root folder. 30 | * A separate instance of IntelliJ IDEA should be launched with the plugin installed. 31 | 32 | ### Run from the IDE ### 33 | * Build the project 34 | * Open Gradle tool window and run "runIdea" task, which is inside the "intellij" task folder. 35 | * A separate instance of IntelliJ IDEA should be launched with the plugin installed. 36 | 37 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/core/cache/Key.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.core.cache; 16 | 17 | public class Key { 18 | private String orgUuid; 19 | private String traceId; 20 | 21 | public Key(String orgUuid, String traceId) { 22 | this.orgUuid = orgUuid; 23 | this.traceId = traceId; 24 | } 25 | 26 | public String getOrgUuid() { 27 | return orgUuid; 28 | } 29 | 30 | public void setOrgUuid(String orgUuid) { 31 | this.orgUuid = orgUuid; 32 | } 33 | 34 | public String getTraceId() { 35 | return traceId; 36 | } 37 | 38 | public void setTraceId(String traceId) { 39 | this.traceId = traceId; 40 | } 41 | 42 | @Override 43 | public int hashCode() { 44 | final int prime = 31; 45 | int result = 1; 46 | result = prime * result + ((orgUuid == null) ? 0 : orgUuid.hashCode()); 47 | result = prime * result + ((traceId == null) ? 0 : traceId.hashCode()); 48 | return result; 49 | } 50 | 51 | @Override 52 | public boolean equals(Object obj) { 53 | if (this == obj) 54 | return true; 55 | if (obj == null) 56 | return false; 57 | if (getClass() != obj.getClass()) 58 | return false; 59 | Key other = (Key) obj; 60 | if (orgUuid == null) { 61 | if (other.orgUuid != null) 62 | return false; 63 | } else if (!orgUuid.equals(other.orgUuid)) 64 | return false; 65 | if (traceId == null) { 66 | if (other.traceId != null) 67 | return false; 68 | } else if (!traceId.equals(other.traceId)) 69 | return false; 70 | return true; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/ui/com/contrastsecurity/ui/toolwindow/TagTableModel.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.ui.com.contrastsecurity.ui.toolwindow; 16 | 17 | import icons.ContrastPluginIcons; 18 | 19 | import javax.swing.*; 20 | import javax.swing.table.AbstractTableModel; 21 | 22 | public class TagTableModel extends AbstractTableModel { 23 | 24 | private String[] columnNames = {"Tag", "Remove"}; 25 | private String[] data = new String[0]; 26 | 27 | @Override 28 | public int getRowCount() { 29 | return data.length; 30 | } 31 | 32 | @Override 33 | public int getColumnCount() { 34 | return columnNames.length; 35 | } 36 | 37 | @Override 38 | public Object getValueAt(int rowIndex, int columnIndex) { 39 | Object obj = null; 40 | if (getRowCount() > rowIndex) { 41 | switch (columnIndex) { 42 | case 0: 43 | obj = data[rowIndex]; 44 | break; 45 | case 1: 46 | obj = ContrastPluginIcons.REMOVE_ICON; 47 | break; 48 | } 49 | 50 | } 51 | return obj; 52 | } 53 | 54 | public Class getColumnClass(int c) { 55 | if (getValueAt(0, c) != null) { 56 | if (getValueAt(0, c) instanceof Icon) { 57 | return ImageIcon.class; 58 | } 59 | return getValueAt(0, c).getClass(); 60 | } else { 61 | return "".getClass(); 62 | } 63 | 64 | } 65 | 66 | public String getColumnName(int col) { 67 | return columnNames[col]; 68 | } 69 | 70 | public void setData(String[] data) { 71 | this.data = data; 72 | } 73 | 74 | public String[] getData() { 75 | return data; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/icons/ContrastPluginIcons.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package icons; 16 | 17 | import com.intellij.openapi.util.IconLoader; 18 | 19 | import javax.swing.*; 20 | 21 | public interface ContrastPluginIcons { 22 | 23 | Icon CONTRAST_ICON = IconLoader.getIcon("/icons/contrastImageIcon.png", ContrastPluginIcons.class); 24 | Icon SETTINGS_ICON = IconLoader.getIcon("/icons/settings.png", ContrastPluginIcons.class); 25 | Icon SEVERITY_ICON_CRITICAL = IconLoader.getIcon("/icons/critical.png", ContrastPluginIcons.class); 26 | Icon SEVERITY_ICON_HIGH = IconLoader.getIcon("/icons/high.png", ContrastPluginIcons.class); 27 | Icon SEVERITY_ICON_MEDIUM = IconLoader.getIcon("/icons/medium.png", ContrastPluginIcons.class); 28 | Icon SEVERITY_ICON_LOW = IconLoader.getIcon("/icons/low.png", ContrastPluginIcons.class); 29 | Icon SEVERITY_ICON_NOTE = IconLoader.getIcon("/icons/note.png", ContrastPluginIcons.class); 30 | Icon EXTERNAL_LINK_ICON = IconLoader.getIcon("/icons/externalLink.png", ContrastPluginIcons.class); 31 | Icon DETAILS_ICON = IconLoader.getIcon("/icons/details.png", ContrastPluginIcons.class); 32 | Icon UNLICENSED_ICON = IconLoader.getIcon("/icons/unlicensed.png", ContrastPluginIcons.class); 33 | Icon REFRESH_ICON = IconLoader.getIcon("/icons/refresh_tab.png", ContrastPluginIcons.class); 34 | Icon FILTER_ICON = IconLoader.getIcon("/icons/filter.png", ContrastPluginIcons.class); 35 | Icon FIRST_PAGE_ICON = IconLoader.getIcon("/icons/first_page.png", ContrastPluginIcons.class); 36 | Icon LAST_PAGE_ICON = IconLoader.getIcon("/icons/last_page.png", ContrastPluginIcons.class); 37 | Icon PREVIOUS_PAGE_ICON = IconLoader.getIcon("/icons/previous_page.png", ContrastPluginIcons.class); 38 | Icon NEXT_PAGE_ICON = IconLoader.getIcon("/icons/next_page.png", ContrastPluginIcons.class); 39 | Icon TAG_ICON = IconLoader.getIcon("/icons/tag.png", ContrastPluginIcons.class); 40 | Icon REMOVE_ICON = IconLoader.getIcon("/icons/remove.png", ContrastPluginIcons.class); 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/core/Util.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.core; 16 | 17 | import com.contrastsecurity.core.internal.preferences.OrganizationConfig; 18 | import com.contrastsecurity.http.TraceFilterForm; 19 | import org.apache.commons.lang.StringUtils; 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | public class Util { 25 | 26 | public static TraceFilterForm getTraceFilterForm(final int offset, final int limit) { 27 | return getTraceFilterForm(null, offset, limit); 28 | } 29 | 30 | public static TraceFilterForm getTraceFilterForm(final Long selectedServerId, final int offset, final int limit) { 31 | final TraceFilterForm form = new TraceFilterForm(); 32 | if (selectedServerId != null) { 33 | final List serverIds = new ArrayList<>(); 34 | serverIds.add(selectedServerId); 35 | form.setServerIds(serverIds); 36 | } 37 | form.setOffset(offset); 38 | form.setLimit(limit); 39 | 40 | return form; 41 | } 42 | 43 | public static String getStringFromOrganizationConfig(OrganizationConfig organizationConfig, String delimiter) { 44 | String organization = organizationConfig.getTeamServerUrl() + delimiter + 45 | organizationConfig.getUsername() + delimiter + 46 | organizationConfig.getServiceKey() + delimiter + 47 | organizationConfig.getApiKey() + delimiter + organizationConfig.getUuid(); 48 | return organization; 49 | } 50 | 51 | public static OrganizationConfig getOrganizationConfigFromString(String organization, String delimiter) { 52 | OrganizationConfig organizationConfig = null; 53 | 54 | if (StringUtils.isNotBlank(organization)) { 55 | String[] org = StringUtils.split(organization, delimiter); 56 | if (org.length == 5) { 57 | organizationConfig = new OrganizationConfig(org[0], org[1], org[2], org[3], org[4]); 58 | } 59 | } 60 | return organizationConfig; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/ui/settings/ContrastSearchableConfigurable.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.ui.settings; 16 | 17 | import com.contrastsecurity.config.ContrastPersistentStateComponent; 18 | import com.intellij.openapi.options.ConfigurationException; 19 | import com.intellij.openapi.options.SearchableConfigurable; 20 | import java.util.concurrent.ExecutionException; 21 | import java.util.concurrent.TimeoutException; 22 | import org.jetbrains.annotations.Nls; 23 | import org.jetbrains.annotations.NotNull; 24 | import org.jetbrains.annotations.Nullable; 25 | 26 | import javax.swing.*; 27 | 28 | public class ContrastSearchableConfigurable implements SearchableConfigurable { 29 | 30 | ContrastSearchableConfigurableGUI contrastSearchableConfigurableGUI; 31 | 32 | public ContrastSearchableConfigurable() { 33 | } 34 | 35 | @NotNull 36 | @Override 37 | public String getId() { 38 | return "preferences.ContrastSearchableConfigurable"; 39 | } 40 | 41 | @Nls 42 | @Override 43 | public String getDisplayName() { 44 | return "Contrast"; 45 | } 46 | 47 | @Nullable 48 | @Override 49 | public JComponent createComponent() { 50 | try { 51 | contrastSearchableConfigurableGUI = new ContrastSearchableConfigurableGUI(); 52 | } catch (ExecutionException e) { 53 | throw new RuntimeException(e); 54 | } catch (TimeoutException e) { 55 | throw new RuntimeException(e); 56 | } 57 | return contrastSearchableConfigurableGUI.getContrastSettingsPanel(); 58 | } 59 | 60 | @Override 61 | public boolean isModified() { 62 | return contrastSearchableConfigurableGUI.isModified(); 63 | } 64 | 65 | @Override 66 | public void apply() throws ConfigurationException { 67 | contrastSearchableConfigurableGUI.apply(); 68 | } 69 | 70 | @Override 71 | public void disposeUIResources() { 72 | contrastSearchableConfigurableGUI = null; 73 | } 74 | 75 | @Override 76 | public void reset() { 77 | contrastSearchableConfigurableGUI.reset(); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/ui/com/contrastsecurity/ui/toolwindow/MessageDialog.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.ui.com.contrastsecurity.ui.toolwindow; 16 | 17 | import javax.swing.*; 18 | import java.awt.*; 19 | import java.awt.event.ActionEvent; 20 | import java.awt.event.ActionListener; 21 | 22 | public class MessageDialog extends JDialog { 23 | private JPanel contentPane; 24 | private JButton buttonOK; 25 | private JTextPane messageTextPane; 26 | 27 | public MessageDialog(String title, String message) { 28 | setContentPane(contentPane); 29 | setModal(true); 30 | getRootPane().setDefaultButton(buttonOK); 31 | 32 | buttonOK.addActionListener(new ActionListener() { 33 | public void actionPerformed(ActionEvent e) { 34 | onOK(); 35 | } 36 | }); 37 | 38 | setSize(600, 150); 39 | final Toolkit toolkit = Toolkit.getDefaultToolkit(); 40 | final Dimension screenSize = toolkit.getScreenSize(); 41 | final int x = (screenSize.width - getWidth()) / 2; 42 | final int y = (screenSize.height - getHeight()) / 2; 43 | setLocation(x, y); 44 | setTitle(title); 45 | messageTextPane.setText(message); 46 | } 47 | 48 | public MessageDialog() { 49 | setContentPane(contentPane); 50 | setModal(true); 51 | getRootPane().setDefaultButton(buttonOK); 52 | 53 | buttonOK.addActionListener(new ActionListener() { 54 | public void actionPerformed(ActionEvent e) { 55 | onOK(); 56 | } 57 | }); 58 | 59 | setSize(600, 200); 60 | final Toolkit toolkit = Toolkit.getDefaultToolkit(); 61 | final Dimension screenSize = toolkit.getScreenSize(); 62 | final int x = (screenSize.width - getWidth()) / 2; 63 | final int y = (screenSize.height - getHeight()) / 2; 64 | setLocation(x, y); 65 | } 66 | 67 | public static void main(String[] args) { 68 | MessageDialog dialog = new MessageDialog(); 69 | dialog.pack(); 70 | dialog.setVisible(true); 71 | System.exit(0); 72 | } 73 | 74 | private void onOK() { 75 | // add your code here 76 | dispose(); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | com.contrastsecurity.contrast-intellij-plugin 3 | Contrast 4 | ${project.version} 5 | Contrast Security 6 | 7 | Instrument your applications with Contrast Security to gain real-time visibility to vulnerabilities in your application, and to defend them against attacks.

9 |

Contrast integrates with your existing SDLC processes to provide an easy way to view and fix vulnerabilities in your code, and protect your applications.

10 |

The Contrast for IntelliJ plugin lists the vulnerabilities from your application directly in your IntelliJ environment enabling developers to resolve issues faster.

11 |

Please note that you will need an account in the Contrast UI in order to use this feature.

12 |

You can learn more about Contrast Security's latest products by visiting our website at www.contrastsecurity.com.

13 |

To schedule a demo, contact us at www.contrastsecurity.com/demo or by calling 1-888-371-1333.

14 |

Welcome to the Era of Self-Protecting Software.

15 | ]]>
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 28 | com.intellij.modules.java 29 | 30 | 33 | 34 | 35 | 36 | 38 | 40 | 41 | 43 | 45 | 46 | 47 |
-------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 48 | echo. 49 | echo Please set the JAVA_HOME variable in your environment to match the 50 | echo location of your Java installation. 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 62 | echo. 63 | echo Please set the JAVA_HOME variable in your environment to match the 64 | echo location of your Java installation. 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/config/ContrastPersistentStateComponent.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.config; 16 | 17 | import com.contrastsecurity.core.Constants; 18 | import com.intellij.openapi.application.ApplicationManager; 19 | import com.intellij.openapi.components.PersistentStateComponent; 20 | import com.intellij.openapi.components.State; 21 | import com.intellij.openapi.components.Storage; 22 | import com.intellij.openapi.project.ProjectManager; 23 | import com.intellij.openapi.project.impl.ProjectManagerImpl; 24 | import com.intellij.util.xmlb.XmlSerializerUtil; 25 | import org.apache.tools.ant.Project; 26 | import org.jetbrains.annotations.Nullable; 27 | 28 | import java.util.HashMap; 29 | import java.util.Map; 30 | 31 | @State( 32 | name="ContrastPersistentStateComponent", 33 | storages = { 34 | @Storage("$APP_CONFIG$/contrast.xml")} 35 | ) 36 | public class ContrastPersistentStateComponent implements PersistentStateComponent { 37 | 38 | public String teamServerUrl = Constants.TEAM_SERVER_URL_VALUE; 39 | public String username = ""; 40 | public String serviceKey = ""; 41 | // Key = organization name, Value = Organization (API key;UUID) represented as a String 42 | public Map organizations; 43 | public String selectedOrganizationName = ""; 44 | 45 | @Nullable 46 | @Override 47 | public ContrastPersistentStateComponent getState() { 48 | return this; 49 | } 50 | 51 | @Override 52 | public void loadState(ContrastPersistentStateComponent contrastPersistentStateComponent) { 53 | XmlSerializerUtil.copyBean(contrastPersistentStateComponent, this); 54 | } 55 | 56 | public String getTeamServerUrl() { 57 | return teamServerUrl; 58 | } 59 | 60 | public String getUsername() { 61 | return username; 62 | } 63 | 64 | public String getServiceKey() { 65 | return serviceKey; 66 | } 67 | 68 | public Map getOrganizations() { 69 | if (organizations == null){ 70 | organizations = new HashMap<>(); 71 | } 72 | return organizations; 73 | } 74 | 75 | public void setOrganizations(Map organizations) { 76 | this.organizations = new HashMap<>(organizations); 77 | } 78 | 79 | @Nullable 80 | public static ContrastPersistentStateComponent getInstance() { 81 | return ApplicationManager.getApplication().getService(ContrastPersistentStateComponent.class); 82 | } 83 | 84 | public String getSelectedOrganizationName() { 85 | return selectedOrganizationName; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/core/cache/ContrastCache.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.core.cache; 16 | 17 | import com.contrastsecurity.models.EventSummaryResponse; 18 | import com.contrastsecurity.models.HttpRequestResponse; 19 | import com.contrastsecurity.models.RecommendationResponse; 20 | import com.contrastsecurity.models.StoryResponse; 21 | import com.contrastsecurity.models.TagsResponse; 22 | import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap; 23 | 24 | public class ContrastCache { 25 | private static final int MAX_CACHE_SIZE = 50; 26 | 27 | 28 | private ConcurrentLinkedHashMap tagsResources = 29 | new ConcurrentLinkedHashMap.Builder() 30 | .initialCapacity(MAX_CACHE_SIZE / 2) 31 | .maximumWeightedCapacity(MAX_CACHE_SIZE) 32 | .build(); 33 | 34 | private ConcurrentLinkedHashMap eventSummaryResources = 35 | new ConcurrentLinkedHashMap.Builder() 36 | .initialCapacity(MAX_CACHE_SIZE / 2) 37 | .maximumWeightedCapacity(MAX_CACHE_SIZE) 38 | .build(); 39 | private ConcurrentLinkedHashMap storyResponses = 40 | new ConcurrentLinkedHashMap.Builder() 41 | .initialCapacity(MAX_CACHE_SIZE / 2) 42 | .maximumWeightedCapacity(MAX_CACHE_SIZE) 43 | .build(); 44 | private ConcurrentLinkedHashMap httpRequestResources = 45 | new ConcurrentLinkedHashMap.Builder() 46 | .initialCapacity(MAX_CACHE_SIZE / 2) 47 | .maximumWeightedCapacity(MAX_CACHE_SIZE) 48 | .build(); 49 | 50 | private ConcurrentLinkedHashMap recommendationResources = 51 | new ConcurrentLinkedHashMap.Builder() 52 | .initialCapacity(MAX_CACHE_SIZE / 2) 53 | .maximumWeightedCapacity(MAX_CACHE_SIZE) 54 | .build(); 55 | 56 | public ConcurrentLinkedHashMap getTagsResources() { 57 | return tagsResources; 58 | } 59 | 60 | public ConcurrentLinkedHashMap getEventSummaryResources() { 61 | return eventSummaryResources; 62 | } 63 | 64 | public ConcurrentLinkedHashMap getStoryResources() { 65 | return storyResponses; 66 | } 67 | 68 | public ConcurrentLinkedHashMap getHttpRequestResources() { 69 | return httpRequestResources; 70 | } 71 | 72 | public ConcurrentLinkedHashMap getRecommendationResources() { 73 | return recommendationResources; 74 | } 75 | 76 | public void clear() { 77 | eventSummaryResources.clear(); 78 | storyResponses.clear(); 79 | httpRequestResources.clear(); 80 | recommendationResources.clear(); 81 | tagsResources.clear(); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/ui/com/contrastsecurity/ui/toolwindow/MessageDialog.form: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 |
74 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/ui/com/contrastsecurity/ui/toolwindow/ContrastTableModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Contrast Security. 3 | All rights reserved. 4 | 5 | This program and the accompanying materials are made available under 6 | the terms of the GNU Lesser General Public License as published by 7 | the Free Software Foundation; either version 3 of the License. 8 | 9 | The terms of the GNU GPL version 3 which accompanies this distribution 10 | and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | 12 | Contributors: 13 | Contrast Security - initial API and implementation 14 | */ 15 | package com.contrastsecurity.ui.com.contrastsecurity.ui.toolwindow; 16 | 17 | import com.contrastsecurity.config.ContrastUtil; 18 | import com.contrastsecurity.core.Constants; 19 | import com.contrastsecurity.models.Trace; 20 | import icons.ContrastPluginIcons; 21 | 22 | import javax.swing.*; 23 | import javax.swing.table.AbstractTableModel; 24 | import java.util.Date; 25 | 26 | public class ContrastTableModel extends AbstractTableModel { 27 | private String[] columnNames = {"Severity", "Vulnerability", "Application", "Last Detected", "Status", ""}; 28 | private Trace[] data = new Trace[0]; 29 | private ContrastUtil contrastUtil = new ContrastUtil(); 30 | 31 | @Override 32 | public int getRowCount() { 33 | return data.length; 34 | } 35 | 36 | @Override 37 | public int getColumnCount() { 38 | return columnNames.length; 39 | } 40 | 41 | @Override 42 | public Object getValueAt(int rowIndex, int columnIndex) { 43 | Trace trace; 44 | Object obj = null; 45 | if (getRowCount() > rowIndex) { 46 | trace = data[rowIndex]; 47 | switch (columnIndex) { 48 | case 0: 49 | String severity = trace.getSeverity(); 50 | switch (severity) { 51 | case Constants.SEVERITY_LEVEL_NOTE: 52 | obj = ContrastPluginIcons.SEVERITY_ICON_NOTE; 53 | break; 54 | case Constants.SEVERITY_LEVEL_LOW: 55 | obj = ContrastPluginIcons.SEVERITY_ICON_LOW; 56 | break; 57 | case Constants.SEVERITY_LEVEL_MEDIUM: 58 | obj = ContrastPluginIcons.SEVERITY_ICON_MEDIUM; 59 | break; 60 | case Constants.SEVERITY_LEVEL_HIGH: 61 | obj = ContrastPluginIcons.SEVERITY_ICON_HIGH; 62 | break; 63 | case Constants.SEVERITY_LEVEL_CRITICAL: 64 | obj = ContrastPluginIcons.SEVERITY_ICON_CRITICAL; 65 | break; 66 | default: 67 | obj = ""; 68 | break; 69 | } 70 | break; 71 | case 1: 72 | String title = trace.getTitle(); 73 | int indexOfUnlicensed = title.indexOf(Constants.UNLICENSED); 74 | if (indexOfUnlicensed != -1) { 75 | title = "UNLICENSED - " + title.substring(0, indexOfUnlicensed); 76 | } 77 | obj = title; 78 | break; 79 | case 2: 80 | obj = trace.getApplication().getName(); 81 | break; 82 | case 3: 83 | obj = new Date(trace.getLastTimeSeen()); 84 | break; 85 | case 4: 86 | obj = trace.getStatus(); 87 | break; 88 | case 5: 89 | obj = ContrastPluginIcons.EXTERNAL_LINK_ICON; 90 | break; 91 | default: 92 | obj = null; 93 | break; 94 | } 95 | } 96 | return obj; 97 | } 98 | 99 | public Class getColumnClass(int c) { 100 | if (getValueAt(0, c) != null) { 101 | if (getValueAt(0, c) instanceof Icon) { 102 | return ImageIcon.class; 103 | } 104 | return getValueAt(0, c).getClass(); 105 | } else { 106 | return "".getClass(); 107 | } 108 | 109 | } 110 | 111 | public String getColumnName(int col) { 112 | return columnNames[col]; 113 | } 114 | 115 | public void setData(Trace[] data) { 116 | this.data = data; 117 | } 118 | 119 | public Trace getTraceAtRow(int row) { 120 | return data[row]; 121 | } 122 | 123 | 124 | } 125 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/ui/com/contrastsecurity/ui/toolwindow/StatusDialog.java: -------------------------------------------------------------------------------- 1 | package com.contrastsecurity.ui.com.contrastsecurity.ui.toolwindow; 2 | 3 | import com.contrastsecurity.core.Constants; 4 | 5 | import javax.swing.*; 6 | import java.awt.*; 7 | import java.awt.event.*; 8 | 9 | public class StatusDialog extends JDialog { 10 | private JPanel contentPane; 11 | private JButton buttonOK; 12 | private JButton buttonCancel; 13 | private JComboBox statusComboBox; 14 | private JComboBox reasonComboBox; 15 | private JTextArea commentTextArea; 16 | 17 | private String status; 18 | private String reason; 19 | private String comment; 20 | 21 | public StatusDialog() { 22 | setContentPane(contentPane); 23 | setModal(true); 24 | getRootPane().setDefaultButton(buttonOK); 25 | 26 | buttonOK.addActionListener(new ActionListener() { 27 | public void actionPerformed(ActionEvent e) { 28 | onOK(); 29 | } 30 | }); 31 | 32 | buttonCancel.addActionListener(new ActionListener() { 33 | public void actionPerformed(ActionEvent e) { 34 | onCancel(); 35 | } 36 | }); 37 | 38 | // call onCancel() when cross is clicked 39 | setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); 40 | addWindowListener(new WindowAdapter() { 41 | public void windowClosing(WindowEvent e) { 42 | onCancel(); 43 | } 44 | }); 45 | 46 | // call onCancel() on ESCAPE 47 | contentPane.registerKeyboardAction(new ActionListener() { 48 | public void actionPerformed(ActionEvent e) { 49 | onCancel(); 50 | } 51 | }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); 52 | 53 | setSize(700, 300); 54 | final Toolkit toolkit = Toolkit.getDefaultToolkit(); 55 | final Dimension screenSize = toolkit.getScreenSize(); 56 | final int x = (screenSize.width - getWidth()) / 2; 57 | final int y = (screenSize.height - getHeight()) / 2; 58 | setLocation(x, y); 59 | setTitle("Mark as"); 60 | 61 | resetComboBoxes(); 62 | 63 | statusComboBox.addActionListener(new ActionListener() { 64 | @Override 65 | public void actionPerformed(ActionEvent e) { 66 | String status = statusComboBox.getSelectedItem().toString(); 67 | if (status.equals(Constants.VULNERABILITY_STATUS_NOT_A_PROBLEM_COMBO_BOX_ITEM)) { 68 | reasonComboBox.setEnabled(true); 69 | buttonOK.setEnabled(false); 70 | } else { 71 | reasonComboBox.setEnabled(false); 72 | buttonOK.setEnabled(true); 73 | } 74 | } 75 | }); 76 | 77 | reasonComboBox.addActionListener(new ActionListener() { 78 | @Override 79 | public void actionPerformed(ActionEvent e) { 80 | String status = statusComboBox.getSelectedItem().toString(); 81 | if (status.equals(Constants.VULNERABILITY_STATUS_NOT_A_PROBLEM_COMBO_BOX_ITEM) && !buttonOK.isEnabled()) { 82 | buttonOK.setEnabled(true); 83 | } 84 | } 85 | }); 86 | } 87 | 88 | public static void main(String[] args) { 89 | StatusDialog dialog = new StatusDialog(); 90 | dialog.pack(); 91 | dialog.setVisible(true); 92 | System.exit(0); 93 | } 94 | 95 | private void onOK() { 96 | // add your code here 97 | status = statusComboBox.getSelectedItem().toString(); 98 | reason = reasonComboBox.getSelectedItem().toString(); 99 | comment = commentTextArea.getText(); 100 | dispose(); 101 | } 102 | 103 | private void onCancel() { 104 | // add your code here if necessary 105 | dispose(); 106 | } 107 | 108 | private void resetComboBoxes() { 109 | statusComboBox.removeAllItems(); 110 | for (String status : Constants.STATUS_ARRAY) { 111 | statusComboBox.addItem(status); 112 | } 113 | reasonComboBox.removeAllItems(); 114 | for (String reason : Constants.REASON_ARRAY) { 115 | reasonComboBox.addItem(reason); 116 | } 117 | 118 | reasonComboBox.setEnabled(false); 119 | } 120 | 121 | public String getStatus() { 122 | return status; 123 | } 124 | 125 | public String getReason() { 126 | return reason; 127 | } 128 | 129 | public String getComment() { 130 | return comment; 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/ui/com/contrastsecurity/ui/toolwindow/StatusDialog.form: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 |
110 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/config/ContrastFilterPersistentStateComponent.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.config; 16 | 17 | import com.contrastsecurity.core.Constants; 18 | import com.intellij.openapi.components.PersistentStateComponent; 19 | import com.intellij.openapi.components.ServiceManager; 20 | import com.intellij.openapi.components.State; 21 | import com.intellij.openapi.components.Storage; 22 | import com.intellij.openapi.project.Project; 23 | import com.intellij.openapi.project.ProjectManager; 24 | import com.intellij.util.xmlb.XmlSerializerUtil; 25 | import org.jetbrains.annotations.Nullable; 26 | 27 | import java.util.ArrayList; 28 | import java.util.List; 29 | 30 | @State( 31 | name = "ContrastFilterPersistentStateComponent", 32 | storages = { 33 | @Storage("contrast-filter.xml")} 34 | ) 35 | public class ContrastFilterPersistentStateComponent implements PersistentStateComponent { 36 | 37 | public Long selectedServerUuid; 38 | public String selectedApplicationName = ""; 39 | public String selectedApplicationId; 40 | public List severities; 41 | public String lastDetected = Constants.LAST_DETECTED_ALL; 42 | public Long lastDetectedFrom; 43 | public Long lastDetectedTo; 44 | public List statuses; 45 | public Integer page; 46 | public String sort; 47 | public int currentOffset = 0; 48 | public String appVersionTag; 49 | 50 | public boolean isBeingTracked() { 51 | return isBeingTracked; 52 | } 53 | 54 | public void setBeingTracked(boolean beingTracked) { 55 | isBeingTracked = beingTracked; 56 | } 57 | 58 | public boolean isUntracked() { 59 | return isUntracked; 60 | } 61 | 62 | public void setUntracked(boolean untracked) { 63 | isUntracked = untracked; 64 | } 65 | 66 | public boolean isBeingTracked; 67 | public boolean isUntracked; 68 | public String selectedOrganizationName = ""; 69 | 70 | @Nullable 71 | @Override 72 | public ContrastFilterPersistentStateComponent getState() { 73 | return this; 74 | } 75 | 76 | @Override 77 | public void loadState(ContrastFilterPersistentStateComponent contrastFilterPersistentStateComponent) { 78 | XmlSerializerUtil.copyBean(contrastFilterPersistentStateComponent, this); 79 | } 80 | 81 | @Nullable 82 | public static ContrastFilterPersistentStateComponent getInstance(Project project) { 83 | return project.getService(ContrastFilterPersistentStateComponent.class); 84 | } 85 | 86 | public String getSelectedApplicationName() { 87 | return selectedApplicationName; 88 | } 89 | 90 | public void setSelectedApplicationName(String selectedApplicationName) { 91 | this.selectedApplicationName = selectedApplicationName; 92 | } 93 | 94 | public List getSeverities() { 95 | return severities; 96 | } 97 | 98 | public void setSeverities(List severities) { 99 | this.severities = new ArrayList<>(severities); 100 | } 101 | 102 | public String getLastDetected() { 103 | return lastDetected; 104 | } 105 | 106 | public void setLastDetected(String lastDetected) { 107 | this.lastDetected = lastDetected; 108 | } 109 | 110 | public Long getLastDetectedFrom() { 111 | return lastDetectedFrom; 112 | } 113 | 114 | public void setLastDetectedFrom(Long lastDetectedFrom) { 115 | this.lastDetectedFrom = lastDetectedFrom; 116 | } 117 | 118 | public Long getLastDetectedTo() { 119 | return lastDetectedTo; 120 | } 121 | 122 | public void setLastDetectedTo(Long lastDetectedTo) { 123 | this.lastDetectedTo = lastDetectedTo; 124 | } 125 | 126 | public List getStatuses() { 127 | return statuses; 128 | } 129 | 130 | public void setStatuses(List statuses) { 131 | this.statuses = new ArrayList<>(statuses); 132 | } 133 | 134 | public Integer getPage() { 135 | return page; 136 | } 137 | 138 | public void setPage(Integer page) { 139 | this.page = page; 140 | } 141 | 142 | public String getSort() { 143 | return sort; 144 | } 145 | 146 | public void setSort(String sort) { 147 | this.sort = sort; 148 | } 149 | 150 | public Long getSelectedServerUuid() { 151 | return selectedServerUuid; 152 | } 153 | 154 | public void setSelectedServerUuid(Long selectedServerUuid) { 155 | this.selectedServerUuid = selectedServerUuid; 156 | } 157 | 158 | public String getSelectedApplicationId() { 159 | return selectedApplicationId; 160 | } 161 | 162 | public void setSelectedApplicationId(String selectedApplicationId) { 163 | this.selectedApplicationId = selectedApplicationId; 164 | } 165 | 166 | public int getCurrentOffset() { 167 | return currentOffset; 168 | } 169 | 170 | public void setCurrentOffset(int currentOffset) { 171 | this.currentOffset = currentOffset; 172 | } 173 | 174 | public String getAppVersionTag() { 175 | return appVersionTag; 176 | } 177 | 178 | public void setAppVersionTag(final String appVersionTag) { 179 | this.appVersionTag = appVersionTag; 180 | } 181 | 182 | public String getSelectedOrganizationName() { 183 | return selectedOrganizationName; 184 | } 185 | 186 | public void setSelectedOrganizationName(String selectedOrganizationName) { 187 | this.selectedOrganizationName = selectedOrganizationName; 188 | } 189 | } 190 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/ui/com/contrastsecurity/ui/toolwindow/TagDialog.form: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 |
128 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/core/extended/EventResource.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.core.extended; 16 | 17 | import com.contrastsecurity.models.Event; 18 | import com.contrastsecurity.models.EventItem; 19 | import com.contrastsecurity.models.Parameter; 20 | import com.contrastsecurity.models.Stacktrace; 21 | 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | public class EventResource extends com.contrastsecurity.models.EventResource { 26 | public static final String RED = "RED"; 27 | public static final String CONTENT = "CONTENT"; 28 | public static final String CODE = "CODE"; 29 | public static final String BOLD = "BOLD"; 30 | public static final String CUSTOM_CODE = "CUSTOM_CODE"; 31 | public static final String CUSTOM_RED = "CUSTOM_RED"; 32 | 33 | //JSON Fields 34 | private String id; 35 | private boolean important; 36 | private String type; 37 | private String description; 38 | private int dupes; 39 | private String extraDetails; 40 | private View codeView; 41 | private View probableStartLocationView; 42 | private View dataView; 43 | 44 | private List collapsedEvents; 45 | 46 | //Internal use 47 | private com.contrastsecurity.models.Event event; 48 | private com.contrastsecurity.models.EventItem[] items; 49 | 50 | public String getId() { 51 | return this.id; 52 | } 53 | 54 | public void setId(String id) { 55 | this.id = id; 56 | } 57 | 58 | public boolean getImportant() { 59 | return this.important; 60 | } 61 | 62 | public void setImportant(boolean important) { 63 | this.important = important; 64 | } 65 | 66 | public String getType() { 67 | return this.type; 68 | } 69 | 70 | public void setType(String type) { 71 | this.type = type; 72 | } 73 | 74 | public String getDescription() { 75 | return this.description; 76 | } 77 | 78 | public void setDescription(String description) { 79 | this.description = description; 80 | } 81 | 82 | public int getDupes() { 83 | return dupes; 84 | } 85 | 86 | public void setDupes(int dupes) { 87 | this.dupes = dupes; 88 | } 89 | 90 | public String getExtraDetails() { 91 | return extraDetails; 92 | } 93 | 94 | public void setExtraDetails(String extraDetails) { 95 | this.extraDetails = extraDetails; 96 | } 97 | 98 | public List getCollapsedEvents() { 99 | return collapsedEvents; 100 | } 101 | 102 | public void setCollapsedEvents(List collapsedEvents) { 103 | this.collapsedEvents = collapsedEvents; 104 | } 105 | 106 | public View getCodeView() { 107 | return codeView; 108 | } 109 | 110 | public void setCodeView(View codeView) { 111 | this.codeView = codeView; 112 | } 113 | 114 | public View getProbableStartLocationView() { 115 | return probableStartLocationView; 116 | } 117 | 118 | public void setProbableStartLocationView(View probableStartLocationView) { 119 | this.probableStartLocationView = probableStartLocationView; 120 | } 121 | 122 | public View getDataView() { 123 | return dataView; 124 | } 125 | 126 | public void setDataView(View dataView) { 127 | this.dataView = dataView; 128 | } 129 | 130 | @Override 131 | public int hashCode() { 132 | final int prime = 31; 133 | int result = 1; 134 | result = prime * result + id.hashCode(); 135 | return result; 136 | } 137 | 138 | @Override 139 | public boolean equals(Object obj) { 140 | if (this == obj) 141 | return true; 142 | if (obj == null) 143 | return false; 144 | if (getClass() != obj.getClass()) 145 | return false; 146 | com.contrastsecurity.models.EventResource other = (com.contrastsecurity.models.EventResource) obj; 147 | if (id != other.getId()) 148 | return false; 149 | return true; 150 | } 151 | 152 | public com.contrastsecurity.models.Event getEvent() { 153 | return event; 154 | } 155 | 156 | public void setEvent(Event event) { 157 | this.event = event; 158 | } 159 | 160 | public com.contrastsecurity.models.EventItem[] getItems() { 161 | if (items == null) { 162 | if (event != null) { 163 | List eventItems = new ArrayList<>(); 164 | //EventItem eventItem = new EventItem(this, "", "at " + probableStartLocation, false); 165 | //eventItems.add(eventItem); 166 | com.contrastsecurity.models.EventItem eventItem = new com.contrastsecurity.models.EventItem(this, BOLD, "Class.Method", false); 167 | eventItems.add(eventItem); 168 | eventItem = new com.contrastsecurity.models.EventItem(this, CONTENT, event.getClazz() + '.' + event.getMethod(), false); 169 | eventItems.add(eventItem); 170 | eventItem = new com.contrastsecurity.models.EventItem(this, BOLD, "Object", false); 171 | eventItems.add(eventItem); 172 | eventItem = new com.contrastsecurity.models.EventItem(this, CONTENT, event.getfObject(), false); 173 | eventItems.add(eventItem); 174 | eventItem = new com.contrastsecurity.models.EventItem(this, BOLD, "Return", false); 175 | eventItems.add(eventItem); 176 | eventItem = new com.contrastsecurity.models.EventItem(this, CONTENT, event.getfReturn(), false); 177 | eventItems.add(eventItem); 178 | eventItem = new com.contrastsecurity.models.EventItem(this, BOLD, "Parameters", false); 179 | eventItems.add(eventItem); 180 | if (event.getParameters() != null) { 181 | for (Parameter paremeter : event.getParameters()) 182 | if (paremeter.getParameter() != null) { 183 | eventItem = new com.contrastsecurity.models.EventItem(this, CONTENT, paremeter.getParameter(), false); 184 | eventItems.add(eventItem); 185 | } 186 | } 187 | eventItem = new com.contrastsecurity.models.EventItem(this, BOLD, "Stack Trace", false); 188 | eventItems.add(eventItem); 189 | if (event.getStacktraces() != null) { 190 | boolean first = true; 191 | for (Stacktrace stacktrace : event.getStacktraces()) { 192 | if (first) { 193 | if (stacktrace.getType().equals("custom")) { 194 | eventItem = new com.contrastsecurity.models.EventItem(this, CUSTOM_RED, stacktrace.getDescription(), true); 195 | } else { 196 | eventItem = new com.contrastsecurity.models.EventItem(this, RED, stacktrace.getDescription(), true); 197 | } 198 | eventItems.add(eventItem); 199 | first = false; 200 | } else { 201 | if (stacktrace.getType().equals("custom")) { 202 | eventItem = new com.contrastsecurity.models.EventItem(this, CUSTOM_CODE, stacktrace.getDescription(), true); 203 | } else { 204 | eventItem = new com.contrastsecurity.models.EventItem(this, CODE, stacktrace.getDescription(), true); 205 | } 206 | eventItems.add(eventItem); 207 | first = false; 208 | } 209 | } 210 | } 211 | items = eventItems.toArray(new EventItem[0]); 212 | } 213 | } 214 | return items; 215 | } 216 | 217 | @Override 218 | public String toString() { 219 | return description; 220 | } 221 | } 222 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/ui/settings/ContrastSearchableConfigurableGUI.form: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 |
174 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 147 | # shellcheck disable=SC3045 148 | MAX_FD=$( ulimit -H -n ) || 149 | warn "Could not query maximum file descriptor limit" 150 | esac 151 | case $MAX_FD in #( 152 | '' | soft) :;; #( 153 | *) 154 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 155 | # shellcheck disable=SC3045 156 | ulimit -n "$MAX_FD" || 157 | warn "Could not set maximum file descriptor limit to $MAX_FD" 158 | esac 159 | fi 160 | 161 | # Collect all arguments for the java command, stacking in reverse order: 162 | # * args from the command line 163 | # * the main class name 164 | # * -classpath 165 | # * -D...appname settings 166 | # * --module-path (only if needed) 167 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 168 | 169 | # For Cygwin or MSYS, switch paths to Windows format before running java 170 | if "$cygwin" || "$msys" ; then 171 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 172 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 173 | 174 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 175 | 176 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 177 | for arg do 178 | if 179 | case $arg in #( 180 | -*) false ;; # don't mess with options #( 181 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 182 | [ -e "$t" ] ;; #( 183 | *) false ;; 184 | esac 185 | then 186 | arg=$( cygpath --path --ignore --mixed "$arg" ) 187 | fi 188 | # Roll the args list around exactly as many times as the number of 189 | # args, so each arg winds up back in the position where it started, but 190 | # possibly modified. 191 | # 192 | # NB: a `for` loop captures its iteration list before it begins, so 193 | # changing the positional parameters here affects neither the number of 194 | # iterations, nor the values presented in `arg`. 195 | shift # remove old arg 196 | set -- "$@" "$arg" # push replacement arg 197 | done 198 | fi 199 | 200 | # Collect all arguments for the java command; 201 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 202 | # shell script including quotes and variable substitutions, so put them in 203 | # double quotes to make sure that they get re-expanded; and 204 | # * put everything else in single quotes, so that it's not re-expanded. 205 | 206 | set -- \ 207 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 208 | -classpath "$CLASSPATH" \ 209 | org.gradle.wrapper.GradleWrapperMain \ 210 | "$@" 211 | 212 | # Stop when "xargs" is not available. 213 | if ! command -v xargs >/dev/null 2>&1 214 | then 215 | die "xargs is not available" 216 | fi 217 | 218 | # Use "xargs" to parse quoted args. 219 | # 220 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 221 | # 222 | # In Bash we could simply go: 223 | # 224 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 225 | # set -- "${ARGS[@]}" "$@" 226 | # 227 | # but POSIX shell has neither arrays nor command substitution, so instead we 228 | # post-process each arg (as a line of input to sed) to backslash-escape any 229 | # character that might be a shell metacharacter, then use eval to reverse 230 | # that process (while maintaining the separation between arguments), and wrap 231 | # the whole thing up as a single "set" statement. 232 | # 233 | # This will of course break if any of these variables contains a newline or 234 | # an unmatched quote. 235 | # 236 | 237 | eval "set -- $( 238 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 239 | xargs -n1 | 240 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 241 | tr '\n' ' ' 242 | )" '"$@"' 243 | 244 | exec "$JAVACMD" "$@" 245 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/ui/com/contrastsecurity/ui/toolwindow/TagDialog.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.ui.com.contrastsecurity.ui.toolwindow; 16 | 17 | import com.contrastsecurity.models.Tags; 18 | import com.contrastsecurity.models.TagsResponse; 19 | import org.apache.commons.lang.ArrayUtils; 20 | 21 | import javax.swing.DefaultComboBoxModel; 22 | import javax.swing.JButton; 23 | import javax.swing.JComboBox; 24 | import javax.swing.JComponent; 25 | import javax.swing.JDialog; 26 | import javax.swing.JPanel; 27 | import javax.swing.JTable; 28 | import javax.swing.JTextField; 29 | import javax.swing.KeyStroke; 30 | import javax.swing.table.AbstractTableModel; 31 | import java.awt.Dimension; 32 | import java.awt.Toolkit; 33 | import java.awt.event.ActionEvent; 34 | import java.awt.event.ActionListener; 35 | import java.awt.event.KeyEvent; 36 | import java.awt.event.MouseAdapter; 37 | import java.awt.event.MouseEvent; 38 | import java.awt.event.WindowAdapter; 39 | import java.awt.event.WindowEvent; 40 | import java.util.ArrayList; 41 | import java.util.Arrays; 42 | import java.util.List; 43 | 44 | public class TagDialog extends JDialog { 45 | private JPanel contentPane; 46 | private JButton buttonOK; 47 | private JButton buttonCancel; 48 | private JComboBox tagsComboBox; 49 | private JTextField newLabelTextField; 50 | private JButton applyNewLabelButton; 51 | private JTable tagTable; 52 | 53 | private TagsResponse viewDetailsTraceTagsResource; 54 | private TagsResponse orgTagsResource; 55 | private TagTableModel tagTableModel = new TagTableModel(); 56 | private ActionListener tagsComboBoxActionListener; 57 | private Tags newTraceTags = null; 58 | 59 | public TagDialog() { 60 | setContentPane(contentPane); 61 | setModal(true); 62 | getRootPane().setDefaultButton(buttonOK); 63 | 64 | buttonOK.addActionListener(new ActionListener() { 65 | public void actionPerformed(ActionEvent e) { 66 | onOK(); 67 | } 68 | }); 69 | 70 | buttonCancel.addActionListener(new ActionListener() { 71 | public void actionPerformed(ActionEvent e) { 72 | onCancel(); 73 | } 74 | }); 75 | 76 | // call onCancel() when cross is clicked 77 | setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); 78 | addWindowListener(new WindowAdapter() { 79 | public void windowClosing(WindowEvent e) { 80 | onCancel(); 81 | } 82 | }); 83 | 84 | // call onCancel() on ESCAPE 85 | contentPane.registerKeyboardAction(new ActionListener() { 86 | public void actionPerformed(ActionEvent e) { 87 | onCancel(); 88 | } 89 | }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); 90 | } 91 | 92 | public TagDialog(TagsResponse viewDetailsTraceTagsResource, TagsResponse orgTagsResource) { 93 | setContentPane(contentPane); 94 | setModal(true); 95 | getRootPane().setDefaultButton(buttonOK); 96 | 97 | buttonOK.addActionListener(new ActionListener() { 98 | public void actionPerformed(ActionEvent e) { 99 | onOK(); 100 | } 101 | }); 102 | 103 | buttonCancel.addActionListener(new ActionListener() { 104 | public void actionPerformed(ActionEvent e) { 105 | onCancel(); 106 | } 107 | }); 108 | 109 | // call onCancel() when cross is clicked 110 | setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); 111 | addWindowListener(new WindowAdapter() { 112 | public void windowClosing(WindowEvent e) { 113 | onCancel(); 114 | } 115 | }); 116 | 117 | // call onCancel() on ESCAPE 118 | contentPane.registerKeyboardAction(new ActionListener() { 119 | public void actionPerformed(ActionEvent e) { 120 | onCancel(); 121 | } 122 | }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); 123 | 124 | 125 | setSize(700, 300); 126 | final Toolkit toolkit = Toolkit.getDefaultToolkit(); 127 | final Dimension screenSize = toolkit.getScreenSize(); 128 | final int x = (screenSize.width - getWidth()) / 2; 129 | final int y = (screenSize.height - getHeight()) / 2; 130 | setLocation(x, y); 131 | setTitle("Tag Vulnerability"); 132 | 133 | tagsComboBoxActionListener = new ActionListener() { 134 | @Override 135 | public void actionPerformed(ActionEvent e) { 136 | String tag = tagsComboBox.getSelectedItem().toString(); 137 | applyTag(tag); 138 | } 139 | }; 140 | 141 | this.viewDetailsTraceTagsResource = viewDetailsTraceTagsResource; 142 | this.orgTagsResource = orgTagsResource; 143 | 144 | populateTagsComboBox(tagsComboBox, viewDetailsTraceTagsResource, orgTagsResource); 145 | 146 | tagsComboBox.addActionListener(tagsComboBoxActionListener); 147 | 148 | applyNewLabelButton.addActionListener(new ActionListener() { 149 | @Override 150 | public void actionPerformed(ActionEvent e) { 151 | String newTag = newLabelTextField.getText(); 152 | applyTag(newTag); 153 | } 154 | }); 155 | 156 | setupTable(tagTable, tagTableModel); 157 | String[] viewDetailsTraceTagsArray = viewDetailsTraceTagsResource.getTags().toArray(new String[viewDetailsTraceTagsResource.getTags().size()]); 158 | 159 | tagTableModel.setData(viewDetailsTraceTagsArray); 160 | tagTableModel.fireTableDataChanged(); 161 | } 162 | 163 | private void applyTag(String tag) { 164 | if (!tag.isEmpty()) { 165 | if (((DefaultComboBoxModel) tagsComboBox.getModel()).getIndexOf(tag) != -1) { 166 | tagsComboBox.removeItem(tag); 167 | } 168 | if (!newLabelTextField.getText().isEmpty()) { 169 | newLabelTextField.setText(""); 170 | } 171 | 172 | String[] data = tagTableModel.getData(); 173 | String[] newData = Arrays.copyOf(data, data.length + 1); 174 | newData[newData.length - 1] = tag; 175 | tagTableModel.setData(newData); 176 | tagTableModel.fireTableDataChanged(); 177 | } 178 | } 179 | 180 | private void removeTag(String tag) { 181 | if (viewDetailsTraceTagsResource.getTags().contains(tag) || orgTagsResource.getTags().contains(tag)) { 182 | tagsComboBox.removeActionListener(tagsComboBoxActionListener); 183 | tagsComboBox.addItem(tag); 184 | tagsComboBox.addActionListener(tagsComboBoxActionListener); 185 | } 186 | String[] newData = (String[]) ArrayUtils.removeElement(tagTableModel.getData(), tag); 187 | tagTableModel.setData(newData); 188 | tagTableModel.fireTableDataChanged(); 189 | } 190 | 191 | private void populateTagsComboBox(JComboBox jComboBox, TagsResponse viewDetailsTraceTagsResource, TagsResponse orgTagsResource) { 192 | 193 | List orgTags = orgTagsResource.getTags(); 194 | List traceTags = viewDetailsTraceTagsResource.getTags(); 195 | List tagsToAdd = new ArrayList<>(); 196 | 197 | for (String tag : orgTags) { 198 | if (!traceTags.contains(tag)) { 199 | tagsToAdd.add(tag); 200 | } 201 | } 202 | populateComboBox(jComboBox, tagsToAdd); 203 | } 204 | 205 | private void populateComboBox(JComboBox jComboBox, List items) { 206 | jComboBox.removeAllItems(); 207 | for (String item : items) { 208 | jComboBox.addItem(item); 209 | } 210 | } 211 | 212 | private void setupTable(JTable jTable, AbstractTableModel abstractTableModel) { 213 | jTable.setModel(abstractTableModel); 214 | jTable.addMouseListener(new MouseAdapter() { 215 | @Override 216 | public void mouseClicked(MouseEvent e) { 217 | int row = jTable.rowAtPoint(e.getPoint()); 218 | int col = jTable.columnAtPoint(e.getPoint()); 219 | 220 | if (row >= 0 && col >= 0) { 221 | String name = jTable.getColumnName(col); 222 | if (name.equals("Remove")) { 223 | String tag = (String) tagTableModel.getValueAt(row, 0); 224 | removeTag(tag); 225 | } 226 | } 227 | } 228 | }); 229 | } 230 | 231 | private void onOK() { 232 | // add your code here 233 | newTraceTags = new Tags(Arrays.asList(tagTableModel.getData())); 234 | dispose(); 235 | } 236 | 237 | private void onCancel() { 238 | // add your code here if necessary 239 | dispose(); 240 | } 241 | 242 | public static void main(String[] args) { 243 | TagDialog dialog = new TagDialog(); 244 | dialog.pack(); 245 | dialog.setVisible(true); 246 | System.exit(0); 247 | } 248 | 249 | public Tags getNewTraceTags() { 250 | return newTraceTags; 251 | } 252 | } 253 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/ui/settings/ContrastSearchableConfigurableGUI.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.ui.settings; 16 | 17 | import com.contrastsecurity.config.ChangeActionNotifier; 18 | import com.contrastsecurity.config.ContrastFilterPersistentStateComponent; 19 | import com.contrastsecurity.config.ContrastPersistentStateComponent; 20 | import com.contrastsecurity.config.ContrastUtil; 21 | import com.contrastsecurity.core.Constants; 22 | import com.contrastsecurity.exceptions.UnauthorizedException; 23 | import com.contrastsecurity.models.Organization; 24 | import com.contrastsecurity.models.Organizations; 25 | import com.contrastsecurity.sdk.ContrastSDK; 26 | import com.contrastsecurity.sdk.UserAgentProduct; 27 | import com.contrastsecurity.ui.com.contrastsecurity.ui.toolwindow.OrganizationTableModel; 28 | import com.intellij.ide.DataManager; 29 | import com.intellij.openapi.actionSystem.AnAction; 30 | import com.intellij.openapi.actionSystem.AnActionEvent; 31 | import com.intellij.openapi.actionSystem.CommonDataKeys; 32 | import com.intellij.openapi.actionSystem.DataContext; 33 | import com.intellij.openapi.application.ApplicationManager; 34 | import com.intellij.openapi.project.Project; 35 | import com.intellij.util.messages.MessageBus; 36 | import java.util.concurrent.ExecutionException; 37 | import java.util.concurrent.TimeoutException; 38 | import org.apache.commons.lang.ArrayUtils; 39 | import org.apache.commons.lang.StringUtils; 40 | 41 | import javax.swing.JButton; 42 | import javax.swing.JLabel; 43 | import javax.swing.JPanel; 44 | import javax.swing.JPasswordField; 45 | import javax.swing.JTable; 46 | import javax.swing.JTextField; 47 | import javax.swing.ListSelectionModel; 48 | import java.io.IOException; 49 | import java.io.InputStream; 50 | import java.net.MalformedURLException; 51 | import java.net.Proxy; 52 | import java.net.URL; 53 | import java.util.HashMap; 54 | import java.util.Map; 55 | import java.util.Properties; 56 | 57 | public class ContrastSearchableConfigurableGUI { 58 | 59 | private final ContrastPersistentStateComponent contrastPersistentStateComponent; 60 | private final ContrastFilterPersistentStateComponent contrastFilterPersistentStateComponent; 61 | private JPanel contrastSettingsPanel; 62 | private JTextField teamServerTextField; 63 | private JTextField usernameTextField; 64 | private JTextField serviceKeyTextField; 65 | private JButton addButton; 66 | private JButton deleteButton; 67 | private JPasswordField apiKeyTextField; 68 | private JTextField uuidTextField; 69 | private JLabel testConnectionLabel; 70 | private JTable organizationTable; 71 | private Map organizations = new HashMap<>(); 72 | private OrganizationTableModel organizationTableModel = new OrganizationTableModel(); 73 | 74 | public ContrastSearchableConfigurableGUI() throws ExecutionException, TimeoutException { 75 | 76 | DataContext dataContext = DataManager.getInstance().getDataContextFromFocusAsync().blockingGet(200); 77 | 78 | assert dataContext != null; 79 | Project project = dataContext.getData(CommonDataKeys.PROJECT); 80 | 81 | assert project != null; 82 | contrastFilterPersistentStateComponent = ContrastFilterPersistentStateComponent.getInstance(project); 83 | contrastPersistentStateComponent = ContrastPersistentStateComponent.getInstance(); 84 | 85 | organizationTable.setModel(organizationTableModel); 86 | organizationTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 87 | 88 | populateFieldsWithValuesFromContrastPersistentStateComponent(); 89 | 90 | addButton.addActionListener(e -> { 91 | final String url = getTeamServerUrl(); 92 | final String username = usernameTextField.getText().trim(); 93 | final String serviceKey = serviceKeyTextField.getText().trim(); 94 | final String apiKey = new String(apiKeyTextField.getPassword()).trim(); 95 | final String uuid = uuidTextField.getText().trim(); 96 | 97 | URL u; 98 | try { 99 | u = new URL(url); 100 | } catch (MalformedURLException e1) { 101 | testConnectionLabel.setText("Connection failed!"); 102 | return; 103 | } 104 | if (!u.getProtocol().startsWith("http")) { 105 | testConnectionLabel.setText("Connection failed!"); 106 | return; 107 | } 108 | 109 | Proxy proxy = ContrastUtil.getIdeaDefinedProxy(getTeamServerUrl()) != null 110 | ? ContrastUtil.getIdeaDefinedProxy(getTeamServerUrl()) : Proxy.NO_PROXY; 111 | 112 | InputStream ins = ContrastUtil.class.getClassLoader().getResourceAsStream("contrast.properties"); 113 | Properties gradleProperty = new Properties(); 114 | try { 115 | gradleProperty.load(ins); 116 | } catch (IOException ioException) { 117 | ioException.printStackTrace(); 118 | } 119 | 120 | 121 | ContrastSDK sdk = new ContrastSDK.Builder(username, serviceKey, apiKey) 122 | .withApiUrl(url) 123 | .withProxy(proxy) 124 | .withUserAgentProduct(UserAgentProduct.of("INTELLIJ_INTEGRATION", gradleProperty.getProperty("version"))) 125 | .build(); 126 | 127 | try { 128 | Organizations orgs = sdk.getProfileOrganizations(); 129 | 130 | if (orgs != null && orgs.getOrganizations() != null && !orgs.getOrganizations().isEmpty()) { 131 | for (Organization organization : orgs.getOrganizations()) { 132 | if (organization.getOrgUuid().equalsIgnoreCase(uuid)) { 133 | 134 | organizations.putIfAbsent(organization.getName(), url + Constants.DELIMITER + username + 135 | Constants.DELIMITER + serviceKey + Constants.DELIMITER + apiKey + 136 | Constants.DELIMITER + uuid); 137 | 138 | String[] orgsArray = organizations.keySet().toArray(new String[organizations.keySet().size()]); 139 | organizationTableModel.setData(orgsArray); 140 | organizationTableModel.fireTableDataChanged(); 141 | 142 | int indexOfSelectedOrgName = ArrayUtils.indexOf(orgsArray, organization.getName()); 143 | organizationTable.setRowSelectionInterval(indexOfSelectedOrgName, indexOfSelectedOrgName); 144 | 145 | teamServerTextField.setText(Constants.TEAM_SERVER_URL_VALUE); 146 | usernameTextField.setText(""); 147 | serviceKeyTextField.setText(""); 148 | apiKeyTextField.setText(""); 149 | uuidTextField.setText(""); 150 | testConnectionLabel.setText(""); 151 | 152 | break; 153 | } 154 | } 155 | } 156 | } catch (IOException | UnauthorizedException e1) { 157 | testConnectionLabel.setText("Connection failed! " + e1.getMessage()); 158 | } catch (Exception e1) { 159 | testConnectionLabel.setText("Connection failed! Check Team Server URL."); 160 | } 161 | }); 162 | 163 | deleteButton.addActionListener(e -> { 164 | String selectedOrganization = getSelectedTableValue(organizationTable); 165 | if (selectedOrganization != null) { 166 | if (organizations.get(selectedOrganization) != null) { 167 | organizations.remove(selectedOrganization); 168 | } 169 | 170 | String[] newData = (String[]) ArrayUtils.removeElement(organizationTableModel.getData(), selectedOrganization); 171 | organizationTableModel.setData(newData); 172 | organizationTableModel.fireTableDataChanged(); 173 | 174 | if (newData.length > 0) { 175 | organizationTable.setRowSelectionInterval(0, 0); 176 | } 177 | } 178 | }); 179 | 180 | teamServerTextField.setText(Constants.TEAM_SERVER_URL_VALUE); 181 | } 182 | 183 | private String getTeamServerUrl() { 184 | String url = teamServerTextField.getText().trim(); 185 | if (url.endsWith("/")) { 186 | url = url.substring(0, url.length() - 1); 187 | } 188 | if (!url.endsWith("/Contrast/api")) { 189 | if (!url.endsWith("/Contrast")) { 190 | url += "/Contrast"; 191 | } 192 | url += "/api"; 193 | } 194 | return url; 195 | } 196 | 197 | public JPanel getContrastSettingsPanel() { 198 | return contrastSettingsPanel; 199 | } 200 | 201 | private void populateFieldsWithValuesFromContrastPersistentStateComponent() { 202 | Map orgs = contrastPersistentStateComponent.getOrganizations(); 203 | 204 | if (orgs.isEmpty()) { 205 | organizations = new HashMap<>(); 206 | organizationTableModel.setData(new String[0]); 207 | organizationTableModel.fireTableDataChanged(); 208 | } else { 209 | // Create a copy of organizations map from ContrastPersistentStateComponent class 210 | // It will be compared with the original in isModified() method 211 | organizations = new HashMap<>(); 212 | organizations.putAll(orgs); 213 | 214 | String[] orgsArray = organizations.keySet().toArray(new String[organizations.keySet().size()]); 215 | organizationTableModel.setData(orgsArray); 216 | organizationTableModel.fireTableDataChanged(); 217 | 218 | String selectedOrganization = organizations.get(contrastFilterPersistentStateComponent.getSelectedOrganizationName()); 219 | if (StringUtils.isNotBlank(contrastFilterPersistentStateComponent.getSelectedOrganizationName()) 220 | && selectedOrganization != null) { 221 | // if selectedOrganization is not null, set it as selected in organizationTable 222 | String selectedOrgName = contrastFilterPersistentStateComponent.getSelectedOrganizationName(); 223 | int indexOfSelectedOrgName = ArrayUtils.indexOf(orgsArray, selectedOrgName); 224 | organizationTable.setRowSelectionInterval(indexOfSelectedOrgName, indexOfSelectedOrgName); 225 | } 226 | } 227 | } 228 | 229 | public boolean isModified() { 230 | boolean modified = false; 231 | if (getSelectedTableValue(organizationTable) != null) { 232 | modified |= !getSelectedTableValue(organizationTable).equals(contrastFilterPersistentStateComponent.getSelectedOrganizationName()); 233 | } 234 | modified |= !organizations.equals(contrastPersistentStateComponent.getOrganizations()); 235 | return modified; 236 | } 237 | 238 | public void apply() { 239 | contrastPersistentStateComponent.setOrganizations(organizations); 240 | doChange(); 241 | } 242 | 243 | private void doChange() { 244 | MessageBus bus = ApplicationManager.getApplication().getMessageBus(); 245 | ChangeActionNotifier publisher = bus.syncPublisher(ChangeActionNotifier.CHANGE_ACTION_TOPIC); 246 | publisher.beforeAction(); 247 | try { 248 | contrastFilterPersistentStateComponent.setSelectedOrganizationName(getSelectedTableValue(organizationTable)); 249 | } finally { 250 | publisher.afterAction(); 251 | } 252 | } 253 | 254 | public void reset() { 255 | populateFieldsWithValuesFromContrastPersistentStateComponent(); 256 | } 257 | 258 | private String getSelectedTableValue(JTable jTable) { 259 | if (jTable.getSelectedRow() == -1) { 260 | return null; 261 | } 262 | 263 | return (String) jTable.getValueAt(jTable.getSelectedRow(), 0); 264 | } 265 | } 266 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/core/Constants.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2017 Contrast Security. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under 6 | * the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License. 8 | * 9 | * The terms of the GNU GPL version 3 which accompanies this distribution 10 | * and is available at https://www.gnu.org/licenses/gpl-3.0.en.html 11 | * 12 | * Contributors: 13 | * Contrast Security - initial API and implementation 14 | *******************************************************************************/ 15 | package com.contrastsecurity.core; 16 | 17 | import java.awt.*; 18 | 19 | public final class Constants { 20 | public static final String TEAM_SERVER_URL = "contrast.we.url"; 21 | public static final String TEAM_SERVER_URL_VALUE = "https://app.contrastsecurity.com/Contrast/api"; 22 | public static final String SERVICE_KEY = "service.key"; 23 | public static final String API_KEY = "api.key"; 24 | public static final String USERNAME = "username"; 25 | public static final String ORGNAME = "orgname"; 26 | public static final String ORGUUID = "orguuid"; 27 | public static final String SERVER_ID = "serverId"; 28 | public static final String APPLICATION_ID = "applicationId"; 29 | public static final long ALL_SERVERS = -1L; 30 | public static final String ALL_APPLICATIONS = "All applications"; 31 | public static final String BLANK = ""; 32 | public static final String MUSTACHE_NL = "{{{nl}}}"; 33 | public static final String UNLICENSED = "{{#unlicensed}}"; 34 | private static final String OPEN_TAG_PARAGRAPH = "{{#paragraph}}"; 35 | private static final String CLOSE_TAG_PARAGRAPH = "{{/paragraph}}"; 36 | public static final String OPEN_TAG_LINK = "{{#link}}"; 37 | public static final String CLOSE_TAG_LINK = "{{/link}}"; 38 | public static final String OPEN_TAG_BAD_PARAM = "{{#badParam}}"; 39 | public static final String CLOSE_TAG_BAD_PARAM = "{{/badParam}}"; 40 | public static final String OPEN_TAG_JAVA_BLOCK = "{{#javaBlock}}"; 41 | public static final String CLOSE_TAG_JAVA_BLOCK = "{{/javaBlock}}"; 42 | public static final String OPEN_TAG_GOOD_PARAM = "{{#goodParam}}"; 43 | public static final String CLOSE_TAG_GOOD_PARAM = "{{/goodParam}}"; 44 | public static final String OPEN_TAG_C_SHARP_BLOCK = "{{#csharpBlock}}"; 45 | public static final String CLOSE_TAG_C_SHARP_BLOCK = "{{/csharpBlock}}"; 46 | public static final String OPEN_TAG_HTML_BLOCK = "{{#htmlBlock}}"; 47 | public static final String CLOSE_TAG_HTML_BLOCK = "{{/htmlBlock}}"; 48 | public static final String OPEN_TAG_JAVASCRIPT_BLOCK = "{{#javascriptBlock}}"; 49 | public static final String CLOSE_TAG_JAVASCRIPT_BLOCK = "{{/javascriptBlock}}"; 50 | public static final String OPEN_TAG_XML_BLOCK = "{{#xmlBlock}}"; 51 | public static final String CLOSE_TAG_XML_BLOCK = "{{/xmlBlock}}"; 52 | private static final String OPEN_TAG_HEADER = "{{#header}}"; 53 | private static final String CLOSE_TAG_HEADER = "{{/header}}"; 54 | private static final String LINK_TAG_1 = "{{link1}}"; 55 | private static final String LINK_TAG_2 = "{{link2}}"; 56 | private static final String OPEN_TAG_CODE = "{{#code}}"; 57 | private static final String CLOSE_TAG_CODE = "{{/code}}"; 58 | private static final String OPEN_TAG_P = "{{#p}}"; 59 | private static final String CLOSE_TAG_P = "{{/p}}"; 60 | private static final String OPEN_TAG_UNORDERED_LIST = "{{#unorderedList}}"; 61 | private static final String CLOSE_TAG_UNORDERED_LIST = "{{/unorderedList}}"; 62 | private static final String OPEN_TAG_LIST_ELEMENT = "{{#listElement}}"; 63 | private static final String CLOSE_TAG_LIST_ELEMENT = "{{/listElement}}"; 64 | private static final String OPEN_TAG_FOCUS = "{{#focus}}"; 65 | private static final String CLOSE_TAG_FOCUS = "{{/focus}}"; 66 | private static final String OPEN_TAG_BAD_CONFIG = "{{#badConfig}}"; 67 | private static final String CLOSE_TAG_BAD_CONFIG = "{{/badConfig}}"; 68 | private static final String OPEN_TAG_BLOCK = "{{#block}}"; 69 | private static final String CLOSE_TAG_BLOCK = "{{/block}}"; 70 | private static final String OPEN_TAG_BLOCK_QUOTE = "{{#blockQuote}}"; 71 | private static final String CLOSE_TAG_BLOCK_QUOTE = "{{/blockQuote}}"; 72 | private static final String OPEN_TAG_EMPHASIZE = "{{#emphasize}}"; 73 | private static final String CLOSE_TAG_EMPHASIZE = "{{/emphasize}}"; 74 | private static final String OPEN_TAG_EXAMPLE_TEXT = "{{#exampleText}}"; 75 | private static final String CLOSE_TAG_EXAMPLE_TEXT = "{{/exampleText}}"; 76 | private static final String OPEN_TAG_GOOD_CONFIG = "{{#goodConfig}}"; 77 | private static final String CLOSE_TAG_GOOD_CONFIG = "{{/goodConfig}}"; 78 | private static final String OPEN_TAG_ORDERED_LIST = "{{#orderedList}}"; 79 | private static final String CLOSE_TAG_ORDERED_LIST = "{{/orderedList}}"; 80 | private static final String OPEN_TAG_RISK_EVIDENCE = "{{#riskEvidence}}"; 81 | private static final String CLOSE_TAG_RISK_EVIDENCE = "{{/riskEvidence}}"; 82 | private static final String OPEN_TAG_TABLE = "{{#table}}"; 83 | private static final String CLOSE_TAG_TABLE = "{{/table}}"; 84 | private static final String OPEN_TAG_TABLE_BODY = "{{#tableBody}}"; 85 | private static final String CLOSE_TAG_TABLE_BODY = "{{/tableBody}}"; 86 | private static final String OPEN_TAG_TABLE_CELL = "{{#tableCell}}"; 87 | private static final String CLOSE_TAG_TABLE_CELL = "{{/tableCell}}"; 88 | private static final String OPEN_TAG_TABLE_CELL_ALT = "{{#tableCellAlt}}"; 89 | private static final String CLOSE_TAG_TABLE_CELL_ALT = "{{/tableCellAlt}}"; 90 | private static final String OPEN_TAG_TABLE_HEADER = "{{#tableHeader}}"; 91 | private static final String CLOSE_TAG_TABLE_HEADER = "{{/tableHeader}}"; 92 | private static final String OPEN_TAG_TABLE_HEADER_ROW = "{{#tableHeaderRow}}"; 93 | private static final String CLOSE_TAG_TABLE_HEADER_ROW = "{{/tableHeaderRow}}"; 94 | private static final String OPEN_TAG_TABLE_ROW = "{{#tableRow}}"; 95 | private static final String CLOSE_TAG_TABLE_ROW = "{{/tableRow}}"; 96 | 97 | public static final String[] MUSTACHE_CONSTANTS = {OPEN_TAG_CODE, CLOSE_TAG_CODE, OPEN_TAG_P, CLOSE_TAG_P, OPEN_TAG_PARAGRAPH, 98 | CLOSE_TAG_PARAGRAPH, OPEN_TAG_LINK, CLOSE_TAG_LINK, OPEN_TAG_HEADER, CLOSE_TAG_HEADER, LINK_TAG_1, 99 | LINK_TAG_2, MUSTACHE_NL, OPEN_TAG_UNORDERED_LIST, CLOSE_TAG_UNORDERED_LIST, OPEN_TAG_LIST_ELEMENT, 100 | CLOSE_TAG_LIST_ELEMENT, OPEN_TAG_FOCUS, CLOSE_TAG_FOCUS, OPEN_TAG_BAD_CONFIG, CLOSE_TAG_BAD_CONFIG, 101 | OPEN_TAG_BLOCK, CLOSE_TAG_BLOCK, OPEN_TAG_BLOCK_QUOTE, CLOSE_TAG_BLOCK_QUOTE, OPEN_TAG_EMPHASIZE, 102 | CLOSE_TAG_EMPHASIZE, OPEN_TAG_EXAMPLE_TEXT, CLOSE_TAG_EXAMPLE_TEXT, OPEN_TAG_GOOD_CONFIG, 103 | CLOSE_TAG_GOOD_CONFIG, OPEN_TAG_ORDERED_LIST, CLOSE_TAG_ORDERED_LIST, OPEN_TAG_RISK_EVIDENCE, 104 | CLOSE_TAG_RISK_EVIDENCE, OPEN_TAG_TABLE, CLOSE_TAG_TABLE, OPEN_TAG_TABLE_BODY, CLOSE_TAG_TABLE_BODY, 105 | OPEN_TAG_TABLE_CELL, CLOSE_TAG_TABLE_CELL, OPEN_TAG_TABLE_CELL_ALT, CLOSE_TAG_TABLE_CELL_ALT, 106 | OPEN_TAG_TABLE_HEADER, CLOSE_TAG_TABLE_HEADER, OPEN_TAG_TABLE_HEADER_ROW, CLOSE_TAG_TABLE_HEADER_ROW, 107 | OPEN_TAG_TABLE_ROW, CLOSE_TAG_TABLE_ROW}; 108 | 109 | public static final String ORGANIZATION_LIST = "organizationList"; 110 | public static final String DELIMITER = ";"; 111 | 112 | // #0DA1A9 113 | public static final Color LINK_COLOR = new Color(13, 161, 169); 114 | // #969494 115 | public static final Color UNLICENSED_COLOR = new Color(150, 148, 148); 116 | // #bfbfbf 117 | public static final Color RULE_COLOR = new Color(191, 191, 191); 118 | public static final int REFRESH_DELAY = 5 * 60 * 1000; // 5 minutes 119 | // green - #aecd43 (r=174, g=205, b=67) 120 | // yellow - #f7b600 (r=247, g=182, b=0) 121 | // red - #e63025 (r=230, g=48, b=37) 122 | public static final Color CREATION_COLOR = new Color(230, 48, 37); 123 | public static final Color P20_COLOR = new Color(247, 182, 0); 124 | public static final Color TAG_COLOR = new Color(174, 205, 67); 125 | public static final Color GOOD_PARAM_COLOR = new Color(0, 128, 0); 126 | // #165BAD 127 | public static final Color LINK_COLOR2 = new Color(22, 91, 173); 128 | // #999999 129 | public static final Color CONTENT_COLOR = new Color(153, 153, 153); 130 | // #1b7eb1 27,126,177 131 | public static final Color CODE_COLOR = new Color(27, 126, 177); 132 | // #e0f2ef 133 | 134 | public static final Color ITEM_BACKGROUND_COLOR = new Color(224, 242, 239); 135 | 136 | public static final Color EVENT_TYPE_ICON_COLOR_CREATION = new Color(247, 182, 0); 137 | public static final Color EVENT_TYPE_ICON_COLOR_PROPAGATION = new Color(153, 153, 153); 138 | public static final Color EVENT_TYPE_ICON_COLOR_TRIGGER = new Color(230, 48, 37); 139 | 140 | 141 | public static final String TAINT = "{{#taint}}"; 142 | public static final String TAINT_CLOSED = "{{/taint}}"; 143 | public static final String SPAN_OPENED = " 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 |
322 | -------------------------------------------------------------------------------- /src/main/java/com/contrastsecurity/ui/com/contrastsecurity/ui/toolwindow/ContrastToolWindow.form: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 |
355 | --------------------------------------------------------------------------------