-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcsp-origins.d.ts
273 lines (271 loc) · 9.51 KB
/
csp-origins.d.ts
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
import { A as ApiCallOptions } from './invoke-fetch-types-BXn-uSF5.js';
import './auth-types-PkN9CAF_.js';
type CSPEntry = {
/** The CSP entry's unique identifier. */
id?: string;
} & CSPEntryContent;
type CSPEntryContent = {
/** Defines the valid sources for loading web workers and nested browsing contexts using elements such as frame and iFrame. */
childSrc?: boolean;
/** Restricts the URLs that can be loaded using script interfaces. */
connectSrc?: boolean;
/** Restricts the URLs that can be connected to websockets (all sources will be prefixed with 'wss://'). */
connectSrcWSS?: boolean;
/** The UTC timestamp when the CSP entry was created. */
readonly createdDate?: string;
/** The reason for adding this origin to the Content Security Policy. */
description?: string;
/** Specifies valid sources for loading fonts. */
fontSrc?: boolean;
/** Allow forms to be submitted to the origin. */
formAction?: boolean;
/** Specifies valid sources for embedding the resource using frame, iFrame, object, embed and applet. */
frameAncestors?: boolean;
/** Specifies valid sources for loading nested browsing contexts using elements such as frame and iFrame. */
frameSrc?: boolean;
/** Specifies valid sources of images and favicons. */
imgSrc?: boolean;
/** Specifies valid sources for loading media using the audio and video elements. */
mediaSrc?: boolean;
/** The UTC timestamp when the CSP entry was last modified. */
readonly modifiedDate?: string;
/** The name for this entry. */
name?: string;
/** Specifies valid sources for the object, embed, and applet elements. */
objectSrc?: boolean;
/** The origin that the CSP directives should be applied to. */
origin: string;
/** Specifies valid sources for JavaScript. */
scriptSrc?: boolean;
/** Specifies valid sources for stylesheets. */
styleSrc?: boolean;
/** Specifies valid sources for Worker, SharedWorker, or ServiceWorker scripts. */
workerSrc?: boolean;
};
type CSPEntryList = {
data?: CSPEntry[];
links?: {
next?: Link;
prev?: Link;
self?: Link;
};
};
type CSPHeader = {
/** The compiled CSP header. */
"Content-Security-Policy"?: string;
};
type Error = {
/** The unique code for the error. */
code: string;
/** May be used to provide additional details. */
detail?: string;
/** A summary of what went wrong. */
title: string;
};
type ErrorResponse = {
errors?: Error[];
};
type Link = {
/** URL to a resource request. */
href: string;
};
/**
* Retrieves all content security policies for a tenant.
*
* @param query an object with query parameters
* @throws GetCSPEntriesHttpError
*/
declare const getCSPEntries: (query: {
/** Filter resources by directive 'childSrc', true/false. */
childSrc?: boolean;
/** Filter resources by directive 'connectSrc', true/false. */
connectSrc?: boolean;
/** Filter resources by directive 'connectSrcWSS', true/false. */
connectSrcWSS?: boolean;
/** Filter resources by directive 'fontSrc', true/false. */
fontSrc?: boolean;
/** Filter resources by directive 'formAction', true/false. */
formAction?: boolean;
/** Filter resources by directive 'frameAncestors', true/false. */
frameAncestors?: boolean;
/** Filter resources by directive 'frameSrc', true/false. */
frameSrc?: boolean;
/** Filter resources by directive 'imgSrc', true/false. */
imgSrc?: boolean;
/** Maximum number of CSP-Origins to retrieve. */
limit?: number;
/** Filter resources by directive 'mediaSrc', true/false. */
mediaSrc?: boolean;
/** Filter resources by name (wildcard and case insensitive). */
name?: string;
/** Cursor to the next page. */
next?: string;
/** Filter resources by directive 'objectSrc', true/false. */
objectSrc?: boolean;
/** Filter resources by origin (wildcard and case insensitive). */
origin?: string;
/** Cursor to previous next page. */
prev?: string;
/** Filter resources by directive 'scriptSrc', true/false. */
scriptSrc?: boolean;
/** Field to sort by, prefix with -/+ to indicate order. */
sort?: "name" | "-name" | "origin" | "-origin" | "createdDate" | "-createdDate" | "modifiedDate" | "-modifiedDate";
/** Filter resources by directive 'styleSrc', true/false. */
styleSrc?: boolean;
/** Filter resources by directive 'workerSrc', true/false. */
workerSrc?: boolean;
}, options?: ApiCallOptions) => Promise<GetCSPEntriesHttpResponse>;
type GetCSPEntriesHttpResponse = {
data: CSPEntryList;
headers: Headers;
status: 200;
prev?: (options?: ApiCallOptions) => Promise<GetCSPEntriesHttpResponse>;
next?: (options?: ApiCallOptions) => Promise<GetCSPEntriesHttpResponse>;
};
type GetCSPEntriesHttpError = {
data: ErrorResponse;
headers: Headers;
status: 400 | 401 | 403 | 500 | 503;
};
/**
* Creates a new content security policy for an origin.
*
* @param body an object with the body content
* @throws CreateCSPEntryHttpError
*/
declare const createCSPEntry: (body: CSPEntryContent, options?: ApiCallOptions) => Promise<CreateCSPEntryHttpResponse>;
type CreateCSPEntryHttpResponse = {
data: CSPEntry;
headers: Headers;
status: 201;
};
type CreateCSPEntryHttpError = {
data: ErrorResponse;
headers: Headers;
status: 400 | 401 | 403 | 500 | 503;
};
/**
* Retrieves the full content security policy header (including all configured policies and origins) for the tenant.
*
* @throws GetCSPHeaderHttpError
*/
declare const getCSPHeader: (options?: ApiCallOptions) => Promise<GetCSPHeaderHttpResponse>;
type GetCSPHeaderHttpResponse = {
data: CSPHeader;
headers: Headers;
status: 200;
};
type GetCSPHeaderHttpError = {
data: ErrorResponse;
headers: Headers;
status: 401 | 406 | 500 | 503;
};
/**
* Deletes a specific content security policy.
*
* @param id The CSP entry's unique identifier.
* @throws DeleteCSPEntryHttpError
*/
declare const deleteCSPEntry: (id: string, options?: ApiCallOptions) => Promise<DeleteCSPEntryHttpResponse>;
type DeleteCSPEntryHttpResponse = {
data: void;
headers: Headers;
status: 204;
};
type DeleteCSPEntryHttpError = {
data: ErrorResponse;
headers: Headers;
status: 400 | 401 | 403 | 404 | 500 | 503;
};
/**
* Returns details for a specific content security policy.
*
* @param id The CSP entry's unique identifier.
* @throws GetCSPEntryHttpError
*/
declare const getCSPEntry: (id: string, options?: ApiCallOptions) => Promise<GetCSPEntryHttpResponse>;
type GetCSPEntryHttpResponse = {
data: CSPEntry;
headers: Headers;
status: 200;
};
type GetCSPEntryHttpError = {
data: ErrorResponse;
headers: Headers;
status: 400 | 401 | 403 | 404 | 500 | 503;
};
/**
* Updates a content security policy.
*
* @param id The CSP entry's unique identifier.
* @param body an object with the body content
* @throws UpdateCSPEntryHttpError
*/
declare const updateCSPEntry: (id: string, body: CSPEntryContent, options?: ApiCallOptions) => Promise<UpdateCSPEntryHttpResponse>;
type UpdateCSPEntryHttpResponse = {
data: CSPEntry;
headers: Headers;
status: 200;
};
type UpdateCSPEntryHttpError = {
data: ErrorResponse;
headers: Headers;
status: 400 | 401 | 403 | 404 | 500 | 503;
};
/**
* Clears the cache for csp-origins api requests.
*/
declare function clearCache(): void;
interface CspOriginsAPI {
/**
* Retrieves all content security policies for a tenant.
*
* @param query an object with query parameters
* @throws GetCSPEntriesHttpError
*/
getCSPEntries: typeof getCSPEntries;
/**
* Creates a new content security policy for an origin.
*
* @param body an object with the body content
* @throws CreateCSPEntryHttpError
*/
createCSPEntry: typeof createCSPEntry;
/**
* Retrieves the full content security policy header (including all configured policies and origins) for the tenant.
*
* @throws GetCSPHeaderHttpError
*/
getCSPHeader: typeof getCSPHeader;
/**
* Deletes a specific content security policy.
*
* @param id The CSP entry's unique identifier.
* @throws DeleteCSPEntryHttpError
*/
deleteCSPEntry: typeof deleteCSPEntry;
/**
* Returns details for a specific content security policy.
*
* @param id The CSP entry's unique identifier.
* @throws GetCSPEntryHttpError
*/
getCSPEntry: typeof getCSPEntry;
/**
* Updates a content security policy.
*
* @param id The CSP entry's unique identifier.
* @param body an object with the body content
* @throws UpdateCSPEntryHttpError
*/
updateCSPEntry: typeof updateCSPEntry;
/**
* Clears the cache for csp-origins api requests.
*/
clearCache: typeof clearCache;
}
/**
* Functions for the csp-origins api
*/
declare const cspOriginsExport: CspOriginsAPI;
export { type CSPEntry, type CSPEntryContent, type CSPEntryList, type CSPHeader, type CreateCSPEntryHttpError, type CreateCSPEntryHttpResponse, type CspOriginsAPI, type DeleteCSPEntryHttpError, type DeleteCSPEntryHttpResponse, type Error, type ErrorResponse, type GetCSPEntriesHttpError, type GetCSPEntriesHttpResponse, type GetCSPEntryHttpError, type GetCSPEntryHttpResponse, type GetCSPHeaderHttpError, type GetCSPHeaderHttpResponse, type Link, type UpdateCSPEntryHttpError, type UpdateCSPEntryHttpResponse, clearCache, createCSPEntry, cspOriginsExport as default, deleteCSPEntry, getCSPEntries, getCSPEntry, getCSPHeader, updateCSPEntry };