@dcl/schemas 19.4.1 → 19.5.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.
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/url-validation.d.ts +27 -0
- package/dist/core/url-validation.d.ts.map +1 -0
- package/dist/core/url-validation.js +257 -0
- package/dist/core/url-validation.js.map +1 -0
- package/dist/schemas.d.ts +31 -1
- package/package.json +2 -2
package/dist/core/index.d.ts
CHANGED
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
|
package/dist/core/index.js
CHANGED
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./parcel-validation"), exports);
|
|
18
18
|
__exportStar(require("./parcel-exceptions"), exports);
|
|
19
|
+
__exportStar(require("./url-validation"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAmC;AACnC,sDAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAmC;AACnC,sDAAmC;AACnC,mDAAgC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for URL validation
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export interface UrlValidationConfig {
|
|
6
|
+
/** Whether to allow localhost and private IPs (useful for development) */
|
|
7
|
+
allowLocalhost?: boolean;
|
|
8
|
+
/** Additional ports to allow beyond the default 80, 443 */
|
|
9
|
+
allowedPorts?: string[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Validates if a URL string is safe
|
|
13
|
+
* @param url - The URL string to validate
|
|
14
|
+
* @param config - Validation configuration
|
|
15
|
+
* @returns true if the URL is safe, false if it contains malicious content
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export declare function validateUrl(url: string, config?: UrlValidationConfig): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Validates if a URL instance is safe
|
|
21
|
+
* @param url - The URL instance to validate
|
|
22
|
+
* @param config - Validation configuration
|
|
23
|
+
* @returns true if the URL is safe, false otherwise
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export declare function validateUrlInstance(url: URL, config?: UrlValidationConfig): boolean;
|
|
27
|
+
//# sourceMappingURL=url-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-validation.d.ts","sourceRoot":"","sources":["../../src/core/url-validation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,0EAA0E;IAC1E,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;CACxB;AAuKD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,mBAAwB,GAAG,OAAO,CA4GlF;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,GAAE,mBAAwB,GAAG,OAAO,CAEvF"}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateUrlInstance = exports.validateUrl = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Default configuration for URL validation
|
|
6
|
+
*/
|
|
7
|
+
const DEFAULT_CONFIG = {
|
|
8
|
+
allowLocalhost: false,
|
|
9
|
+
allowedPorts: []
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Normalize and decode URL string defensively
|
|
13
|
+
*/
|
|
14
|
+
function decodeAndNormalize(s, times = 2) {
|
|
15
|
+
let out = s;
|
|
16
|
+
for (let i = 0; i < times; i++) {
|
|
17
|
+
try {
|
|
18
|
+
out = decodeURIComponent(out);
|
|
19
|
+
}
|
|
20
|
+
catch (_a) {
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return out.normalize('NFKC');
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Check for control characters or bidirectional text
|
|
28
|
+
*
|
|
29
|
+
* Control characters (0x00-0x1F, 0x7F-0x9F) and bidirectional text controls
|
|
30
|
+
* can be used to:
|
|
31
|
+
* - Hide malicious content in URLs (e.g., null bytes to terminate strings)
|
|
32
|
+
* - Create visual confusion attacks (bidirectional text can reverse display order)
|
|
33
|
+
* - Bypass security filters that don't handle these characters properly
|
|
34
|
+
*
|
|
35
|
+
* Example XSS vector: "https://example.com/path\u202Eevil.com"
|
|
36
|
+
* The RLO (Right-to-Left Override) character can make "evil.com" appear before "path"
|
|
37
|
+
*/
|
|
38
|
+
function hasControlOrBidi(s) {
|
|
39
|
+
return /[\u0000-\u001F\u007F-\u009F\u202A-\u202E\u2066-\u2069]/.test(s);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Check if URL has credentials
|
|
43
|
+
*/
|
|
44
|
+
function hasCredentials(u) {
|
|
45
|
+
return Boolean(u.username || u.password);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Check for backslashes
|
|
49
|
+
*
|
|
50
|
+
* Backslashes can be used to:
|
|
51
|
+
* - Escape characters in contexts where they're interpreted (e.g., Windows paths)
|
|
52
|
+
* - Create paths that bypass validation (e.g., "C:\Windows\System32" vs "/Windows/System32")
|
|
53
|
+
* - Inject code in parsers that don't properly handle backslash escaping
|
|
54
|
+
*
|
|
55
|
+
* Example: "https://example.com/path\\..\\..\\etc\\passwd" could be interpreted
|
|
56
|
+
* as a directory traversal attack on Windows systems
|
|
57
|
+
*/
|
|
58
|
+
function hasBackslash(s) {
|
|
59
|
+
return /\\/.test(s);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Default allowed ports for URL validation (SSRF protection)
|
|
63
|
+
* Standard HTTP/HTTPS ports (80, 443)
|
|
64
|
+
*/
|
|
65
|
+
const DEFAULT_ALLOWED_PORTS = ['80', '443'];
|
|
66
|
+
/**
|
|
67
|
+
* Check if port is disallowed (SSRF protection)
|
|
68
|
+
* Only allows ports defined in the allowed ports list
|
|
69
|
+
*/
|
|
70
|
+
function isDisallowedPort(u, allowedPorts) {
|
|
71
|
+
return !!u.port && !allowedPorts.includes(u.port);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Check if hostname is private/local
|
|
75
|
+
* Note: If implementing domain whitelists, convert hostname to ASCII (punycode)
|
|
76
|
+
* before comparison to avoid homograph attacks
|
|
77
|
+
*/
|
|
78
|
+
function isPrivateHost(hostname) {
|
|
79
|
+
const normalized = hostname.toLowerCase();
|
|
80
|
+
// Check for localhost variants
|
|
81
|
+
if (normalized === 'localhost' || normalized.endsWith('.local')) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
// Check for private IP ranges (basic regex check)
|
|
85
|
+
if (/^(127\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.|192\.168\.|169\.254\.)/.test(normalized)) {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
// Check for IPv6 localhost
|
|
89
|
+
if (normalized === '::1' ||
|
|
90
|
+
normalized === '[::1]' ||
|
|
91
|
+
normalized.startsWith('fe80:') ||
|
|
92
|
+
normalized.startsWith('fc00:')) {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Safely parse URL supporting both absolute and relative URLs
|
|
99
|
+
*/
|
|
100
|
+
function safeParseUrl(urlString) {
|
|
101
|
+
// Block protocol-relative URLs (//host) for security
|
|
102
|
+
if (urlString.startsWith('//')) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
// Try parsing as absolute URL first
|
|
107
|
+
return { url: new URL(urlString), wasRelative: false };
|
|
108
|
+
}
|
|
109
|
+
catch (_a) {
|
|
110
|
+
try {
|
|
111
|
+
// If it fails, try as relative URL with a safe base
|
|
112
|
+
return { url: new URL(urlString, 'https://example.com'), wasRelative: true };
|
|
113
|
+
}
|
|
114
|
+
catch (_b) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Validates if a string contains potentially malicious content
|
|
121
|
+
*/
|
|
122
|
+
function isSafeString(value) {
|
|
123
|
+
const normalized = decodeAndNormalize(String(value).toLowerCase());
|
|
124
|
+
// Check for control characters and backslashes
|
|
125
|
+
if (hasControlOrBidi(normalized) || hasBackslash(normalized)) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Validates if a URL path is safe
|
|
132
|
+
*/
|
|
133
|
+
function isSafePath(path) {
|
|
134
|
+
if (!path) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
// Prevent directory traversal attacks
|
|
138
|
+
// Note: Blocking // in paths is strict policy - if legitimate paths could have collapsed //,
|
|
139
|
+
// consider normalizing /{2,}→/ instead of rejecting
|
|
140
|
+
if (path.includes('..') || path.includes('//')) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
// Check for control characters and backslashes
|
|
144
|
+
if (hasControlOrBidi(path) || hasBackslash(path)) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Validates if a URL string is safe
|
|
151
|
+
* @param url - The URL string to validate
|
|
152
|
+
* @param config - Validation configuration
|
|
153
|
+
* @returns true if the URL is safe, false if it contains malicious content
|
|
154
|
+
* @public
|
|
155
|
+
*/
|
|
156
|
+
function validateUrl(url, config = {}) {
|
|
157
|
+
const mergedConfig = Object.assign(Object.assign({}, DEFAULT_CONFIG), config);
|
|
158
|
+
const allowedPorts = [...DEFAULT_ALLOWED_PORTS, ...mergedConfig.allowedPorts];
|
|
159
|
+
// Check for null/undefined/empty
|
|
160
|
+
if (!url || url.length === 0) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
// Check URL length limit (4KB)
|
|
164
|
+
if (url.length > 4096) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
// Early check for control characters, bidirectional text, and backslashes in raw URL
|
|
168
|
+
if (hasControlOrBidi(url) || hasBackslash(url)) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
// Early check on decoded URL to catch encoded escapes (%5C, %0a, etc.)
|
|
172
|
+
const decoded = decodeAndNormalize(url);
|
|
173
|
+
if (hasControlOrBidi(decoded) || hasBackslash(decoded)) {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
// Block protocol-relative URLs (//host)
|
|
177
|
+
if (url.startsWith('//')) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
const parsed = safeParseUrl(url);
|
|
181
|
+
if (!parsed) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
const { url: urlObj, wasRelative } = parsed;
|
|
185
|
+
// Check protocol - only allow http, https, and relative protocols
|
|
186
|
+
if (urlObj.protocol !== 'http:' && urlObj.protocol !== 'https:' && urlObj.protocol !== '') {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
// Check for credentials and backslashes
|
|
190
|
+
if (hasCredentials(urlObj) || hasBackslash(url) || hasBackslash(urlObj.href)) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
// Only check host/port/SSRF for absolute URLs
|
|
194
|
+
if (!wasRelative) {
|
|
195
|
+
// Check for disallowed ports
|
|
196
|
+
if (isDisallowedPort(urlObj, allowedPorts)) {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
// Check for private hosts (SSRF protection) - configurable for development
|
|
200
|
+
if (!mergedConfig.allowLocalhost && urlObj.hostname && isPrivateHost(urlObj.hostname)) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
// Check path for directory traversal and malicious paths
|
|
205
|
+
if (!isSafePath(urlObj.pathname)) {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
// Check path length limit (2KB)
|
|
209
|
+
if (urlObj.pathname.length > 2048) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
// Check search parameters for malicious content and limits
|
|
213
|
+
const paramEntries = Array.from(urlObj.searchParams.entries());
|
|
214
|
+
if (paramEntries.length > 50) {
|
|
215
|
+
return false; // Too many parameters
|
|
216
|
+
}
|
|
217
|
+
// Check total query string length (2KB limit)
|
|
218
|
+
const queryLength = urlObj.search
|
|
219
|
+
? urlObj.search.startsWith('?')
|
|
220
|
+
? urlObj.search.length - 1
|
|
221
|
+
: urlObj.search.length
|
|
222
|
+
: 0;
|
|
223
|
+
if (queryLength > 2048) {
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
for (const [key, value] of paramEntries) {
|
|
227
|
+
// Reject empty keys
|
|
228
|
+
if (key.length === 0) {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
if (!isSafeString(key) || !isSafeString(value)) {
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
// Check parameter size limits
|
|
235
|
+
if (key.length > 128 || value.length > 1024) {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
// Check fragment for control characters
|
|
240
|
+
if (urlObj.hash && hasControlOrBidi(urlObj.hash)) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
exports.validateUrl = validateUrl;
|
|
246
|
+
/**
|
|
247
|
+
* Validates if a URL instance is safe
|
|
248
|
+
* @param url - The URL instance to validate
|
|
249
|
+
* @param config - Validation configuration
|
|
250
|
+
* @returns true if the URL is safe, false otherwise
|
|
251
|
+
* @public
|
|
252
|
+
*/
|
|
253
|
+
function validateUrlInstance(url, config = {}) {
|
|
254
|
+
return validateUrl(url.toString(), config);
|
|
255
|
+
}
|
|
256
|
+
exports.validateUrlInstance = validateUrlInstance;
|
|
257
|
+
//# sourceMappingURL=url-validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-validation.js","sourceRoot":"","sources":["../../src/core/url-validation.ts"],"names":[],"mappings":";;;AAWA;;GAEG;AACH,MAAM,cAAc,GAAkC;IACpD,cAAc,EAAE,KAAK;IACrB,YAAY,EAAE,EAAE;CACjB,CAAA;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,CAAS,EAAE,KAAK,GAAG,CAAC;IAC9C,IAAI,GAAG,GAAG,CAAC,CAAA;IACX,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;QAC9B,IAAI;YACF,GAAG,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAA;SAC9B;QAAC,WAAM;YACN,MAAK;SACN;KACF;IACD,OAAO,GAAG,CAAC,SAAS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,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE;YAC9C,OAAO,KAAK,CAAA;SACb;QAED,8BAA8B;QAC9B,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,MAAM,GAAG,IAAI,EAAE;YAC3C,OAAO,KAAK,CAAA;SACb;KACF;IAED,wCAAwC;IACxC,IAAI,MAAM,CAAC,IAAI,IAAI,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QAChD,OAAO,KAAK,CAAA;KACb;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AA5GD,kCA4GC;AAED;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAAC,GAAQ,EAAE,SAA8B,EAAE;IAC5E,OAAO,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAA;AAC5C,CAAC;AAFD,kDAEC"}
|
package/dist/schemas.d.ts
CHANGED
|
@@ -1300,7 +1300,8 @@ export declare namespace EthAddress {
|
|
|
1300
1300
|
const validate: ValidateFunction<EthAddress>;
|
|
1301
1301
|
}
|
|
1302
1302
|
|
|
1303
|
-
|
|
1303
|
+
declare type Event_2 = BadgeGrantedEvent | BidAcceptedEvent | BidReceivedEvent | CampaignGasPriceHigherThanExpectedEvent | CampaignOutOfFundsEvent | CampaignOutOfStockEvent | CatalystDeploymentEvent | CollectionCreatedEvent | FriendshipRequestEvent | FriendshipAcceptedEvent | ItemPublishedEvent | ItemSoldEvent | LoggedInEvent | LoggedInCachedEvent | MoveToParcelEvent | PassportOpenedEvent | RentalEndedEvent | RentalStartedEvent | RewardAssignedEvent | RewardDelayedEvent | RewardInProgressEvent | RoyaltiesEarnedEvent | UsedEmoteEvent | VerticalHeightReachedEvent | WalkedDistanceEvent | CreditsGoalCompletedEvent | CreditsOnDemandEvent | StreamingKeyResetEvent | StreamingKeyRevokeEvent | StreamingKeyExpiredEvent | StreamingTimeExceededEvent | StreamingPlaceUpdatedEvent | UserJoinedRoomEvent | UserLeftRoomEvent | UserBannedFromSceneEvent | UserUnbannedFromSceneEvent | CreditsCompleteGoalsReminderEvent | CreditsUsageReminderEvent | CreditsUsage24HoursReminderEvent | CreditsDoNotMissOutReminderEvent | CreditsClaimReminderEvent | ReferralInvitedUsersAcceptedEvent | ReferralNewTierReachedEvent | CommunityDeletedEvent | CommunityDeletedContentViolationEvent | CommunityRenamedEvent | CommunityMemberBannedEvent | CommunityMemberRemovedEvent | CommunityRequestToJoinReceivedEvent | CommunityRequestToJoinAcceptedEvent | CommunityInviteReceivedEvent | PhotoTakenEvent | PhotoPrivacyChangedEvent | AuthIdentifyEvent | EventCreatedEvent | EventStartedEvent | EventStartsSoonEvent | GovernanceProposalEnactedEvent | GovernanceCoauthorRequestedEvent | GovernancePitchPassedEvent | GovernanceTenderPassedEvent | GovernanceAuthoredProposalFinishedEvent | GovernanceVotingEndedVoterEvent | GovernanceNewCommentOnProposalEvent | GovernanceNewCommentOnProjectUpdatedEvent | GovernanceWhaleVoteEvent | GovernanceVotedOnBehalfEvent | GovernanceCliffEndedEvent | WorldsPermissionGrantedEvent | WorldsPermissionRevokedEvent | WorldsAccessRestoredEvent | WorldsAccessRestrictedEvent | WorldsMissingResourcesEvent;
|
|
1304
|
+
export { Event_2 as Event }
|
|
1304
1305
|
|
|
1305
1306
|
export declare type EventCreatedEvent = BaseEvent & {
|
|
1306
1307
|
type: Events.Type.EVENT;
|
|
@@ -4048,6 +4049,17 @@ declare namespace Update {
|
|
|
4048
4049
|
const validate: ValidateFunction<Update>;
|
|
4049
4050
|
}
|
|
4050
4051
|
|
|
4052
|
+
/**
|
|
4053
|
+
* Configuration for URL validation
|
|
4054
|
+
* @public
|
|
4055
|
+
*/
|
|
4056
|
+
export declare interface UrlValidationConfig {
|
|
4057
|
+
/** Whether to allow localhost and private IPs (useful for development) */
|
|
4058
|
+
allowLocalhost?: boolean;
|
|
4059
|
+
/** Additional ports to allow beyond the default 80, 443 */
|
|
4060
|
+
allowedPorts?: string[];
|
|
4061
|
+
}
|
|
4062
|
+
|
|
4051
4063
|
export declare type USDPeggedManaTradeAsset = BaseTradeAsset & {
|
|
4052
4064
|
assetType: TradeAssetType.USD_PEGGED_MANA;
|
|
4053
4065
|
amount: string;
|
|
@@ -4144,6 +4156,24 @@ export declare interface ValidateFunction<T = unknown> {
|
|
|
4144
4156
|
*/
|
|
4145
4157
|
export declare function validateType<T>(theType: Pick<AbstractTypedSchema<T>, 'validate'>, value: T): boolean;
|
|
4146
4158
|
|
|
4159
|
+
/**
|
|
4160
|
+
* Validates if a URL string is safe
|
|
4161
|
+
* @param url - The URL string to validate
|
|
4162
|
+
* @param config - Validation configuration
|
|
4163
|
+
* @returns true if the URL is safe, false if it contains malicious content
|
|
4164
|
+
* @public
|
|
4165
|
+
*/
|
|
4166
|
+
export declare function validateUrl(url: string, config?: UrlValidationConfig): boolean;
|
|
4167
|
+
|
|
4168
|
+
/**
|
|
4169
|
+
* Validates if a URL instance is safe
|
|
4170
|
+
* @param url - The URL instance to validate
|
|
4171
|
+
* @param config - Validation configuration
|
|
4172
|
+
* @returns true if the URL is safe, false otherwise
|
|
4173
|
+
* @public
|
|
4174
|
+
*/
|
|
4175
|
+
export declare function validateUrlInstance(url: URL, config?: UrlValidationConfig): boolean;
|
|
4176
|
+
|
|
4147
4177
|
/**
|
|
4148
4178
|
* World Range
|
|
4149
4179
|
* @alpha
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "19.
|
|
2
|
+
"version": "19.5.0",
|
|
3
3
|
"name": "@dcl/schemas",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"typings": "./dist/index.d.ts",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"files": [
|
|
46
46
|
"dist"
|
|
47
47
|
],
|
|
48
|
-
"commit": "
|
|
48
|
+
"commit": "354472fe4a8bbc550bc2253f8c526617ed8e84ba"
|
|
49
49
|
}
|