@harnessio/react-sto-core-client 0.2.0 → 0.3.0

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.
@@ -0,0 +1,88 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { ScansScanIssueResponseBody } from '../schemas/ScansScanIssueResponseBody';
3
+ import type { NotFound } from '../schemas/NotFound';
4
+ import type { ResponseWithPagination } from '../helpers';
5
+ import { FetcherOptions } from '../../../../fetcher/index.js';
6
+ export interface ScansScanIssueOccurrencesQueryPathParams {
7
+ /**
8
+ * The ID of the Security Test Scan
9
+ * @example "Saepe enim sint labore modi at."
10
+ */
11
+ id: string;
12
+ /**
13
+ * The ID of the Security Test Issue
14
+ * @example "Iure omnis et."
15
+ */
16
+ issueId: string;
17
+ }
18
+ export interface ScansScanIssueOccurrencesQueryQueryParams {
19
+ /**
20
+ * Harness Account ID
21
+ * @example "abcdef1234567890ghijkl"
22
+ */
23
+ accountId: string;
24
+ /**
25
+ * Harness Organization ID
26
+ * @example "example_org"
27
+ */
28
+ orgId?: string;
29
+ /**
30
+ * Harness Project ID
31
+ * @example "example_project"
32
+ */
33
+ projectId?: string;
34
+ /**
35
+ * Page number to fetch (starting from 0)
36
+ * @format int64
37
+ * @default 0
38
+ * @example 4
39
+ */
40
+ page?: number;
41
+ /**
42
+ * Number of results per page
43
+ * @format int64
44
+ * @default 30
45
+ * @example 50
46
+ */
47
+ pageSize?: number;
48
+ /**
49
+ * @example "CWE-123,5"
50
+ */
51
+ search?: string;
52
+ /**
53
+ * @example "EXEMPTED,REJECTED"
54
+ */
55
+ exemptionStatus?: string;
56
+ /**
57
+ * The field to sort by
58
+ * @example "Aut aut."
59
+ */
60
+ sort?: string;
61
+ /**
62
+ * The order to sort by
63
+ * @example "ASC"
64
+ */
65
+ order?: 'ASC' | 'DESC';
66
+ /**
67
+ * ID of Security Test Exemption if the API call is for scan + issue + exemption, needed for exemption issue target occurrences detail
68
+ * @example "abcdef1234567890ghijkl"
69
+ */
70
+ exemptionId?: string;
71
+ }
72
+ export interface ScansScanIssueOccurrencesQueryHeaderParams {
73
+ /**
74
+ * Harness personal or service access token
75
+ * @example "Ut possimus est neque consequatur."
76
+ */
77
+ 'X-Api-Key'?: string;
78
+ }
79
+ export type ScansScanIssueOccurrencesOkResponse = ResponseWithPagination<ScansScanIssueResponseBody>;
80
+ export type ScansScanIssueOccurrencesErrorResponse = NotFound;
81
+ export interface ScansScanIssueOccurrencesProps extends ScansScanIssueOccurrencesQueryPathParams, Omit<FetcherOptions<ScansScanIssueOccurrencesQueryQueryParams, unknown, ScansScanIssueOccurrencesQueryHeaderParams>, 'url'> {
82
+ queryParams: ScansScanIssueOccurrencesQueryQueryParams;
83
+ }
84
+ export declare function scansScanIssueOccurrences(props: ScansScanIssueOccurrencesProps): Promise<ScansScanIssueOccurrencesOkResponse>;
85
+ /**
86
+ * Returns occurrences for a scan specific issue
87
+ */
88
+ export declare function useScansScanIssueOccurrencesQuery(props: ScansScanIssueOccurrencesProps, options?: Omit<UseQueryOptions<ScansScanIssueOccurrencesOkResponse, ScansScanIssueOccurrencesErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<ScansScanIssueOccurrencesOkResponse, NotFound>;
@@ -0,0 +1,14 @@
1
+ /* eslint-disable */
2
+ // This code is autogenerated using @harnessio/oats-cli.
3
+ // Please do not modify this code directly.
4
+ import { useQuery } from '@tanstack/react-query';
5
+ import { fetcher } from '../../../../fetcher/index.js';
6
+ export function scansScanIssueOccurrences(props) {
7
+ return fetcher(Object.assign({ url: `/api/v2/scans/${props.id}/issue/${props.issueId}/occurrences`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Returns occurrences for a scan specific issue
11
+ */
12
+ export function useScansScanIssueOccurrencesQuery(props, options) {
13
+ return useQuery(['Scans#ScanIssueOccurrences', props.id, props.issueId, props.queryParams], ({ signal }) => scansScanIssueOccurrences(Object.assign(Object.assign({}, props), { signal })), options);
14
+ }
@@ -1,5 +1,8 @@
1
1
  export type { GetPathParamsType, ResponseWithPagination } from './helpers';
2
- export type { ReferenceIdentifiersGetByReferenceIdErrorResponse, ReferenceIdentifiersGetByReferenceIdOkResponse, ReferenceIdentifiersGetByReferenceIdProps, ReferenceIdentifiersGetByReferenceIdQueryPathParams, } from './hooks/useReferenceIdentifiersGetByReferenceIdQuery';
3
- export { referenceIdentifiersGetByReferenceId, useReferenceIdentifiersGetByReferenceIdQuery, } from './hooks/useReferenceIdentifiersGetByReferenceIdQuery';
4
- export type { GetByReferenceIdResponseBody } from './schemas/GetByReferenceIdResponseBody';
2
+ export type { ScansScanIssueOccurrencesErrorResponse, ScansScanIssueOccurrencesOkResponse, ScansScanIssueOccurrencesProps, ScansScanIssueOccurrencesQueryPathParams, ScansScanIssueOccurrencesQueryQueryParams, } from './hooks/useScansScanIssueOccurrencesQuery';
3
+ export { scansScanIssueOccurrences, useScansScanIssueOccurrencesQuery, } from './hooks/useScansScanIssueOccurrencesQuery';
4
+ export type { GitMetadata } from './schemas/GitMetadata';
5
+ export type { IssueInScan } from './schemas/IssueInScan';
5
6
  export type { NotFound } from './schemas/NotFound';
7
+ export type { Pagination } from './schemas/Pagination';
8
+ export type { ScansScanIssueResponseBody } from './schemas/ScansScanIssueResponseBody';
@@ -1 +1 @@
1
- export { referenceIdentifiersGetByReferenceId, useReferenceIdentifiersGetByReferenceIdQuery, } from './hooks/useReferenceIdentifiersGetByReferenceIdQuery';
1
+ export { scansScanIssueOccurrences, useScansScanIssueOccurrencesQuery, } from './hooks/useScansScanIssueOccurrencesQuery';
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Git Metadata associated with the Scan
3
+ * @example {"detectedName":"Et error.","detectedVariant":"Sint qui est omnis ut.","droneCorrelated":true,"provider":"Temporibus non atque.","pullRequestNumber":11,"repositoryHttp":"https://github.com/harness/drone-cli.git","repositoryPath":["Aut eos.","Blanditiis laboriosam voluptatibus quis.","Aut laboriosam.","Non et."],"repositorySsh":"git@github.com:harness/drone-cli.git","sourceBranch":"feat/shiny-object","targetBranch":"develop","workspace":"/harness"}
4
+ */
5
+ export interface GitMetadata {
6
+ /**
7
+ * Detected Name
8
+ * @example "Fugiat sunt quia impedit quos temporibus."
9
+ */
10
+ detectedName?: string;
11
+ /**
12
+ * Detected Variant
13
+ * @example "Eveniet eius placeat possimus ullam."
14
+ */
15
+ detectedVariant?: string;
16
+ /**
17
+ * Drone Correlated
18
+ * @example true
19
+ */
20
+ droneCorrelated?: boolean;
21
+ /**
22
+ * Git Provider
23
+ * @example "Esse exercitationem reiciendis."
24
+ */
25
+ provider?: string;
26
+ /**
27
+ * Git Pull Request Number
28
+ * @format int64
29
+ * @example 11
30
+ */
31
+ pullRequestNumber?: number;
32
+ /**
33
+ * Git HTTP Repository
34
+ * @example "https://github.com/harness/drone-cli.git"
35
+ */
36
+ repositoryHttp?: string;
37
+ /**
38
+ * Git Repository Path
39
+ * @example ["Inventore voluptatum eos dolores.","Quo omnis similique quod perspiciatis.","Aut nobis nostrum enim id omnis."]
40
+ */
41
+ repositoryPath?: string[];
42
+ /**
43
+ * Git SSH Repository
44
+ * @example "git@github.com:harness/drone-cli.git"
45
+ */
46
+ repositorySsh?: string;
47
+ /**
48
+ * Git Source Branch
49
+ * @example "feat/shiny-object"
50
+ */
51
+ sourceBranch?: string;
52
+ /**
53
+ * Git Target Branch
54
+ * @example "develop"
55
+ */
56
+ targetBranch?: string;
57
+ /**
58
+ * Git Workspace Root
59
+ * @example "/harness"
60
+ */
61
+ workspace?: string;
62
+ }
@@ -0,0 +1,156 @@
1
+ import type { GitMetadata } from '../schemas/GitMetadata';
2
+ import type { Pagination } from '../schemas/Pagination';
3
+ /**
4
+ * @example {"baselineVariantId":"abcdef1234567890ghijkl","created":1651578240,"currentStatus":"Rejected","details":{"package":"json-schema","version":"v0.2.3"},"exemptionCoverage":"Partially Exempted","exemptionId":"abcdef1234567890ghijkl","exemptionStatusAtScan":"Approved","gitMetadata":{"detectedName":"Ullam maiores quas ea unde.","detectedVariant":"Exercitationem odit cumque.","droneCorrelated":false,"provider":"Reiciendis corporis et.","pullRequestNumber":11,"repositoryHttp":"https://github.com/harness/drone-cli.git","repositoryPath":["Aut sed vero quos laudantium est reprehenderit.","Ducimus aspernatur facere in ut culpa.","Deserunt aliquid.","Laboriosam ad dolore."],"repositorySsh":"git@github.com:harness/drone-cli.git","sourceBranch":"feat/shiny-object","targetBranch":"develop","workspace":"/harness"},"harnessAugmentation":{"Nobis pariatur eos voluptatibus nesciunt similique dolor.":"Nulla magnam assumenda doloremque consectetur.","Rem ullam explicabo.":"Est reiciendis labore quis et."},"id":"abcdef1234567890ghijkl","key":"json-schema@0.2.3","numNonExemptedOccurrences":10,"numOccurrences":10,"occurrenceId":12345,"occurrences":[{"line":"42"},{"line":"666"}],"occurrencesPagination":{"link":"","page":4,"pageSize":20,"totalItems":230,"totalPages":12},"primaryOccurrenceId":12345,"productId":"product1234567890abcde","severity":8.5,"severityCode":"High","status":"Remediated","subproduct":"product","targetId":"abcdef1234567890ghijkl","targetName":"abcdef1234567890ghijkl","targetType":"repository","targetVariantId":"abcdef1234567890ghijkl","targetVariantName":"nodegoat:master","title":"json-schema@0.2.3 is vulnerable to Prototype Pollution","type":"SAST"}
5
+ */
6
+ export interface IssueInScan {
7
+ /**
8
+ * The Baseline Target Variant related to this Security Issue
9
+ * @example "abcdef1234567890ghijkl"
10
+ */
11
+ baselineVariantId?: string;
12
+ /**
13
+ * Unix timestamp at which the resource was created
14
+ * @format int64
15
+ * @example 1651578240
16
+ */
17
+ created: number;
18
+ /**
19
+ * Current status of the Exemption
20
+ * @example "Approved"
21
+ */
22
+ currentStatus?: 'Approved' | 'Expired' | 'Pending' | 'Rejected';
23
+ /**
24
+ * Issue details common to all occurrences
25
+ * @example {"package":"json-schema","version":"v0.2.3"}
26
+ */
27
+ details: {
28
+ [key: string]: any;
29
+ };
30
+ /**
31
+ * Indicates if the Security Issue was found to be Exempted, Partially Exempted.
32
+ * @example "Partially Exempted"
33
+ */
34
+ exemptionCoverage?: string;
35
+ /**
36
+ * ID of the associated Exemption
37
+ * @example "abcdef1234567890ghijkl"
38
+ */
39
+ exemptionId?: string;
40
+ /**
41
+ * Exemption's status at the Security Scan created time
42
+ * @example "Rejected"
43
+ */
44
+ exemptionStatusAtScan?: 'Approved' | 'Expired' | 'Pending' | 'Rejected';
45
+ gitMetadata?: GitMetadata;
46
+ /**
47
+ * Harness Augmentation details
48
+ * @example {"Aut autem unde ad culpa quia enim.":"Et sit aut nemo fugiat.","Quam iure corrupti non cupiditate.":"Assumenda repellendus neque nostrum autem dolor.","Sed in neque nihil ut.":"Totam magnam ratione vero a."}
49
+ */
50
+ harnessAugmentation?: {
51
+ [key: string]: any;
52
+ };
53
+ /**
54
+ * Resource identifier
55
+ * @example "abcdef1234567890ghijkl"
56
+ */
57
+ id: string;
58
+ /**
59
+ * Compression/deduplication key
60
+ * @example "json-schema@0.2.3"
61
+ */
62
+ key: string;
63
+ /**
64
+ * Indicates the number of Occurrences which dont have an active exemption on the Occurrence
65
+ * @format int32
66
+ * @default 0
67
+ * @example 10
68
+ */
69
+ numNonExemptedOccurrences: number;
70
+ /**
71
+ * Indicates the number of Occurrences on the Issue
72
+ * @format int32
73
+ * @example 10
74
+ */
75
+ numOccurrences: number;
76
+ /**
77
+ * @format int64
78
+ * @example 12345
79
+ */
80
+ occurrenceId?: number;
81
+ /**
82
+ * Array of details unique to each occurrence
83
+ * @example [{"line":"42"},{"line":"666"}]
84
+ */
85
+ occurrences?: Array<{
86
+ [key: string]: any;
87
+ }>;
88
+ occurrencesPagination: Pagination;
89
+ /**
90
+ * The primary occurrence's ID
91
+ * @format int64
92
+ * @example 12345
93
+ */
94
+ primaryOccurrenceId: number;
95
+ /**
96
+ * The scan tool that identified this Security Issue
97
+ * @example "product1234567890abcde"
98
+ */
99
+ productId: string;
100
+ /**
101
+ * Numeric severity, from 0 (lowest) to 10 (highest)
102
+ * @format float
103
+ * @example 8.5
104
+ */
105
+ severity: number;
106
+ /**
107
+ * Severity code
108
+ * @example "High"
109
+ */
110
+ severityCode: 'Critical' | 'High' | 'Info' | 'Low' | 'Medium' | 'Unassigned';
111
+ /**
112
+ * Indicates if the Security Issue was found to be remediated, ignored, etc.
113
+ * @example "Remediated"
114
+ */
115
+ status?: 'Acceptable Risk' | 'Acceptable Use' | 'Compensating Controls' | 'Exempted' | 'False Positive' | 'Fix Unavailable' | 'Remediated';
116
+ /**
117
+ * The subproduct that identified this Security Issue
118
+ * @example "product"
119
+ */
120
+ subproduct?: string;
121
+ /**
122
+ * The Target that this Security Issue affects
123
+ * @example "abcdef1234567890ghijkl"
124
+ */
125
+ targetId?: string;
126
+ /**
127
+ * The Name of the Target that this Security Issue affects
128
+ * @example "abcdef1234567890ghijkl"
129
+ */
130
+ targetName?: string;
131
+ /**
132
+ * The type of the Target that this Security Issue affects
133
+ * @example "repository"
134
+ */
135
+ targetType?: 'configuration' | 'container' | 'instance' | 'repository';
136
+ /**
137
+ * The Target Variant that this Security Issue affects
138
+ * @example "abcdef1234567890ghijkl"
139
+ */
140
+ targetVariantId?: string;
141
+ /**
142
+ * Name of the associated Target and Variant
143
+ * @example "nodegoat:master"
144
+ */
145
+ targetVariantName?: string;
146
+ /**
147
+ * Title of the Security Issue
148
+ * @example "json-schema@0.2.3 is vulnerable to Prototype Pollution"
149
+ */
150
+ title: string;
151
+ /**
152
+ * The type of vulnerability or quality issue for this Issue
153
+ * @example "SAST"
154
+ */
155
+ type?: 'BUG_SMELLS' | 'CODE_COVERAGE' | 'CODE_SMELLS' | 'DAST' | 'EXTERNAL_POLICY' | 'IAC' | 'MISCONFIG' | 'SAST' | 'SCA' | 'SECRET';
156
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @example {"link":"","page":4,"pageSize":20,"totalItems":230,"totalPages":12}
3
+ */
4
+ export interface Pagination {
5
+ /**
6
+ * Link-based paging
7
+ * @example ""
8
+ */
9
+ link?: string;
10
+ /**
11
+ * Page number (starting from 0)
12
+ * @format int64
13
+ * @example 4
14
+ */
15
+ page: number;
16
+ /**
17
+ * Requested page size
18
+ * @format int64
19
+ * @example 20
20
+ */
21
+ pageSize: number;
22
+ /**
23
+ * Total results available
24
+ * @format int64
25
+ * @example 230
26
+ */
27
+ totalItems: number;
28
+ /**
29
+ * Total pages available
30
+ * @format int64
31
+ * @example 12
32
+ */
33
+ totalPages: number;
34
+ }
@@ -0,0 +1,4 @@
1
+ /* eslint-disable */
2
+ // This code is autogenerated using @harnessio/oats-cli.
3
+ // Please do not modify this code directly.
4
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { IssueInScan } from '../schemas/IssueInScan';
2
+ export type ScansScanIssueResponseBody = IssueInScan;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harnessio/react-sto-core-client",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Harness STO service APIs integrated with react hooks",
5
5
  "author": "Harness Inc",
6
6
  "license": "MIT",
@@ -27,8 +27,5 @@
27
27
  "build": "yarn generate && tsc",
28
28
  "generate": "oats import --config='./oats.config.ts'",
29
29
  "fmt": "prettier --write ./index.ts"
30
- },
31
- "engines": {
32
- "node": "^16"
33
30
  }
34
31
  }
@@ -1,27 +0,0 @@
1
- import { UseQueryOptions } from '@tanstack/react-query';
2
- import type { GetByReferenceIdResponseBody } from '../schemas/GetByReferenceIdResponseBody';
3
- import type { NotFound } from '../schemas/NotFound';
4
- import type { ResponseWithPagination } from '../helpers';
5
- import { FetcherOptions } from '../../../../fetcher/index.js';
6
- export interface ReferenceIdentifiersGetByReferenceIdQueryPathParams {
7
- /**
8
- * @example "CWE-123"
9
- */
10
- refId: string;
11
- }
12
- export interface ReferenceIdentifiersGetByReferenceIdQueryHeaderParams {
13
- /**
14
- * Harness personal or service access token
15
- * @example "Atque quaerat aut."
16
- */
17
- 'X-Api-Key'?: string;
18
- }
19
- export type ReferenceIdentifiersGetByReferenceIdOkResponse = ResponseWithPagination<GetByReferenceIdResponseBody>;
20
- export type ReferenceIdentifiersGetByReferenceIdErrorResponse = NotFound;
21
- export interface ReferenceIdentifiersGetByReferenceIdProps extends ReferenceIdentifiersGetByReferenceIdQueryPathParams, Omit<FetcherOptions<unknown, unknown, ReferenceIdentifiersGetByReferenceIdQueryHeaderParams>, 'url'> {
22
- }
23
- export declare function referenceIdentifiersGetByReferenceId(props: ReferenceIdentifiersGetByReferenceIdProps): Promise<ReferenceIdentifiersGetByReferenceIdOkResponse>;
24
- /**
25
- * Reference Identifiers Lookup
26
- */
27
- export declare function useReferenceIdentifiersGetByReferenceIdQuery(props: ReferenceIdentifiersGetByReferenceIdProps, options?: Omit<UseQueryOptions<ReferenceIdentifiersGetByReferenceIdOkResponse, ReferenceIdentifiersGetByReferenceIdErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<ReferenceIdentifiersGetByReferenceIdOkResponse, NotFound>;
@@ -1,14 +0,0 @@
1
- /* eslint-disable */
2
- // This code is autogenerated using @harnessio/oats-cli.
3
- // Please do not modify this code directly.
4
- import { useQuery } from '@tanstack/react-query';
5
- import { fetcher } from '../../../../fetcher/index.js';
6
- export function referenceIdentifiersGetByReferenceId(props) {
7
- return fetcher(Object.assign({ url: `/api/v2/reference-identifiers/${props.refId}`, method: 'GET' }, props));
8
- }
9
- /**
10
- * Reference Identifiers Lookup
11
- */
12
- export function useReferenceIdentifiersGetByReferenceIdQuery(props, options) {
13
- return useQuery(['Reference Identifiers#getByReferenceId', props.refId], ({ signal }) => referenceIdentifiersGetByReferenceId(Object.assign(Object.assign({}, props), { signal })), options);
14
- }
@@ -1,31 +0,0 @@
1
- /**
2
- * @example {"description":"Ut vitae doloremque.","extendedDescription":"Saepe atque est molestias.","remediationSteps":"Voluptas voluptatem reiciendis tenetur quia.","severity":8.5,"severityCode":"High"}
3
- */
4
- export interface GetByReferenceIdResponseBody {
5
- /**
6
- * A short description of the identified issue.
7
- * @example "Corporis consectetur aut quas veritatis."
8
- */
9
- description?: string;
10
- /**
11
- * A more detailed explanation of the issue and its potential impact.
12
- * @example "Totam voluptatem nihil earum."
13
- */
14
- extendedDescription?: string;
15
- /**
16
- * Steps the developer can take to address or mitigate the issue.
17
- * @example "Quod itaque unde suscipit facere molestiae delectus."
18
- */
19
- remediationSteps?: string;
20
- /**
21
- * Numeric severity, from 0 (lowest) to 10 (highest)
22
- * @format double
23
- * @example 8.5
24
- */
25
- severity?: number;
26
- /**
27
- * Severity code
28
- * @example "High"
29
- */
30
- severityCode?: string;
31
- }