Skip to content

Commit

Permalink
Merge pull request #57 from cfclavijo/integration
Browse files Browse the repository at this point in the history
Adding support for jira server v8.2*
  • Loading branch information
cfclavijo authored Oct 7, 2019
2 parents da0e001 + 07d3275 commit b802421
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 67 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ Cloud Insight Add-on for JIRA

The Cloud Insight Add-on for JIRA integrates Cloud Insight remediations as JIRA issues, which allows you to configure, manage, and assign issues to JIRA teams. JIRA team members can use the add-on to review, and then dispose assigned remediations.

##Supported JIRA Versions
## Supported JIRA Versions
* From 6.3.9 to 6.4.12 the download link [jar file](https://github.com/alertlogic/ci_jira/tree/for_jira_version_6/download).
* 7.0.0 the download link [jar file](https://github.com/alertlogic/ci_jira/tree/for_jira_version_7/download)

##Add-on Install User Guide
## Add-on Install User Guide

See [Install user guide here](INSTALL.md).

##Add-on Developer Environment Installation
## Add-on Developer Environment Installation

Configure the environment as directed in the follow guide:
https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project
Expand All @@ -25,7 +25,7 @@ https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin
* In the console, run the following command:
`atlas-run`

##Other commands:
## Other commands:

* `atlas-run`: installs this add-on into the product, and starts it on localhost
* `atlas-debug`: same as `atlas-run,` and allows a debugger to attach at port 5005
Expand Down
Binary file added download/jira-cloud-insight-7.2.3.0-SNAPSHOT.jar
Binary file not shown.
97 changes: 58 additions & 39 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.alertlogic.plugins.jira.cloudinsight</groupId>
<artifactId>jira-cloud-insight</artifactId>
<version>7.2.2.8-SNAPSHOT</version>
<version>7.2.3.0-SNAPSHOT</version>

<organization>
<name>Alert logic</name>
<url>https://www.alertlogic.com/</url>
</organization>

<name>cloud-insight-for-jira</name>
<description>
The Cloud Insight add-on for Jira integrates Cloud Insight remediations as Jira issues, which allows you to configure, manage, and assign issues to Jira teams. Jira team members can use the add-on to review, and then dispose assigned remediations.
</description>
<packaging>atlassian-plugin</packaging>
<!--repositories>
<repository>
<id>atlassian-public</id>
<url>https://maven.atlassian.com/repository/public</url>
</repository>
</repositories-->

<dependencies>
<dependency>
<groupId>com.atlassian.jira</groupId>
Expand All @@ -37,14 +37,6 @@
<scope>provided</scope>
</dependency>

<!-- Add dependency for customising project template. 2.18 just for the add-on in version jira 6-->
<!--dependency>
<groupId>com.atlassian.jira.plugins</groupId>
<artifactId>project-templates-api</artifactId>
<version>2.18</version>
<scope>provided</scope>
</dependency -->

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down Expand Up @@ -107,19 +99,15 @@
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>${jersey.version}</version>
<scope>provided</scope>
</dependency>
<!--is a client http -->
<!--dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-bundle</artifactId>
<version>1.8</version>
</dependency-->

<!--JSON jersey is for get the object by name from java interacting with jsons-->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20141113</version>
<scope>provided</scope>
</dependency>

<!--This for work with listeners on issues-->
Expand Down Expand Up @@ -154,7 +142,7 @@
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>compile</scope>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand All @@ -165,7 +153,7 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1.1</version>
<version>4.3.6</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -214,18 +202,20 @@
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<artifactId>jira-maven-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<instructions>
<!-- OSGi instructions go here -->
<Export-Package>
com.alertlogic.plugins.jira.cloudinsight*;version="7.2.2.8"
</Export-Package>
</instructions>
<!-- OSGi instructions go here -->
<Export-Package>
com.alertlogic.plugins.jira.cloudinsight,
</Export-Package>
<!-- Ensure plugin is spring powered -->
<Spring-Context>*</Spring-Context>
</instructions>
<!-- Uncomment to install TestKit backdoor in JIRA. -->
<!--
<pluginArtifacts>
Expand All @@ -236,6 +226,11 @@
</pluginArtifact>
</pluginArtifacts>
-->
<!-- Testing -->
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
<jvmArgs>-Dplugin.resource.directories=/src/main/resources</jvmArgs>
<!-- /Testing -->
<pluginArtifacts>
<pluginArtifact>
<groupId>com.atlassian.activeobjects</groupId>
Expand All @@ -251,26 +246,50 @@
<log4jProperties>src/aps/log4j.properties</log4jProperties>
</configuration>
</plugin>
<!-- <plugin> -->
<!-- <artifactId>maven-compiler-plugin</artifactId> -->
<!-- <!-\- the next line is to avoid a warning-\-> -->
<!-- <version>3.8.1</version> -->
<!-- <configuration> -->
<!-- <source>1.7</source> -->
<!-- <target>1.7</target> -->
<!-- </configuration> -->
<!-- </plugin> -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<!-- the next line is for avoid a warning-->
<version>3.3</version>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<source>1.6</source>
<target>1.6</target>
<scannedDependencies>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-external-jar</artifactId>
</dependency>
</scannedDependencies>
<verbose>false</verbose>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jira.version>7.0.0</jira.version>
<amps.version>5.1.16</amps.version>
<jira.version>8.2.3</jira.version>
<amps.version>8.0.2</amps.version>
<plugin.testrunner.version>2.0.1</plugin.testrunner.version>
<ao.version>1.0.0</ao.version>
<jersey.version>1.8-atlassian-15</jersey.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
<!-- TestKit version 6.x for JIRA 6.x -->
<testkit.version>6.3.11</testkit.version>
<!-- this next line is for avoid a warning -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
2 changes: 1 addition & 1 deletion src/aps/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# To turn more verbose logging on - change "WARN" to "DEBUG"

log4j.rootLogger=WARN, console, filelog
log4j.rootLogger=INFO, console, filelog

#####################################################
# LOG FILE LOCATIONS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public EnvironmentsService( PluginConfigService pluginConfigService, RestUtil re
*/
public JSONObject getAllEnvironments(String jiraUser) throws Exception{
restUtil.setupAuthetication( jiraUser );
String urlBase = restUtil.urlEndPointSource + "?source.config.aws.defender_support=!true&source.type=environment&source.config.collection_type=aws&source.config.collection_method=api";
String urlBase = restUtil.urlEndPointSource + "?source.config.aws.defender_support=!true&source.config.azure.defender_support=!true&source.config.datacenter.defender_support=!true&source.type=environment&source.config.collection_type=aws,azure,datacenter&source.config.collection_method=api";

ClientResponse responseGetEnvironments;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.atlassian.jira.bc.issue.IssueService;
import com.atlassian.jira.bc.issue.IssueService.IssueResult;
import com.atlassian.jira.bc.issue.IssueService.TransitionValidationResult;
import com.atlassian.jira.bc.issue.search.SearchService;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.IssueInputParameters;
Expand Down Expand Up @@ -92,16 +93,16 @@ public List<Issue> searchIssueByRemeditionItem(String remediationItemValue, Stri
try {
screenConfigService.assigValuesToVariables();
CustomField remediationItemCustomField = screenConfigService.getRemediationItemCustomField();
SearchProvider searchProvider = ComponentAccessor.getComponentOfType(SearchProvider.class);
SearchService searchService = ComponentAccessor.getComponentOfType(SearchService.class);

JqlQueryBuilder builder = JqlQueryBuilder.newBuilder();
ApplicationUser user = ComponentAccessor.getUserManager().getUserByName( userName );
logginUser( user );

builder.where().customField(remediationItemCustomField.getIdAsLong()).like( remediationItemValue );

SearchResults results = searchProvider.search(builder.buildQuery(), user, PagerFilter.getUnlimitedFilter() , null);
return results.getIssues();
SearchResults<Issue> results = searchService.search(user, builder.buildQuery(), PagerFilter.getUnlimitedFilter());
return results.getResults();
} catch (Exception e) {
log.error("CI Plugin:"+e.toString());
e.printStackTrace();
Expand Down Expand Up @@ -360,4 +361,4 @@ public JSONObject getGroups(){

return groupsJSON;
}
}
}
4 changes: 2 additions & 2 deletions src/main/resources/atlassian-plugin-marketing.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!--Describe names and versions of compatible applications -->
<compatibility>
<product name="jira" min="6.3.9" max="6.4.12"/>
<product name="jira" min="7.13.0" max="8.2.3"/>
</compatibility>

<!-- Describe your add-on logo and banner. The banner is only displayed in the UPM. -->
Expand All @@ -19,4 +19,4 @@
<screenshot image="images/marketing/10_rule.png"/>
<screenshot image="images/marketing/11_rules_details.png"/>
</screenshots>
</atlassian-plugin-marketing>
</atlassian-plugin-marketing>
Original file line number Diff line number Diff line change
Expand Up @@ -128,33 +128,32 @@ function remediationDetailsController( issueId ) {
lastElementSelected[ key ] = value;
return false;
}
}
};

/**
* Review if a row sloud be shown or hide
* Review if a row should be shown or hide
* @param {string} key element key
* @param {string} item filtered it can be (vulnerabilities,evidences,assets)
*/
self.shoulBeFiltered = function( key, filter){

if( lastElementSelected.vulnerability && filter != 'vulnerabilities'){
if( remediationComplements.vulnerabilities.hasOwnProperty( lastElementSelected.vulnerability ) ){
if( remediationComplements.vulnerabilities[ lastElementSelected.vulnerability ][ filter ].indexOf( key ) == -1){
return true
return true;
}
}
}
if( lastElementSelected.evidence && filter != 'evidences'){
if( remediationComplements.evidences.hasOwnProperty( lastElementSelected.evidence ) ){
if( remediationComplements.evidences[ lastElementSelected.evidence ][ filter ].indexOf( key ) == -1){
return true
return true;
}
}
}
if( lastElementSelected.asset && filter != 'assets'){
if( remediationComplements.assets.hasOwnProperty( lastElementSelected.asset ) ){
if( remediationComplements.assets[ lastElementSelected.asset ][ filter ].indexOf( key ) == -1){
return true
return true;
}
}
}
Expand Down Expand Up @@ -235,9 +234,9 @@ function remediationDetailsController( issueId ) {
html += "<div class='" + classCss + " vulnerabilities-row'>"+ vul.description + "</div>";
html += "<div class='detailsVulnerability hidden'>";
html += "<p><strong>"+ labelImpact +"</strong></p>";
html += "<span><small>" + vul.impact + "</small></span>";
html += "<span><small>" + AUIUtils.htmlLize(vul.impact) + "</small></span>";
html += "<p><strong>"+ labelResolution + "</strong></p>";
html += "<span><small>" + vul.resolution + "</small></span>";
html += "<span><small>" + AUIUtils.htmlLize(vul.resolution) + "</small></span>";
html += "</div>";
html += "</div>";

Expand Down Expand Up @@ -479,7 +478,7 @@ function remediationDetailsController( issueId ) {
description.fail( function() {
assetsAffected.done( function( data ){
remediationDetails.basic = remediationSupportService.getDescriptionFromAssets ( data , remediationKey );
})
});
assetsAffected.fail( function(){
self.showError( '#detailsPanel', AJS.I18n.getText("ci.partials.remediationdetails.js.error.description.notfound") );
});
Expand Down Expand Up @@ -590,4 +589,4 @@ function remediationDetailsController( issueId ) {
});
}
);
}
}
4 changes: 2 additions & 2 deletions src/main/resources/js/services/EnvironmentsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var EnvironmentsService = function() {
var urlBase = ciAIMSService.getSessionData().endpoint
+"/sources/"+configService.serviceVersion
+"/"+ciAIMSService.getSessionData().accountId
+"/sources?source.config.aws.defender_support=!true&source.type=environment&source.config.collection_type=aws&source.config.collection_method=api";
+"/sources?source.config.aws.defender_support=!true&source.config.azure.defender_support=!true&source.config.datacenter.defender_support=!true&source.type=environment&source.config.collection_type=aws,azure,datacenter&source.config.collection_method=api";

AJS.$.ajax({
type: "GET",
Expand Down Expand Up @@ -48,4 +48,4 @@ var EnvironmentsService = function() {
/**
* Creates the service instance.
*/
var environmentsService = new EnvironmentsService();
var environmentsService = new EnvironmentsService();
Loading

0 comments on commit b802421

Please sign in to comment.