@solidxai/core 0.1.16 → 0.1.17-beta.1
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/CHANGELOG.md +1986 -1
- package/CLAUDE.md +26 -0
- package/dist/constants/media-file-types.d.ts +2 -2
- package/dist/constants/media-file-types.d.ts.map +1 -1
- package/dist/constants/media-file-types.js +24 -10
- package/dist/constants/media-file-types.js.map +1 -1
- package/dist/controllers/chatter-message-details.controller.d.ts.map +1 -1
- package/dist/controllers/chatter-message-details.controller.js +2 -6
- package/dist/controllers/chatter-message-details.controller.js.map +1 -1
- package/dist/controllers/chatter-message.controller.d.ts.map +1 -1
- package/dist/controllers/chatter-message.controller.js +3 -7
- package/dist/controllers/chatter-message.controller.js.map +1 -1
- package/dist/controllers/dashboard-user-layout.controller.d.ts.map +1 -1
- package/dist/controllers/dashboard-user-layout.controller.js +2 -6
- package/dist/controllers/dashboard-user-layout.controller.js.map +1 -1
- package/dist/controllers/import-transaction-error-log.controller.d.ts.map +1 -1
- package/dist/controllers/import-transaction-error-log.controller.js +2 -6
- package/dist/controllers/import-transaction-error-log.controller.js.map +1 -1
- package/dist/controllers/import-transaction.controller.d.ts.map +1 -1
- package/dist/controllers/import-transaction.controller.js +2 -6
- package/dist/controllers/import-transaction.controller.js.map +1 -1
- package/dist/controllers/list-of-values.controller.d.ts.map +1 -1
- package/dist/controllers/list-of-values.controller.js +2 -6
- package/dist/controllers/list-of-values.controller.js.map +1 -1
- package/dist/controllers/locale.controller.d.ts.map +1 -1
- package/dist/controllers/locale.controller.js +2 -6
- package/dist/controllers/locale.controller.js.map +1 -1
- package/dist/controllers/media.controller.d.ts.map +1 -1
- package/dist/controllers/media.controller.js +9 -8
- package/dist/controllers/media.controller.js.map +1 -1
- package/dist/controllers/model-sequence.controller.d.ts.map +1 -1
- package/dist/controllers/model-sequence.controller.js +2 -6
- package/dist/controllers/model-sequence.controller.js.map +1 -1
- package/dist/controllers/saved-filters.controller.d.ts.map +1 -1
- package/dist/controllers/saved-filters.controller.js +2 -6
- package/dist/controllers/saved-filters.controller.js.map +1 -1
- package/dist/controllers/scheduled-job.controller.d.ts.map +1 -1
- package/dist/controllers/scheduled-job.controller.js +2 -6
- package/dist/controllers/scheduled-job.controller.js.map +1 -1
- package/dist/controllers/security-rule.controller.d.ts.map +1 -1
- package/dist/controllers/security-rule.controller.js +2 -6
- package/dist/controllers/security-rule.controller.js.map +1 -1
- package/dist/controllers/user-activity-history.controller.d.ts.map +1 -1
- package/dist/controllers/user-activity-history.controller.js +2 -6
- package/dist/controllers/user-activity-history.controller.js.map +1 -1
- package/dist/controllers/user-view-metadata.controller.d.ts.map +1 -1
- package/dist/controllers/user-view-metadata.controller.js +2 -6
- package/dist/controllers/user-view-metadata.controller.js.map +1 -1
- package/dist/controllers/workflow-definition.controller.d.ts.map +1 -1
- package/dist/controllers/workflow-definition.controller.js +2 -6
- package/dist/controllers/workflow-definition.controller.js.map +1 -1
- package/dist/controllers/workflow-execution-artifact.controller.d.ts.map +1 -1
- package/dist/controllers/workflow-execution-artifact.controller.js +2 -6
- package/dist/controllers/workflow-execution-artifact.controller.js.map +1 -1
- package/dist/controllers/workflow-execution-log.controller.d.ts.map +1 -1
- package/dist/controllers/workflow-execution-log.controller.js +2 -6
- package/dist/controllers/workflow-execution-log.controller.js.map +1 -1
- package/dist/controllers/workflow-execution.controller.d.ts.map +1 -1
- package/dist/controllers/workflow-execution.controller.js +2 -6
- package/dist/controllers/workflow-execution.controller.js.map +1 -1
- package/dist/controllers/workflow-secret.controller.d.ts.map +1 -1
- package/dist/controllers/workflow-secret.controller.js +2 -6
- package/dist/controllers/workflow-secret.controller.js.map +1 -1
- package/dist/controllers/workflow-step-execution.controller.d.ts.map +1 -1
- package/dist/controllers/workflow-step-execution.controller.js +2 -6
- package/dist/controllers/workflow-step-execution.controller.js.map +1 -1
- package/dist/controllers/workflow-trigger-execution.controller.d.ts.map +1 -1
- package/dist/controllers/workflow-trigger-execution.controller.js +2 -6
- package/dist/controllers/workflow-trigger-execution.controller.js.map +1 -1
- package/dist/dtos/basic-filters.dto.d.ts +3 -5
- package/dist/dtos/basic-filters.dto.d.ts.map +1 -1
- package/dist/dtos/basic-filters.dto.js +6 -8
- package/dist/dtos/basic-filters.dto.js.map +1 -1
- package/dist/dtos/otp-sign-up.dto.d.ts +1 -0
- package/dist/dtos/otp-sign-up.dto.d.ts.map +1 -1
- package/dist/dtos/otp-sign-up.dto.js +12 -1
- package/dist/dtos/otp-sign-up.dto.js.map +1 -1
- package/dist/enums/show-soft-deleted.enum.d.ts +5 -0
- package/dist/enums/show-soft-deleted.enum.d.ts.map +1 -0
- package/dist/enums/show-soft-deleted.enum.js +9 -0
- package/dist/enums/show-soft-deleted.enum.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/services/authentication.service.d.ts.map +1 -1
- package/dist/services/authentication.service.js +15 -6
- package/dist/services/authentication.service.js.map +1 -1
- package/dist/services/chatter-message.service.d.ts +2 -0
- package/dist/services/chatter-message.service.d.ts.map +1 -1
- package/dist/services/chatter-message.service.js +48 -21
- package/dist/services/chatter-message.service.js.map +1 -1
- package/dist/services/settings/default-settings-provider.service.d.ts +20 -0
- package/dist/services/settings/default-settings-provider.service.d.ts.map +1 -1
- package/dist/services/settings/default-settings-provider.service.js +12 -0
- package/dist/services/settings/default-settings-provider.service.js.map +1 -1
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +5 -1
- package/dist/solid-core.module.js.map +1 -1
- package/package.json +1 -1
- package/postman/signup-intent-verification.postman_collection.json +573 -0
- package/src/constants/media-file-types.ts +76 -24
- package/src/controllers/chatter-message-details.controller.ts +1 -4
- package/src/controllers/chatter-message.controller.ts +1 -4
- package/src/controllers/dashboard-user-layout.controller.ts +1 -4
- package/src/controllers/import-transaction-error-log.controller.ts +1 -4
- package/src/controllers/import-transaction.controller.ts +1 -4
- package/src/controllers/list-of-values.controller.ts +1 -4
- package/src/controllers/locale.controller.ts +1 -4
- package/src/controllers/media.controller.ts +19 -7
- package/src/controllers/model-sequence.controller.ts +1 -4
- package/src/controllers/saved-filters.controller.ts +1 -4
- package/src/controllers/scheduled-job.controller.ts +1 -4
- package/src/controllers/security-rule.controller.ts +1 -4
- package/src/controllers/user-activity-history.controller.ts +1 -4
- package/src/controllers/user-view-metadata.controller.ts +1 -4
- package/src/controllers/workflow-definition.controller.ts +1 -4
- package/src/controllers/workflow-execution-artifact.controller.ts +1 -4
- package/src/controllers/workflow-execution-log.controller.ts +1 -4
- package/src/controllers/workflow-execution.controller.ts +1 -4
- package/src/controllers/workflow-secret.controller.ts +1 -4
- package/src/controllers/workflow-step-execution.controller.ts +1 -4
- package/src/controllers/workflow-trigger-execution.controller.ts +1 -4
- package/src/dtos/basic-filters.dto.ts +6 -7
- package/src/dtos/otp-sign-up.dto.ts +11 -1
- package/src/enums/show-soft-deleted.enum.ts +4 -0
- package/src/index.ts +1 -0
- package/src/services/authentication.service.ts +61 -26
- package/src/services/chatter-message.service.ts +54 -23
- package/src/services/settings/default-settings-provider.service.ts +12 -0
- package/src/solid-core.module.ts +12 -2
|
@@ -8,8 +8,71 @@ export type MediaFileTypeDefinition = {
|
|
|
8
8
|
extension: string;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Extensions that must never be accepted as media uploads, regardless of declared mimetype or
|
|
13
|
+
* admin-configured mediaTypes allowlist. Checked before any other resolution so a spoofed
|
|
14
|
+
* Content-Type (e.g. application/octet-stream on an .html file) can't bypass this.
|
|
15
|
+
*
|
|
16
|
+
* The default list below. A deployment can replace it wholesale via AB_DANGEROUS_EXTENSIONS
|
|
17
|
+
* (comma-separated) - e.g. to accept svg uploads, which some clients legitimately need. This
|
|
18
|
+
* replaces rather than narrows the list: whatever is set there becomes the entire denylist, so
|
|
19
|
+
* anything left out of it becomes an accepted upload type. See default-settings-provider.service.ts
|
|
20
|
+
* for the read-only "dangerousExtensions" setting that surfaces the effective list to admins.
|
|
21
|
+
*/
|
|
22
|
+
const DEFAULT_DANGEROUS_EXTENSIONS = [
|
|
23
|
+
'html', 'htm', 'xhtml', 'svg', 'xml',
|
|
24
|
+
'js', 'mjs', 'php', 'phtml', 'jsp', 'asp', 'aspx',
|
|
25
|
+
'exe', 'sh', 'bat', 'cmd', 'ps1', 'jar', 'dll',
|
|
26
|
+
'msi', 'msix', 'msp', 'com', 'scr', 'vbs', 'vbe', 'wsf', 'wsh', 'hta', 'cpl', 'pif', 'reg',
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
const parseExtensionList = (raw: string): string[] =>
|
|
30
|
+
raw.split(',').map(ext => ext.toLowerCase().trim().replace(/^\./, '')).filter(Boolean);
|
|
31
|
+
|
|
32
|
+
const configuredDangerousExtensions = parseExtensionList(process.env.AB_DANGEROUS_EXTENSIONS ?? '');
|
|
33
|
+
|
|
34
|
+
export const DANGEROUS_EXTENSIONS = new Set(
|
|
35
|
+
configuredDangerousExtensions.length > 0
|
|
36
|
+
? configuredDangerousExtensions
|
|
37
|
+
: DEFAULT_DANGEROUS_EXTENSIONS
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The mimetype gate must track the extension gate: a .svg upload arrives as image/svg+xml, so
|
|
42
|
+
* removing svg from DANGEROUS_EXTENSIONS while image/svg+xml stayed on a separate literal would
|
|
43
|
+
* still reject the upload at isDangerousMediaFile's second check - with a message pointing at
|
|
44
|
+
* nothing the operator changed. Deriving from a single mapping keeps the two in sync.
|
|
45
|
+
*
|
|
46
|
+
* Only browser-rendered types appear here, which is why the resulting set is short (a handful of
|
|
47
|
+
* entries against dozens of dangerous extensions): everything else is dangerous once downloaded
|
|
48
|
+
* and run, and the mimetype sent for those is typically application/octet-stream, which must stay
|
|
49
|
+
* allowed. When adding a browser-renderable extension to the denylist above, add it here too.
|
|
50
|
+
*/
|
|
51
|
+
const DANGEROUS_MIME_TYPES_BY_EXTENSION: Record<string, string[]> = {
|
|
52
|
+
html: ['text/html'],
|
|
53
|
+
htm: ['text/html'],
|
|
54
|
+
xhtml: ['application/xhtml+xml'],
|
|
55
|
+
svg: ['image/svg+xml'],
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Mimetypes that are never safe to accept, regardless of extension. These render as active
|
|
60
|
+
* content in a browser (svg can carry <script>), so they are rejected even when the filename
|
|
61
|
+
* looks harmless. Kept in sync with DANGEROUS_EXTENSIONS via DANGEROUS_MIME_TYPES_BY_EXTENSION
|
|
62
|
+
* above, rather than maintained separately.
|
|
63
|
+
*/
|
|
64
|
+
export const DANGEROUS_MIME_TYPES = new Set(
|
|
65
|
+
Object.entries(DANGEROUS_MIME_TYPES_BY_EXTENSION)
|
|
66
|
+
.filter(([extension]) => DANGEROUS_EXTENSIONS.has(extension))
|
|
67
|
+
.flatMap(([, mimeTypes]) => mimeTypes)
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
// The set of media extensions the system currently recognises - its canonical MIME type, and the
|
|
71
|
+
// coarse media category used across validation and UI metadata. Membership here means
|
|
72
|
+
// "resolvable", not "safe": svg is included only when DANGEROUS_EXTENSIONS has been configured to
|
|
73
|
+
// allow it (see below), since accepting it as an upload also makes it eligible for the inline-safe
|
|
74
|
+
// serving path (INLINE_SAFE_EXTENSIONS further down) - safe there only because of the
|
|
75
|
+
// Content-Security-Policy applied when serving it (solid-core.module.ts, media.controller.ts).
|
|
13
76
|
export const MEDIA_FILE_TYPES: MediaFileTypeDefinition[] = [
|
|
14
77
|
{ mediaType: 'image', mimeType: 'image/png', extension: 'png' },
|
|
15
78
|
{ mediaType: 'image', mimeType: 'image/jpeg', extension: 'jpg' },
|
|
@@ -21,6 +84,12 @@ export const MEDIA_FILE_TYPES: MediaFileTypeDefinition[] = [
|
|
|
21
84
|
{ mediaType: 'image', mimeType: 'image/tiff', extension: 'tiff' },
|
|
22
85
|
{ mediaType: 'image', mimeType: 'image/heic', extension: 'heic' },
|
|
23
86
|
{ mediaType: 'image', mimeType: 'image/heif', extension: 'heif' },
|
|
87
|
+
// Only a media type when explicitly unblocked via AB_DANGEROUS_EXTENSIONS - see the file
|
|
88
|
+
// header comment. Hardcoded to svg specifically: unblocking e.g. html must not make html a
|
|
89
|
+
// media type, since it isn't a format the product supports as an upload.
|
|
90
|
+
...(DANGEROUS_EXTENSIONS.has('svg')
|
|
91
|
+
? []
|
|
92
|
+
: [{ mediaType: 'image', mimeType: 'image/svg+xml', extension: 'svg' } as MediaFileTypeDefinition]),
|
|
24
93
|
|
|
25
94
|
{ mediaType: 'audio', mimeType: 'audio/mpeg', extension: 'mp3' },
|
|
26
95
|
{ mediaType: 'audio', mimeType: 'audio/mp3', extension: 'mp3' },
|
|
@@ -97,28 +166,6 @@ export const MIME_TO_MEDIA_TYPE: Record<string, MediaCategory> = MEDIA_FILE_TYPE
|
|
|
97
166
|
return acc;
|
|
98
167
|
}, {} as Record<string, MediaCategory>);
|
|
99
168
|
|
|
100
|
-
/**
|
|
101
|
-
* Extensions that must never be accepted as media uploads, regardless of declared mimetype or
|
|
102
|
-
* admin-configured mediaTypes allowlist. Checked before any other resolution so a spoofed
|
|
103
|
-
* Content-Type (e.g. application/octet-stream on an .html file) can't bypass this.
|
|
104
|
-
*/
|
|
105
|
-
export const DANGEROUS_EXTENSIONS = new Set([
|
|
106
|
-
'html', 'htm', 'xhtml', 'svg', 'xml',
|
|
107
|
-
'js', 'mjs', 'php', 'phtml', 'jsp', 'asp', 'aspx',
|
|
108
|
-
'exe', 'sh', 'bat', 'cmd', 'ps1', 'jar', 'dll',
|
|
109
|
-
'msi', 'msix', 'msp', 'com', 'scr', 'vbs', 'vbe', 'wsf', 'wsh', 'hta', 'cpl', 'pif', 'reg',
|
|
110
|
-
]);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Mimetypes that are never safe to accept, regardless of extension. These render as active
|
|
115
|
-
* content in a browser (svg can carry <script>), so they are rejected even when the filename
|
|
116
|
-
* looks harmless. Kept alongside DANGEROUS_EXTENSIONS so upload paths check both.
|
|
117
|
-
*/
|
|
118
|
-
export const DANGEROUS_MIME_TYPES = new Set([
|
|
119
|
-
'image/svg+xml', 'text/html', 'application/xhtml+xml',
|
|
120
|
-
]);
|
|
121
|
-
|
|
122
169
|
/**
|
|
123
170
|
* Percent-decodes a filename, repeating a bounded number of times so a double-encoded payload
|
|
124
171
|
* (`%252e` -> `%2e` -> `.`) survives a single pass through a proxy/framework that already
|
|
@@ -264,6 +311,11 @@ export const EXT_TO_MEDIA_TYPE: Record<string, MediaCategory> = {
|
|
|
264
311
|
/**
|
|
265
312
|
* Extensions safe to serve inline with their natural Content-Type; everything else served from
|
|
266
313
|
* media-files-storage is forced to application/octet-stream + Content-Disposition: attachment.
|
|
314
|
+
*
|
|
315
|
+
* svg is included here only when it's an accepted media type (see MEDIA_FILE_TYPES above) - and
|
|
316
|
+
* even then it's inline-safe only because both serve paths (ServeStaticModule in
|
|
317
|
+
* solid-core.module.ts, and the signed-URL download in media.controller.ts) attach a
|
|
318
|
+
* Content-Security-Policy to svg responses that neutralizes any embedded script.
|
|
267
319
|
*/
|
|
268
320
|
export const INLINE_SAFE_EXTENSIONS = new Set<string>([
|
|
269
321
|
...IMAGE_EXTENSIONS,
|
|
@@ -5,10 +5,7 @@ import { ChatterMessageDetailsService } from '../services/chatter-message-detail
|
|
|
5
5
|
import { CreateChatterMessageDetailsDto } from '../dtos/create-chatter-message-details.dto';
|
|
6
6
|
import { UpdateChatterMessageDetailsDto } from '../dtos/update-chatter-message-details.dto';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
INCLUSIVE = "inclusive",
|
|
10
|
-
EXCLUSIVE = "exclusive",
|
|
11
|
-
}
|
|
8
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
12
9
|
|
|
13
10
|
@ApiTags('Solid Core')
|
|
14
11
|
@Controller('chatter-message-details')
|
|
@@ -10,10 +10,7 @@ import { SolidRequestContextDecorator } from 'src/decorators/solid-request-conte
|
|
|
10
10
|
import { SolidRequestContextDto } from 'src/dtos/solid-request-context.dto';
|
|
11
11
|
import { Public } from 'src/decorators/public.decorator';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
INCLUSIVE = "inclusive",
|
|
15
|
-
EXCLUSIVE = "exclusive",
|
|
16
|
-
}
|
|
13
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
17
14
|
|
|
18
15
|
@ApiTags('Solid Core')
|
|
19
16
|
@Controller('chatter-message')
|
|
@@ -5,10 +5,7 @@ import { DashboardUserLayoutService } from '../services/dashboard-user-layout.se
|
|
|
5
5
|
import { CreateDashboardUserLayoutDto } from '../dtos/create-dashboard-user-layout.dto';
|
|
6
6
|
import { UpdateDashboardUserLayoutDto } from '../dtos/update-dashboard-user-layout.dto';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
INCLUSIVE = "inclusive",
|
|
10
|
-
EXCLUSIVE = "exclusive",
|
|
11
|
-
}
|
|
8
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
12
9
|
|
|
13
10
|
@ApiTags('Solid Core')
|
|
14
11
|
@Controller('dashboard-user-layout')
|
|
@@ -5,10 +5,7 @@ import { ImportTransactionErrorLogService } from '../services/import-transaction
|
|
|
5
5
|
import { CreateImportTransactionErrorLogDto } from '../dtos/create-import-transaction-error-log.dto';
|
|
6
6
|
import { UpdateImportTransactionErrorLogDto } from '../dtos/update-import-transaction-error-log.dto';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
INCLUSIVE = "inclusive",
|
|
10
|
-
EXCLUSIVE = "exclusive",
|
|
11
|
-
}
|
|
8
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
12
9
|
|
|
13
10
|
@ApiTags('Solid Core')
|
|
14
11
|
@Controller('import-transaction-error-log')
|
|
@@ -9,10 +9,7 @@ import { ActiveUser } from 'src/decorators/active-user.decorator';
|
|
|
9
9
|
import { ActiveUserData } from 'src/interfaces/active-user-data.interface';
|
|
10
10
|
import { setFileDownloadHeaders } from 'src/helpers/file-download.helper';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
INCLUSIVE = "inclusive",
|
|
14
|
-
EXCLUSIVE = "exclusive",
|
|
15
|
-
}
|
|
12
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
16
13
|
|
|
17
14
|
@ApiTags('Solid Core')
|
|
18
15
|
@Controller('import-transaction')
|
|
@@ -5,10 +5,7 @@ import { ListOfValuesService } from '../services/list-of-values.service';
|
|
|
5
5
|
import { CreateListOfValuesDto } from '../dtos/create-list-of-values.dto';
|
|
6
6
|
import { UpdateListOfValuesDto } from '../dtos/update-list-of-values.dto';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
INCLUSIVE = "inclusive",
|
|
10
|
-
EXCLUSIVE = "exclusive",
|
|
11
|
-
}
|
|
8
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
12
9
|
|
|
13
10
|
@ApiTags('Solid Core')
|
|
14
11
|
@Controller('list-of-values')
|
|
@@ -7,10 +7,7 @@ import { LocaleService } from 'src/services/locale.service';
|
|
|
7
7
|
import { CreateLocaleDto } from 'src/dtos/create-locale.dto';
|
|
8
8
|
import { UpdateLocaleDto } from 'src/dtos/update-locale.dto';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
INCLUSIVE = "inclusive",
|
|
12
|
-
EXCLUSIVE = "exclusive",
|
|
13
|
-
}
|
|
10
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
14
11
|
|
|
15
12
|
@ApiTags('Solid Core')
|
|
16
13
|
@Controller('locale')
|
|
@@ -9,13 +9,10 @@ import { SolidRequestContextDto } from 'src/dtos/solid-request-context.dto';
|
|
|
9
9
|
import { UpdateMediaDto } from 'src/dtos/update-media.dto';
|
|
10
10
|
import { MediaService } from 'src/services/media.service';
|
|
11
11
|
import { Response } from 'express';
|
|
12
|
-
import { getLowercaseFileExtension, INLINE_SAFE_EXTENSIONS } from 'src/constants/media-file-types';
|
|
12
|
+
import { EXTENSION_TO_MIME_TYPE, getLowercaseFileExtension, INLINE_SAFE_EXTENSIONS } from 'src/constants/media-file-types';
|
|
13
13
|
import { setFileDownloadHeaders } from 'src/helpers/file-download.helper';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
INCLUSIVE = "inclusive",
|
|
17
|
-
EXCLUSIVE = "exclusive",
|
|
18
|
-
}
|
|
15
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
19
16
|
|
|
20
17
|
@ApiTags('Solid Core')
|
|
21
18
|
@Controller('media')
|
|
@@ -103,16 +100,31 @@ export class MediaController {
|
|
|
103
100
|
// types is ever safe to render inline. Anything else is forced to download rather than be
|
|
104
101
|
// displayed/executed, regardless of the mimetype the record was stored with - nosniff
|
|
105
102
|
// alone would not help here, since it faithfully honours a declared text/html.
|
|
106
|
-
const
|
|
103
|
+
const ext = getLowercaseFileExtension(fileName) ?? '';
|
|
104
|
+
const isInlineSafe = INLINE_SAFE_EXTENSIONS.has(ext);
|
|
107
105
|
const requestedInline = disposition !== 'attachment';
|
|
108
106
|
|
|
107
|
+
// The served mimetype is derived from the extension rather than trusting the stored
|
|
108
|
+
// mimeType (which is the client-declared Content-Type at upload time, and so is spoofable):
|
|
109
|
+
// a file named logo.png could otherwise have been uploaded with Content-Type: image/svg+xml
|
|
110
|
+
// and stored that way, which would bypass an extension-only check below.
|
|
111
|
+
const effectiveMimeType = isInlineSafe ? (EXTENSION_TO_MIME_TYPE[ext] ?? mimeType) : 'application/octet-stream';
|
|
112
|
+
|
|
109
113
|
setFileDownloadHeaders(res, {
|
|
110
114
|
fileName,
|
|
111
|
-
mimeType:
|
|
115
|
+
mimeType: effectiveMimeType,
|
|
112
116
|
disposition: requestedInline && isInlineSafe ? 'inline' : 'attachment',
|
|
113
117
|
crossOriginResourcePolicy: true,
|
|
114
118
|
});
|
|
115
119
|
|
|
120
|
+
// See the matching comment in solid-core.module.ts's setHeaders: <img>/CSS never execute
|
|
121
|
+
// svg script, but a direct navigation to this URL would, so pin it to a locked-down
|
|
122
|
+
// document. Keyed on the extension (which now drives effectiveMimeType above too), not on
|
|
123
|
+
// the stored mimeType, so the spoofed-Content-Type case above is covered as well.
|
|
124
|
+
if (ext === 'svg') {
|
|
125
|
+
res.setHeader("Content-Security-Policy", "default-src 'none'; style-src 'unsafe-inline'; img-src data:; sandbox");
|
|
126
|
+
}
|
|
127
|
+
|
|
116
128
|
stream.pipe(res);
|
|
117
129
|
}
|
|
118
130
|
|
|
@@ -5,10 +5,7 @@ import { ModelSequenceService } from '../services/model-sequence.service';
|
|
|
5
5
|
import { CreateModelSequenceDto } from '../dtos/create-model-sequence.dto';
|
|
6
6
|
import { UpdateModelSequenceDto } from '../dtos/update-model-sequence.dto';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
INCLUSIVE = "inclusive",
|
|
10
|
-
EXCLUSIVE = "exclusive",
|
|
11
|
-
}
|
|
8
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
12
9
|
|
|
13
10
|
@ApiTags('Solid Core')
|
|
14
11
|
@Controller('model-sequence')
|
|
@@ -5,10 +5,7 @@ import { SavedFiltersService } from '../services/saved-filters.service';
|
|
|
5
5
|
import { CreateSavedFiltersDto } from '../dtos/create-saved-filters.dto';
|
|
6
6
|
import { UpdateSavedFiltersDto } from '../dtos/update-saved-filters.dto';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
INCLUSIVE = "inclusive",
|
|
10
|
-
EXCLUSIVE = "exclusive",
|
|
11
|
-
}
|
|
8
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
12
9
|
|
|
13
10
|
@ApiTags('Solid Core')
|
|
14
11
|
@Controller('saved-filters')
|
|
@@ -5,10 +5,7 @@ import { CreateScheduledJobDto } from 'src/dtos/create-scheduled-job.dto';
|
|
|
5
5
|
import { UpdateScheduledJobDto } from 'src/dtos/update-scheduled-job.dto';
|
|
6
6
|
import { ScheduledJobService } from 'src/services/scheduled-job.service';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
INCLUSIVE = "inclusive",
|
|
10
|
-
EXCLUSIVE = "exclusive",
|
|
11
|
-
}
|
|
8
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
12
9
|
|
|
13
10
|
@ApiTags('Solid Core')
|
|
14
11
|
@Controller('scheduled-job')
|
|
@@ -5,10 +5,7 @@ import { SecurityRuleService } from '../services/security-rule.service';
|
|
|
5
5
|
import { CreateSecurityRuleDto } from '../dtos/create-security-rule.dto';
|
|
6
6
|
import { UpdateSecurityRuleDto } from '../dtos/update-security-rule.dto';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
INCLUSIVE = "inclusive",
|
|
10
|
-
EXCLUSIVE = "exclusive",
|
|
11
|
-
}
|
|
8
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
12
9
|
|
|
13
10
|
@ApiTags('Solid Core')
|
|
14
11
|
@Controller('security-rule')
|
|
@@ -5,10 +5,7 @@ import { UserActivityHistoryService } from '../services/user-activity-history.se
|
|
|
5
5
|
import { CreateUserActivityHistoryDto } from '../dtos/create-user-activity-history.dto';
|
|
6
6
|
import { UpdateUserActivityHistoryDto } from '../dtos/update-user-activity-history.dto';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
INCLUSIVE = "inclusive",
|
|
10
|
-
EXCLUSIVE = "exclusive",
|
|
11
|
-
}
|
|
8
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
12
9
|
|
|
13
10
|
@ApiTags('Solid Core')
|
|
14
11
|
@Controller('user-activity-history')
|
|
@@ -8,10 +8,7 @@ import { UpsertUserViewMetadataDto } from 'src/dtos/upsert-user-view-metadata.dt
|
|
|
8
8
|
import { ActiveUser } from 'src/decorators/active-user.decorator';
|
|
9
9
|
import { ActiveUserData } from 'src/interfaces/active-user-data.interface';
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
INCLUSIVE = "inclusive",
|
|
13
|
-
EXCLUSIVE = "exclusive",
|
|
14
|
-
}
|
|
11
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
15
12
|
|
|
16
13
|
@ApiTags('Solid Core')
|
|
17
14
|
@Controller('user-view-metadata')
|
|
@@ -8,10 +8,7 @@ import { ExecuteWorkflowDto } from '../dtos/execute-workflow.dto';
|
|
|
8
8
|
import { WorkflowNodeRegistryService } from '../services/workflow/workflow-node-registry.service';
|
|
9
9
|
import { ValidateWorkflowDefinitionDto } from '../dtos/validate-workflow-definition.dto';
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
INCLUSIVE = "inclusive",
|
|
13
|
-
EXCLUSIVE = "exclusive",
|
|
14
|
-
}
|
|
11
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
15
12
|
|
|
16
13
|
@ApiTags('Solid Core')
|
|
17
14
|
@Controller('workflow-definition')
|
|
@@ -5,10 +5,7 @@ import { WorkflowExecutionArtifactService } from '../services/workflow-execution
|
|
|
5
5
|
import { CreateWorkflowExecutionArtifactDto } from '../dtos/create-workflow-execution-artifact.dto';
|
|
6
6
|
import { UpdateWorkflowExecutionArtifactDto } from '../dtos/update-workflow-execution-artifact.dto';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
INCLUSIVE = "inclusive",
|
|
10
|
-
EXCLUSIVE = "exclusive",
|
|
11
|
-
}
|
|
8
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
12
9
|
|
|
13
10
|
@ApiTags('Solid Core')
|
|
14
11
|
@Controller('workflow-execution-artifact')
|
|
@@ -5,10 +5,7 @@ import { WorkflowExecutionLogService } from '../services/workflow-execution-log.
|
|
|
5
5
|
import { CreateWorkflowExecutionLogDto } from '../dtos/create-workflow-execution-log.dto';
|
|
6
6
|
import { UpdateWorkflowExecutionLogDto } from '../dtos/update-workflow-execution-log.dto';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
INCLUSIVE = "inclusive",
|
|
10
|
-
EXCLUSIVE = "exclusive",
|
|
11
|
-
}
|
|
8
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
12
9
|
|
|
13
10
|
@ApiTags('Solid Core')
|
|
14
11
|
@Controller('workflow-execution-log')
|
|
@@ -6,10 +6,7 @@ import { CreateWorkflowExecutionDto } from '../dtos/create-workflow-execution.dt
|
|
|
6
6
|
import { UpdateWorkflowExecutionDto } from '../dtos/update-workflow-execution.dto';
|
|
7
7
|
import { WorkflowRuntimeService } from '../services/workflow/workflow-runtime.service';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
INCLUSIVE = "inclusive",
|
|
11
|
-
EXCLUSIVE = "exclusive",
|
|
12
|
-
}
|
|
9
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
13
10
|
|
|
14
11
|
@ApiTags('Solid Core')
|
|
15
12
|
@Controller('workflow-execution')
|
|
@@ -5,10 +5,7 @@ import { WorkflowSecretService } from '../services/workflow-secret.service';
|
|
|
5
5
|
import { CreateWorkflowSecretDto } from '../dtos/create-workflow-secret.dto';
|
|
6
6
|
import { UpdateWorkflowSecretDto } from '../dtos/update-workflow-secret.dto';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
INCLUSIVE = "inclusive",
|
|
10
|
-
EXCLUSIVE = "exclusive",
|
|
11
|
-
}
|
|
8
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
12
9
|
|
|
13
10
|
@ApiTags('Solid Core')
|
|
14
11
|
@Controller('workflow-secret')
|
|
@@ -5,10 +5,7 @@ import { WorkflowStepExecutionService } from '../services/workflow-step-executio
|
|
|
5
5
|
import { CreateWorkflowStepExecutionDto } from '../dtos/create-workflow-step-execution.dto';
|
|
6
6
|
import { UpdateWorkflowStepExecutionDto } from '../dtos/update-workflow-step-execution.dto';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
INCLUSIVE = "inclusive",
|
|
10
|
-
EXCLUSIVE = "exclusive",
|
|
11
|
-
}
|
|
8
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
12
9
|
|
|
13
10
|
@ApiTags('Solid Core')
|
|
14
11
|
@Controller('workflow-step-execution')
|
|
@@ -5,10 +5,7 @@ import { WorkflowTriggerExecutionService } from '../services/workflow-trigger-ex
|
|
|
5
5
|
import { CreateWorkflowTriggerExecutionDto } from '../dtos/create-workflow-trigger-execution.dto';
|
|
6
6
|
import { UpdateWorkflowTriggerExecutionDto } from '../dtos/update-workflow-trigger-execution.dto';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
INCLUSIVE = "inclusive",
|
|
10
|
-
EXCLUSIVE = "exclusive",
|
|
11
|
-
}
|
|
8
|
+
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
12
9
|
|
|
13
10
|
@ApiTags('Solid Core')
|
|
14
11
|
@Controller('workflow-trigger-execution')
|
|
@@ -4,11 +4,10 @@ import { IsEnum, IsOptional } from "class-validator";
|
|
|
4
4
|
import { PaginationQueryDto } from "./pagination-query.dto";
|
|
5
5
|
import { Timestamp } from "typeorm";
|
|
6
6
|
import { BasicGroupFilterDto } from "./basic-group-filters.dto";
|
|
7
|
+
import { ShowSoftDeleted } from "../enums/show-soft-deleted.enum";
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
EXCLUSIVE = "exclusive",
|
|
11
|
-
}
|
|
9
|
+
// Backwards-compatible alias for consumers using the older DTO name.
|
|
10
|
+
export { ShowSoftDeleted as SoftDeleteFilter } from "../enums/show-soft-deleted.enum";
|
|
12
11
|
|
|
13
12
|
export class BasicFilterDto extends PaginationQueryDto {
|
|
14
13
|
|
|
@@ -41,12 +40,12 @@ export class BasicFilterDto extends PaginationQueryDto {
|
|
|
41
40
|
// readonly filters: any[];
|
|
42
41
|
|
|
43
42
|
@IsOptional()
|
|
44
|
-
@IsEnum(
|
|
43
|
+
@IsEnum(ShowSoftDeleted)
|
|
45
44
|
@ApiProperty({
|
|
46
45
|
description: "showSoftDeleted",
|
|
47
|
-
enum:
|
|
46
|
+
enum: ShowSoftDeleted,
|
|
48
47
|
})
|
|
49
|
-
readonly showSoftDeleted?:
|
|
48
|
+
readonly showSoftDeleted?: ShowSoftDeleted;
|
|
50
49
|
|
|
51
50
|
@IsOptional()
|
|
52
51
|
@ApiProperty({ description: "populateGroup" })
|
|
@@ -1,17 +1,26 @@
|
|
|
1
|
-
import { IsEmail, IsEnum, IsJSON, IsNotEmpty, IsOptional } from 'class-validator';
|
|
1
|
+
import { IsEmail, IsEnum, IsJSON, IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
|
2
2
|
|
|
3
3
|
import { PasswordlessRegistrationValidateWhatSources } from "../constants";
|
|
4
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
4
5
|
|
|
5
6
|
export class OTPSignUpDto {
|
|
7
|
+
@IsOptional()
|
|
8
|
+
@IsString()
|
|
9
|
+
@ApiProperty()
|
|
10
|
+
fullName: string;
|
|
11
|
+
|
|
6
12
|
@IsNotEmpty()
|
|
13
|
+
@ApiProperty()
|
|
7
14
|
username: string;
|
|
8
15
|
|
|
9
16
|
@IsOptional()
|
|
10
17
|
@IsEmail()
|
|
18
|
+
@ApiProperty()
|
|
11
19
|
email: string;
|
|
12
20
|
|
|
13
21
|
@IsOptional()
|
|
14
22
|
@IsNotEmpty()
|
|
23
|
+
@ApiProperty()
|
|
15
24
|
mobile: string;
|
|
16
25
|
|
|
17
26
|
@IsOptional()
|
|
@@ -19,5 +28,6 @@ export class OTPSignUpDto {
|
|
|
19
28
|
validationSources: PasswordlessRegistrationValidateWhatSources[] = [];
|
|
20
29
|
|
|
21
30
|
@IsOptional()
|
|
31
|
+
@ApiProperty()
|
|
22
32
|
customPayload: any;
|
|
23
33
|
}
|
package/src/index.ts
CHANGED
|
@@ -194,6 +194,7 @@ export * from './entities/workflow-secret.entity'
|
|
|
194
194
|
export * from './enums/auth-type.enum'
|
|
195
195
|
export * from './enums/legacy-table-type.enum'
|
|
196
196
|
export * from './enums/signup-intent.enum'
|
|
197
|
+
export * from './enums/show-soft-deleted.enum'
|
|
197
198
|
export * from './decorators/disallow-in-production.decorator'
|
|
198
199
|
|
|
199
200
|
export * from './filters/http-exception.filter'
|