airbyte-faros-destination 0.9.57 → 0.9.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -168,6 +168,13 @@ Example `catalog.json`
168
168
  }
169
169
  ```
170
170
 
171
+ To view debug logs from airbyte, set the following environment variable:
172
+
173
+ ```shell
174
+ export LOG_LEVEL="debug";
175
+ ./bin/main write --config config.json --catalog catalog.json;
176
+ ```
177
+
171
178
  **Tip**: you can even pipe data directly from your custom source into your custom destination without Airbyte server while prefixing your streams (as expected by Faros Destination):
172
179
 
173
180
  ```shell
@@ -5,25 +5,12 @@ const lodash_1 = require("lodash");
5
5
  const common_1 = require("./common");
6
6
  class FarosSprintReports extends common_1.JiraConverter {
7
7
  get destinationModels() {
8
- return ['tms_Sprint', 'tms_SprintHistory'];
8
+ return ['tms_SprintHistory'];
9
9
  }
10
10
  async convert(record, ctx) {
11
11
  const sprintReport = record.record.data;
12
- const uid = (0, lodash_1.toString)(sprintReport.id);
13
- const results = [
14
- {
15
- model: 'tms_Sprint',
16
- record: {
17
- uid,
18
- completedPoints: sprintReport.completedPoints,
19
- completedOutsideSprintPoints: sprintReport.completedInAnotherSprintPoints,
20
- notCompletedPoints: sprintReport.notCompletedPoints,
21
- removedPoints: sprintReport.puntedPoints,
22
- plannedPoints: sprintReport.plannedPoints,
23
- source: this.streamName.source,
24
- },
25
- },
26
- ];
12
+ const uid = (0, lodash_1.toString)(sprintReport.sprintId);
13
+ const results = [];
27
14
  for (const issue of sprintReport.issues || []) {
28
15
  results.push({
29
16
  model: 'tms_SprintHistory',
@@ -1 +1 @@
1
- {"version":3,"file":"faros_sprint_reports.js","sourceRoot":"","sources":["../../../src/converters/jira/faros_sprint_reports.ts"],"names":[],"mappings":";;;AACA,mCAAgC;AAGhC,qCAAuC;AAEvC,MAAa,kBAAmB,SAAQ,sBAAa;IACnD,IAAI,iBAAiB;QACnB,OAAO,CAAC,YAAY,EAAE,mBAAm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"mappings":";;;AAEA,mCAAgC;AAGhC,qCAAuC;AAEvC,MAAa,kBAAmB,SAAQ,sBAAa;IACnD,IAAI,iBAAiB;QACnB,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC/B,CAAC;IACD,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;QAElB,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAoB,CAAC;QACxD,MAAM,GAAG,GAAG,IAAA,iBAAQ,EAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAwB,EAAE,CAAC;QACxC,KAAK,MAAM,KAAK,IAAI,YAAY,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;YAC9C,OAAO,CAAC,IAAI,CAAC;gBACX,KAAK,EAAE,mBAAmB;gBAC1B,MAAM,EAAE;oBACN,MAAM,EAAE,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAC;oBAC7C,KAAK,EAAE,EAAC,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAC;oBACvD,MAAM,EAAE,KAAK,CAAC,MAAM;oBACpB,MAAM,EAAE,EAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,EAAC;oBAChC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;iBAC3C;aACF,CAAC,CAAC;QACL,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAzBD,gDAyBC"}
@@ -1,10 +1,12 @@
1
1
  type OptString = string | null | undefined;
2
+ type OptBool = boolean | null | undefined;
3
+ type OptNumber = number | null | undefined;
2
4
  export interface BaseVulnerabilityType {
3
5
  uid: OptString;
4
6
  displayName: OptString;
5
7
  createdAt: OptString;
6
8
  externalURL: OptString;
7
- severity: OptString;
9
+ severity: OptString | OptNumber;
8
10
  }
9
11
  export type ExtendedVulnerabilityType = BaseVulnerabilityType & {
10
12
  description?: OptString;
@@ -17,13 +19,13 @@ export interface GithubSecurityAdvisory {
17
19
  ghsaId: OptString;
18
20
  }
19
21
  export interface GithubVulnerabilityData {
20
- createdAt: OptString;
22
+ uid: OptString;
21
23
  displayName: OptString;
24
+ createdAt: OptString;
22
25
  externalURL: OptString;
26
+ severity: OptNumber;
23
27
  repositoryName: OptString;
24
- severity: OptString;
25
28
  slaDeadline: OptString;
26
- uid: OptString;
27
29
  vantaDescription: OptString;
28
30
  securityAdvisory: GithubSecurityAdvisory;
29
31
  }
@@ -33,17 +35,16 @@ export interface AWSFindings {
33
35
  name: OptString;
34
36
  }
35
37
  export interface AWSVulnerabilityData {
38
+ uid: OptString;
39
+ displayName: OptString;
36
40
  createdAt: OptString;
41
+ externalURL: OptString;
42
+ severity: OptNumber;
37
43
  packageName: OptString;
38
44
  packageVersion: OptString;
39
- externalURL: OptString;
40
- scanType: OptString;
41
- severity: OptString;
42
45
  slaDeadline: OptString;
43
- uid: OptString;
44
46
  repositoryName: OptString;
45
47
  repositoryArn: OptString;
46
- displayName: OptString;
47
48
  findings: AWSFindings[];
48
49
  }
49
50
  export interface AWSV2Ignored {
@@ -55,19 +56,16 @@ export interface AWSV2Asset {
55
56
  displayName: OptString;
56
57
  }
57
58
  export interface AWSV2VulnerabilityData {
59
+ uid: OptString;
60
+ displayName: OptString;
58
61
  createdAt: OptString;
59
62
  externalURL: OptString;
63
+ severity: OptString;
60
64
  packageName: OptString;
61
65
  packageIdentifier: OptString;
62
- scanType: OptString;
63
- scannerScore: OptString;
64
- severity: OptString;
65
- uid: OptString;
66
66
  description: OptString;
67
- displayName: OptString;
68
67
  name: OptString;
69
- isFixable: OptString;
70
- remediation: OptString;
68
+ isFixable: OptBool;
71
69
  remediateBy: OptString;
72
70
  asset: AWSV2Asset;
73
71
  ignored: AWSV2Ignored;
@@ -95,4 +93,10 @@ export interface CicdArtifactKey {
95
93
  uid: string;
96
94
  repository: CicdRepoKey;
97
95
  }
96
+ export type VulnerabilityInfo = {
97
+ id: string;
98
+ resolvedAt: OptString;
99
+ vulnerabilityUid: OptString;
100
+ };
101
+ export type FarosObjectKey = VcsOrgKey | VcsRepoKey | CicdOrgKey | CicdRepoKey | CicdArtifactKey;
98
102
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/converters/vanta/types.ts"],"names":[],"mappings":";;;AAsFa,QAAA,eAAe,GAAa,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/converters/vanta/types.ts"],"names":[],"mappings":";;;AAqFa,QAAA,eAAe,GAAa,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC"}
@@ -1 +1,2 @@
1
1
  export declare function getQueryFromName(name: string): string;
2
+ export declare function looksLikeGithubCommitSha(sha: string): boolean;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getQueryFromName = void 0;
6
+ exports.looksLikeGithubCommitSha = exports.getQueryFromName = void 0;
7
7
  const fs_extra_1 = __importDefault(require("fs-extra"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  // Function to find a specific parent directory
@@ -34,4 +34,8 @@ function getQueryFromName(name) {
34
34
  return fs_extra_1.default.readFileSync(`${gql_dir}/${fn}`, 'utf8');
35
35
  }
36
36
  exports.getQueryFromName = getQueryFromName;
37
+ function looksLikeGithubCommitSha(sha) {
38
+ return /^[a-f0-9]{40}$/i.test(sha);
39
+ }
40
+ exports.looksLikeGithubCommitSha = looksLikeGithubCommitSha;
37
41
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/converters/vanta/utils.ts"],"names":[],"mappings":";;;;;;AAAA,wDAA0B;AAC1B,gDAAwB;AAExB,+CAA+C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B,IAAI,WAAW,GAAG,UAAU,CAAC;IAC7B,OAAO,WAAW,KAAK,GAAG,EAAE,CAAC;QAC3B,IAAI,cAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,aAAa,EAAE,CAAC;YACjD,OAAO,WAAW,CAAC;QACrB,CAAC;QACD,WAAW,GAAG,cAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,gBAAgB,CAAC,IAAY;IAC3C,MAAM,OAAO,GAAG,SAAS,CAAC;IAC1B,sDAAsD;IACtD,MAAM,aAAa,GAAG,mBAAmB,CACvC,OAAO,EACP,2BAA2B,CAC5B,CAAC;IACF,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IAED,MAAM,OAAO,GAAG,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;IAEtD,MAAM,EAAE,GAAG,GAAG,IAAI,MAAM,CAAC;IACzB,6BAA6B;IAC7B,IAAI,CAAC,kBAAE,CAAC,UAAU,CAAC,GAAG,OAAO,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,SAAS,EAAE,iBAAiB,OAAO,EAAE,CAAC,CAAC;IACzD,CAAC;IACD,iEAAiE;IACjE,OAAO,kBAAE,CAAC,YAAY,CAAC,GAAG,OAAO,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC;AApBD,4CAoBC;AAED,SAAgB,wBAAwB,CAAC,GAAW;IAClD,OAAO,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC;AAFD,4DAEC"}
@@ -1,7 +1,7 @@
1
1
  import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { FarosClient } from 'faros-js-client';
2
3
  import { Converter, DestinationModel, DestinationRecord, StreamContext } from '../converter';
3
- import { AWSV2VulnerabilityData, AWSVulnerabilityData, CicdArtifactKey, ExtendedVulnerabilityType, GithubVulnerabilityData, VcsRepoKey } from './types';
4
- export declare function looksLikeGithubCommitSha(sha: string): boolean;
4
+ import { AWSV2VulnerabilityData, AWSVulnerabilityData, CicdArtifactKey, ExtendedVulnerabilityType, FarosObjectKey, GithubVulnerabilityData, VcsRepoKey, VulnerabilityInfo } from './types';
5
5
  export declare abstract class Vulnerabilities extends Converter {
6
6
  source: string;
7
7
  readonly destinationModels: ReadonlyArray<DestinationModel>;
@@ -20,24 +20,54 @@ export declare abstract class Vulnerabilities extends Converter {
20
20
  vcsRepositoryQuery: string;
21
21
  cicdArtifactQueryByCommitSha: string;
22
22
  cicdArtifactQueryByRepoName: string;
23
+ vcsRepositoryVulnerabilityQuery: string;
24
+ cicdArtifactVulnerabilityQuery: string;
25
+ vulnerabilitiesWithMissingRepositoryNames: Set<string>;
26
+ vulnerabilitiesWithMissingCICDArtifacts: Set<string>;
27
+ noResponseFromVcsRepositoryQuery: Set<string>;
28
+ noResponseFromCicdArtifactQuery: Set<string>;
29
+ emptyResultsFromVcsRepositoryQuery: Set<string>;
30
+ emptyResultsFromCicdArtifactQuery: Set<string>;
31
+ noResponseAWSArtifactFromName: Set<string>;
32
+ emptyResultsAWSArtifactFromName: Set<string>;
33
+ nUpdatedVcsVulns: number;
34
+ nUpdatedCicdVulns: number;
35
+ missedRepositoryNames: Set<string>;
36
+ nFarosRequests: number;
37
+ skipRepoNames: Set<string>;
38
+ nRecordsProcessed: number;
39
+ maxNRecords: number | null;
40
+ filterLastNDays: number | null;
23
41
  /** All Vanta records should have id property */
24
42
  id(record: AirbyteRecord): any;
43
+ convert(record: AirbyteRecord): Promise<ReadonlyArray<DestinationRecord>>;
25
44
  addUIDToMapping(name: string, uid: string, mapping: Record<string, string[]>): void;
26
45
  getVulnRecordsFromGit(data: GithubVulnerabilityData[]): DestinationRecord[];
27
46
  getVulnRecordsFromAws(data: AWSVulnerabilityData[]): DestinationRecord[];
28
- getVCSRepositoryFromName(vcsRepoName: string, ctx: StreamContext): Promise<VcsRepoKey | null>;
29
- getCICDArtifactFromCommitSha(commitSha: string, ctx: StreamContext): Promise<CicdArtifactKey | null>;
30
- getAWSCicdArtifactFromName(repoName: string, ctx: StreamContext): Promise<CicdArtifactKey | null>;
31
- getVCSMappingsFromGit(gitRepoNamesToUIDs: Record<string, string[]>, ctx: StreamContext): Promise<DestinationRecord[]>;
47
+ runFunctionInBatches(names: string[], fc: FarosClient, ctx: StreamContext, batchSize: number, func: (names: string[], fc: FarosClient, ctx: StreamContext) => Promise<FarosObjectKey[]>): Promise<FarosObjectKey[]>;
48
+ getVCSRepositoriesFromNames(vcsRepoNames: string[], fc: FarosClient, ctx: StreamContext): Promise<VcsRepoKey[]>;
49
+ getCICDArtifactsFromCommitShas(commitShas: string[], fc: FarosClient, ctx: StreamContext): Promise<CicdArtifactKey[]>;
50
+ getVCSRepositoriesFromNamesBatches(vcsRepoNames: string[], fc: FarosClient, ctx: StreamContext, batchSize: number): Promise<VcsRepoKey[]>;
51
+ getCICDArtifactFromCommitShaBatches(allCommitShas: Set<string>, fc: FarosClient, ctx: StreamContext): Promise<CicdArtifactKey[]>;
52
+ getAWSCicdArtifactsFromRepoNamesByBatches(allRepoNames: string[], fc: FarosClient, ctx: StreamContext): Promise<CicdArtifactKey[]>;
53
+ getAWSCicdArtifactsFromNames(repoNames: string[], fc: FarosClient, ctx: StreamContext): Promise<CicdArtifactKey[]>;
54
+ getVCSMappingsFromGit(gitRepoNamesToUIDs: Record<string, string[]>, fc: FarosClient, ctx: StreamContext): Promise<DestinationRecord[]>;
32
55
  getAWSV2VulnStatusDetail(vuln: AWSV2VulnerabilityData): string;
33
56
  getAWSV2VulnStatusCategory(vuln: AWSV2VulnerabilityData): string;
34
- getCICDMappingsFromAWS(ctx: StreamContext): Promise<DestinationRecord[]>;
35
- getCICDMappingsFromAWSV2(aws_vulns: AWSV2VulnerabilityData[], ctx: StreamContext): Promise<DestinationRecord[]>;
57
+ getCICDMappingsFromAWS(fc: FarosClient, ctx: StreamContext): Promise<DestinationRecord[]>;
58
+ getCommitShasFromAWSV2Vulns(vulns: AWSV2VulnerabilityData[], ctx: StreamContext): [Set<string>, Record<string, AWSV2VulnerabilityData>];
59
+ getCICDMappingsFromAWSV2(aws_vulns: AWSV2VulnerabilityData[], fc: FarosClient, ctx: StreamContext): Promise<DestinationRecord[]>;
36
60
  getUidFromAWSV2Vuln(vuln: AWSV2VulnerabilityData): string;
37
61
  getVulnRecordsFromAwsV2(data: AWSV2VulnerabilityData[]): DestinationRecord[];
38
62
  combineAwsVulns(aws_v1_vulns: DestinationRecord[], aws_v2_vulns: DestinationRecord[], ctx: StreamContext): DestinationRecord[];
39
63
  getSecVulnerabilityRecordFromData(data: ExtendedVulnerabilityType): DestinationRecord;
40
- convert(record: AirbyteRecord): Promise<ReadonlyArray<DestinationRecord>>;
41
64
  printReport(ctx: StreamContext): void;
65
+ getTotalNumberOfRecords(): number;
66
+ getPaginatedQueryResults(ctx: any, query: string, key: string): Promise<any>;
67
+ getAllUnresolvedObjectVulnerabilities(ctx: StreamContext, query: string, key: string): Promise<VulnerabilityInfo[]>;
68
+ updateVulnsInBatches(ctx: StreamContext, ids: string[], resolvedAt: string, mutationName: string, updateName: string, updatesPerRequest: number): Promise<void>;
69
+ updateVCSVulnsToResolved(ctx: StreamContext): Promise<number>;
70
+ updateCICDVulnsToResolved(ctx: StreamContext): Promise<number>;
71
+ updateExistingVulnerabilities(ctx: StreamContext): Promise<void>;
42
72
  onProcessingComplete(ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
43
73
  }