Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@enterprise-cmcs/macpro-security-hub-sync

Package Overview
Dependencies
Maintainers
4
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@enterprise-cmcs/macpro-security-hub-sync - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

1

dist/libs/index.d.ts

@@ -1,3 +0,2 @@

export * from "./error-lib";
export * from "./jira-lib";
export * from "./security-hub-lib";

@@ -17,4 +17,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./error-lib"), exports);
__exportStar(require("./jira-lib"), exports);
__exportStar(require("./security-hub-lib"), exports);

8

dist/libs/jira-lib.d.ts
import { IssueObject } from "jira-client";
export declare class Jira {
private readonly jira;
private jiraFields;
jiraClosedStatuses: string[];

@@ -10,2 +11,9 @@ constructor();

closeIssue(issueKey: string): Promise<void>;
mapCustomFieldNamesToIds(customJiraFields: {
[fieldName: string]: any;
}): Promise<{
[key: string]: [{
value: string;
}];
}>;
}

@@ -35,2 +35,3 @@ "use strict";

jira;
jiraFields;
jiraClosedStatuses;

@@ -90,2 +91,8 @@ constructor() {

issue.fields.project = { key: process.env.JIRA_PROJECT };
if (issue.customJiraFields) {
issue.fields = {
...issue.fields,
...(await this.mapCustomFieldNamesToIds(issue.customJiraFields)),
};
}
const response = await this.jira.addNewIssue(issue);

@@ -120,3 +127,22 @@ response["webUrl"] = `https://${process.env.JIRA_HOST}/browse/${response.key}`;

}
async mapCustomFieldNamesToIds(customJiraFields) {
if (!this.jiraFields) {
try {
this.jiraFields = await this.jira.listFields();
}
catch (error) {
throw new Error("Failed to retrieve Jira Fields");
}
}
const mappedFields = Object.entries(customJiraFields).reduce((acc, [fieldName, value]) => {
const customField = this.jiraFields.find((field) => field.name === fieldName);
if (!customField) {
throw new Error(`Cannot find custom field named "${fieldName}"`);
}
acc[customField.id] = value;
return acc;
}, {});
return mappedFields;
}
}
exports.Jira = Jira;

@@ -6,3 +6,2 @@ "use strict";

const client_securityhub_1 = require("@aws-sdk/client-securityhub");
const error_lib_1 = require("./error-lib");
class SecurityHub {

@@ -18,3 +17,3 @@ region;

}));
this.getAccountAlias().catch((error) => error_lib_1.Logger.logError(error));
this.getAccountAlias().catch((error) => console.log(error));
}

@@ -60,3 +59,3 @@ async getAccountAlias() {

catch (error) {
error_lib_1.Logger.logError(error);
console.log(error);
return [];

@@ -63,0 +62,0 @@ }

@@ -12,3 +12,3 @@ "use strict";

constructor(options = {}) {
const { region = "us-east-1", severities = ["MEDIUM", "HIGH", "CRITICAL"], customJiraFields = {}, } = options;
const { region = "us-east-1", severities = ["MEDIUM", "HIGH", "CRITICAL"], customJiraFields, } = options;
this.securityHub = new libs_1.SecurityHub({ region, severities });

@@ -116,4 +116,4 @@ this.region = region;

],
...this.customJiraFields,
},
customJiraFields: this.customJiraFields,
};

@@ -120,0 +120,0 @@ const newIssueInfo = await this.jira.createNewIssue(newIssueData);

@@ -7,2 +7,6 @@ "use strict";

severities: ["CRITICAL", "HIGH"],
customJiraFields: {
"Working Team": [{ value: "Dev Team" }],
"Product Supported": [{ value: "OneMac" }],
},
}).sync();

@@ -7,3 +7,3 @@ {

},
"version": "1.1.0",
"version": "1.2.0",
"description": "NPM module to create Jira issues for all findings in Security Hub for the current AWS account..",

@@ -10,0 +10,0 @@ "main": "./dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc