@neon-pixels/sentry 0.0.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.
- package/LICENSE +21 -0
- package/README.md +95 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.js +505 -0
- package/package.json +43 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Neon Pixels Studio
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# @neon-pixels/sentry
|
|
2
|
+
|
|
3
|
+
Sentry event scrubbing, an expected-client-error filter, filter lists, and environment naming, as plain functions that work with any Sentry SDK. One entry point; it imports cleanly in a browser bundle, a server runtime, and a Netlify function. There is no runtime import of a Sentry SDK and no Node built-in.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm add @neon-pixels/sentry
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
`@sentry/core` is an optional peer dependency used only for TypeScript types (`Event`, `EventHint`). Under pnpm's strict layout, add `@sentry/core` as a dev dependency of your app if you want the types to resolve.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import {
|
|
17
|
+
DENIED_URLS,
|
|
18
|
+
IGNORED_ERRORS,
|
|
19
|
+
allowUrlsFor,
|
|
20
|
+
dropExpectedClientErrors,
|
|
21
|
+
resolveSentryEnvironment,
|
|
22
|
+
scrubEvent,
|
|
23
|
+
scrubRecordingEvent,
|
|
24
|
+
scrubReplayEvent,
|
|
25
|
+
scrubSpan,
|
|
26
|
+
} from "@neon-pixels/sentry";
|
|
27
|
+
|
|
28
|
+
Sentry.init({
|
|
29
|
+
dsn,
|
|
30
|
+
environment: resolveSentryEnvironment({
|
|
31
|
+
netlifyContext: process.env.CONTEXT,
|
|
32
|
+
isE2e: Boolean(process.env.E2E_DATABASE_URL),
|
|
33
|
+
}),
|
|
34
|
+
// Raise the cap so beforeSend sees whole values (see MAX_SCRUB_LENGTH).
|
|
35
|
+
maxValueLength: 8192,
|
|
36
|
+
allowUrls: allowUrlsFor(["https://example.com"]),
|
|
37
|
+
denyUrls: [...DENIED_URLS],
|
|
38
|
+
ignoreErrors: [...IGNORED_ERRORS],
|
|
39
|
+
beforeSend: (event, hint) => {
|
|
40
|
+
const kept = dropExpectedClientErrors(event, hint);
|
|
41
|
+
return kept && scrubEvent(kept);
|
|
42
|
+
},
|
|
43
|
+
beforeSendTransaction: scrubEvent,
|
|
44
|
+
beforeSendSpan: scrubSpan,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Replay bypasses beforeSend, so scrub its frames and events too.
|
|
48
|
+
replayIntegration({ beforeAddRecordingEvent: scrubRecordingEvent });
|
|
49
|
+
Sentry.addEventProcessor(scrubReplayEvent);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Calling `Sentry.init` and deciding when Replay starts stay in your app.
|
|
53
|
+
|
|
54
|
+
### `scrubEvent(event)`
|
|
55
|
+
|
|
56
|
+
Returns a scrubbed copy and never throws. Use it as `beforeSend` and as `beforeSendTransaction`. It covers the message, log entry, exception values, stack-frame variables, paths, and source lines, breadcrumbs, `extra`, `contexts`, `tags`, `user`, `transaction`, spans, and request data (URL, query string, cookies, headers, body). Fields that hold no user data (ids, timestamps, `level`, `release`, `sdk`) are left as they are, and the SDK's private `sdkProcessingMetadata` is neither read nor changed.
|
|
57
|
+
|
|
58
|
+
- **Sensitive keys.** Any value under a key matching authorization, cookie, password, API key, secret, token, private key, access key, credential, or signature (or is named `auth` or `sig`) becomes `[redacted]`, whatever its type (objects and numbers included; only booleans, null, and numeric usage counts under a plural `tokens` key such as `input_tokens` stay).
|
|
59
|
+
- **Patterns, wherever a string appears.** URLs with credentials (`[redacted-url]`), `Basic` and `Bearer` tokens, `Authorization` and `Cookie` header text, `key=value` and JSON pairs with a sensitive key, Stripe keys and webhook secrets, JSON Web Tokens, PEM blocks (including one cut off by the length cap), and email addresses.
|
|
60
|
+
- **URLs.** Query values and the whole fragment are redacted in full URLs, in URLs embedded in free text, and in the separate `http.query`, `url.query`, `http.fragment`, `url.fragment`, and `query_string` fields. Parameter names stay, so events remain groupable.
|
|
61
|
+
- **Limits.** Circular references become `[circular]`, structures stop at a fixed depth (`[truncated]`), and a string longer than `MAX_SCRUB_LENGTH` is cut at its last whitespace so a secret is never split in half.
|
|
62
|
+
- **Failure.** A section that cannot be scrubbed (for example a getter that throws) is removed rather than sent raw, and its name is added to the `sentry_scrub_dropped` tag.
|
|
63
|
+
|
|
64
|
+
### Spans and Replay
|
|
65
|
+
|
|
66
|
+
- `scrubSpan(span)` for `beforeSendSpan`. Handles static spans and streamed spans (`name` plus `attributes`, including `{ value, type }` wrapped attributes). A section it cannot scrub is removed and named in `data` (or `attributes`) under `sentry_scrub_dropped`.
|
|
67
|
+
- `scrubRecordingEvent(event)` for Replay's `beforeAddRecordingEvent`. Replay passes only its custom frames (navigation and network breadcrumbs) to that hook; it returns `null`, which drops the frame, if any part of it cannot be scrubbed. Use Replay's own masking options for the rest of the recording.
|
|
68
|
+
- `scrubReplayEvent(event)` for replay events. It applies the general scrub and drops the query string and fragment from `urls`, `request.url`, and the `Referer` and `Location` headers. Events of any other type are returned untouched.
|
|
69
|
+
|
|
70
|
+
None of them read private SDK fields.
|
|
71
|
+
|
|
72
|
+
### Your own token formats
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
import { createScrubber } from "@neon-pixels/sentry";
|
|
76
|
+
|
|
77
|
+
export const { scrubEvent, scrubSpan, scrubRecordingEvent, scrubReplayEvent } =
|
|
78
|
+
createScrubber({ extraPatterns: [/\bacme_[a-z0-9]{16}\b/] });
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Extra patterns run before the built-in ones, are made global, and replace every match with `[redacted]`. The default exports above use no extra patterns. `scrubText`, `scrubUrl`, and `scrubValue` scrub a string, a URL, or any value on their own.
|
|
82
|
+
|
|
83
|
+
### `dropExpectedClientErrors(event, hint)`
|
|
84
|
+
|
|
85
|
+
Returns `null` for a handled error whose `statusCode` is 300 to 499 (a 404 or a validation failure thrown on purpose), so it never reaches Sentry. It detects the error by shape, with no framework import. An error with `unhandled: true`, or an exception mechanism with `handled: false`, is always kept.
|
|
86
|
+
|
|
87
|
+
### Filter lists
|
|
88
|
+
|
|
89
|
+
- `IGNORED_ERRORS`: known benign browser messages (ResizeObserver loop notices). Pass as `ignoreErrors`.
|
|
90
|
+
- `DENIED_URLS`: browser extension script URLs. Pass as `denyUrls`.
|
|
91
|
+
- `allowUrlsFor(origins)`: builds `allowUrls` from origins such as `https://example.com`. It throws on an origin that does not parse and on an empty list, because an empty `allowUrls` allows every script.
|
|
92
|
+
|
|
93
|
+
### `resolveSentryEnvironment({ netlifyContext, isE2e })`
|
|
94
|
+
|
|
95
|
+
Sentry's default environment is `production`, which files preview errors as production incidents. This returns `e2e` when `isE2e` is set, `production` for the `production` Netlify context, `preview` for `deploy-preview` and `branch-deploy`, and `development` for everything else. Netlify's `CONTEXT` is a build-time variable: it is not set in the Functions runtime, so resolve the name at build time and pass it down.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Event, EventHint } from "@sentry/core";
|
|
2
|
+
type TextScrubber = (text: string) => string;
|
|
3
|
+
export declare const REDACTED = "[redacted]";
|
|
4
|
+
export declare const REDACTED_URL = "[redacted-url]";
|
|
5
|
+
export declare const CIRCULAR = "[circular]";
|
|
6
|
+
export declare const TRUNCATED = "[truncated]";
|
|
7
|
+
export declare const BINARY = "[binary]";
|
|
8
|
+
export declare const MAX_SCRUB_LENGTH = 8192;
|
|
9
|
+
export declare const MAX_SCRUB_DEPTH = 10;
|
|
10
|
+
export declare const SCRUB_DROPPED_TAG = "sentry_scrub_dropped";
|
|
11
|
+
export declare const SENTRY_ENVIRONMENT_PRODUCTION = "production";
|
|
12
|
+
export declare const SENTRY_ENVIRONMENT_PREVIEW = "preview";
|
|
13
|
+
export declare const SENTRY_ENVIRONMENT_E2E = "e2e";
|
|
14
|
+
export declare const SENTRY_ENVIRONMENT_DEVELOPMENT = "development";
|
|
15
|
+
interface SentryEnvironmentInput {
|
|
16
|
+
/** Netlify's deploy `CONTEXT`. Build-time only: it is not set in Functions. */
|
|
17
|
+
netlifyContext?: string | undefined;
|
|
18
|
+
isE2e?: boolean | undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Sentry's own default environment is "production", which files preview
|
|
22
|
+
* errors as production incidents. Anything that is not a recognised Netlify
|
|
23
|
+
* context (local dev, a local build) is "development" so it can never be
|
|
24
|
+
* mistaken for production.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveSentryEnvironment(input?: SentryEnvironmentInput): string;
|
|
27
|
+
/**
|
|
28
|
+
* Returns `null` for a handled error whose `statusCode` is 300 to 499 (a 404
|
|
29
|
+
* or a validation failure thrown on purpose), so it never reaches Sentry.
|
|
30
|
+
* Detected by shape, so it works with any framework's error class. Use it
|
|
31
|
+
* inside `beforeSend`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function dropExpectedClientErrors<T extends Event>(event: T, hint?: EventHint): T | null;
|
|
34
|
+
export declare const DENIED_URLS: readonly RegExp[];
|
|
35
|
+
export declare const IGNORED_ERRORS: readonly RegExp[];
|
|
36
|
+
/**
|
|
37
|
+
* Builds Sentry's `allowUrls` list from origins such as
|
|
38
|
+
* `https://example.com`. Throws on an origin that does not parse, because an
|
|
39
|
+
* empty `allowUrls` silently allows every script.
|
|
40
|
+
*/
|
|
41
|
+
export declare function allowUrlsFor(origins: readonly string[]): RegExp[];
|
|
42
|
+
interface ScrubberOptions {
|
|
43
|
+
/**
|
|
44
|
+
* Patterns for the app's own token formats. Every match is replaced with
|
|
45
|
+
* `[redacted]`. They run before the built-in patterns and are made global.
|
|
46
|
+
*/
|
|
47
|
+
extraPatterns?: readonly RegExp[];
|
|
48
|
+
}
|
|
49
|
+
interface Scrubber {
|
|
50
|
+
/** Scrubs secrets and URL queries out of a string. */
|
|
51
|
+
scrubText: TextScrubber;
|
|
52
|
+
/** Scrubs a string known to be a URL: query values and fragment included. */
|
|
53
|
+
scrubUrl: TextScrubber;
|
|
54
|
+
/** Scrubs any value; returns a copy. */
|
|
55
|
+
scrubValue: (value: unknown) => unknown;
|
|
56
|
+
/** Use as `beforeSend` and `beforeSendTransaction`. Never throws. */
|
|
57
|
+
scrubEvent: <T extends object>(event: T) => T;
|
|
58
|
+
/** Use as `beforeSendSpan`. Never throws. */
|
|
59
|
+
scrubSpan: <T extends object>(span: T) => T;
|
|
60
|
+
/** Use as Replay's `beforeAddRecordingEvent`. Returns null to drop a frame it cannot fully scrub. Never throws. */
|
|
61
|
+
scrubRecordingEvent: <T extends object>(event: T) => T | null;
|
|
62
|
+
/** Use on replay events (`postprocessEvent`). Never throws. */
|
|
63
|
+
scrubReplayEvent: <T extends object>(event: T) => T;
|
|
64
|
+
}
|
|
65
|
+
export declare function createScrubber(options?: ScrubberOptions): Scrubber;
|
|
66
|
+
export declare const scrubEvent: <T extends object>(event: T) => T;
|
|
67
|
+
export declare const scrubSpan: <T extends object>(span: T) => T;
|
|
68
|
+
export declare const scrubRecordingEvent: <T extends object>(event: T) => T | null;
|
|
69
|
+
export declare const scrubReplayEvent: <T extends object>(event: T) => T;
|
|
70
|
+
export declare const scrubText: TextScrubber;
|
|
71
|
+
export declare const scrubUrl: TextScrubber;
|
|
72
|
+
export declare const scrubValue: (value: unknown) => unknown;
|
|
73
|
+
export type { Scrubber, ScrubberOptions, SentryEnvironmentInput };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
// src/constants.ts
|
|
2
|
+
const REDACTED = "[redacted]";
|
|
3
|
+
const REDACTED_URL = "[redacted-url]";
|
|
4
|
+
const CIRCULAR = "[circular]";
|
|
5
|
+
const TRUNCATED = "[truncated]";
|
|
6
|
+
const BINARY = "[binary]";
|
|
7
|
+
const MAX_SCRUB_LENGTH = 8192;
|
|
8
|
+
const MAX_SCRUB_DEPTH = 10;
|
|
9
|
+
const SCRUB_DROPPED_TAG = "sentry_scrub_dropped";
|
|
10
|
+
// src/types.ts
|
|
11
|
+
function isObject(value) {
|
|
12
|
+
return typeof value === "object" && value !== null;
|
|
13
|
+
}
|
|
14
|
+
function isRecord(value) {
|
|
15
|
+
return isObject(value) && !Array.isArray(value);
|
|
16
|
+
}
|
|
17
|
+
/** Returns a copy of `record` with `key` mapped, when the key is present. */
|
|
18
|
+
function mapKeyIfPresent(record, key, map) {
|
|
19
|
+
return key in record ? {
|
|
20
|
+
...record,
|
|
21
|
+
[key]: map(record[key])
|
|
22
|
+
} : record;
|
|
23
|
+
}
|
|
24
|
+
// src/patterns.ts
|
|
25
|
+
const CREDENTIAL_WORDS = "authorization|cookie|password|passwd|pwd|api[._-]?key|secret|token|private[._-]?key|access[._-]?key|credential|signature";
|
|
26
|
+
const SENSITIVE_KEY_PATTERN = new RegExp(`${CREDENTIAL_WORDS}|(?:^|[._-])(?:auth|sig)$`, "i");
|
|
27
|
+
const NAME_AFFIX = "[A-Za-z0-9_-]{0,40}";
|
|
28
|
+
const QUOTE = String.raw`(?:\\?["'])`;
|
|
29
|
+
const quoted = (quote) => String.raw`\\?${quote}[^\r\n]*?\\?${quote}(?=\s*(?:[,;&}\]\r\n]|$))`;
|
|
30
|
+
const UNTERMINATED = String.raw`\\?["'][^\r\n]*`;
|
|
31
|
+
const VALUE = `(?:${quoted("\"")}|${quoted("'")}|${UNTERMINATED}|[^&\\s"'<,}\\\\]+)`;
|
|
32
|
+
const LINE_VALUE = `(?:${quoted("\"")}|${quoted("'")}|${UNTERMINATED}|[^\\r\\n]+)`;
|
|
33
|
+
const SECRET_PATTERNS = [
|
|
34
|
+
[/-----BEGIN [A-Z0-9 ]+-----[\s\S]*?-----END [A-Z0-9 ]+-----/g, REDACTED],
|
|
35
|
+
[/-----BEGIN [A-Z0-9 ]+-----[\s\S]*/g, REDACTED],
|
|
36
|
+
[/\b[a-z][a-z0-9+.-]{0,31}:\/\/[^\s/:@]*:[^\s@]+@[^\s"'<]+/gi, REDACTED_URL],
|
|
37
|
+
[/\b[a-z][a-z0-9+.-]{0,31}:\/\/[^\s/@"'<>]+@[^\s"'<>]+/gi, REDACTED_URL],
|
|
38
|
+
[/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*/g, REDACTED],
|
|
39
|
+
[/\b(?:(?:sk|pk|rk)_(?:live|test)|whsec)_[A-Za-z0-9_-]+/g, REDACTED],
|
|
40
|
+
[/\b(Basic|Bearer)\s+[^\s"'<>,;]+/gi, `$1 ${REDACTED}`],
|
|
41
|
+
[new RegExp(String.raw`\b(${NAME_AFFIX}(?:authorization|cookie)${QUOTE}?\s*[:=]\s*)${LINE_VALUE}`, "gi"), `$1${REDACTED}`],
|
|
42
|
+
[new RegExp(String.raw`\b(${NAME_AFFIX}(?:${CREDENTIAL_WORDS})${NAME_AFFIX}${QUOTE}?\s*[:=]\s*)${VALUE}`, "gi"), `$1${REDACTED}`],
|
|
43
|
+
[new RegExp(String.raw`(${QUOTE}[\w.-]*(?:key|auth|sig)${QUOTE}\s*:\s*)${VALUE}`, "gi"), `$1${REDACTED}`],
|
|
44
|
+
[/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g, REDACTED]
|
|
45
|
+
];
|
|
46
|
+
function toGlobalPattern(pattern) {
|
|
47
|
+
const flags = pattern.flags.includes("g") ? pattern.flags : `${pattern.flags}g`;
|
|
48
|
+
return new RegExp(pattern.source, flags.replace("y", ""));
|
|
49
|
+
}
|
|
50
|
+
// src/urls.ts
|
|
51
|
+
const ABSOLUTE_URL_PATTERN = /\b[a-z][a-z0-9+.-]{0,31}:\/\/[^\s"'<>]+/gi;
|
|
52
|
+
const RELATIVE_URL_PATTERN = /(^|[\s"'(<=])(\/[^\s"'<>?#]*[?#][^\s"'<>]*)/g;
|
|
53
|
+
const BARE_QUERY_PATTERN = /(^|[\s"'(<])(\?[\w.%-]+=[^\s"'<>]*)/g;
|
|
54
|
+
function redactQueryParameter(parameter) {
|
|
55
|
+
const separatorIndex = parameter.indexOf("=");
|
|
56
|
+
if (separatorIndex === -1) return parameter === "" ? parameter : REDACTED;
|
|
57
|
+
return `${parameter.slice(0, separatorIndex)}=${REDACTED}`;
|
|
58
|
+
}
|
|
59
|
+
/** Keeps parameter names, redacts every value (OAuth codes match no pattern). */
|
|
60
|
+
function redactQueryParameters(query) {
|
|
61
|
+
return query.split("&").map(redactQueryParameter).join("&");
|
|
62
|
+
}
|
|
63
|
+
/** Redacts the query values and the whole fragment of a URL string. */
|
|
64
|
+
function redactUrlParts(url) {
|
|
65
|
+
const hashIndex = url.indexOf("#");
|
|
66
|
+
const beforeHash = hashIndex === -1 ? url : url.slice(0, hashIndex);
|
|
67
|
+
const fragment = hashIndex === -1 ? "" : url.slice(hashIndex + 1);
|
|
68
|
+
const queryIndex = beforeHash.indexOf("?");
|
|
69
|
+
return `${queryIndex === -1 ? beforeHash : beforeHash.slice(0, queryIndex)}${queryIndex === -1 ? "" : `?${redactQueryParameters(beforeHash.slice(queryIndex + 1))}`}${hashIndex === -1 ? "" : `#${fragment === "" ? "" : REDACTED}`}`;
|
|
70
|
+
}
|
|
71
|
+
/** Redacts query values and fragments of URLs embedded in free text. */
|
|
72
|
+
function redactEmbeddedUrls(text) {
|
|
73
|
+
return text.replace(ABSOLUTE_URL_PATTERN, redactUrlParts).replace(RELATIVE_URL_PATTERN, (_match, lead, url) => `${lead}${redactUrlParts(url)}`).replace(BARE_QUERY_PATTERN, (_match, lead, query) => `${lead}${redactUrlParts(query)}`);
|
|
74
|
+
}
|
|
75
|
+
/** Drops the query string and fragment entirely (Replay URL lists). */
|
|
76
|
+
function stripQueryAndFragment(url) {
|
|
77
|
+
return url.replace(/[?#][\s\S]*$/, "");
|
|
78
|
+
}
|
|
79
|
+
// src/walk.ts
|
|
80
|
+
const URL_KEYS = /* @__PURE__ */ new Set([
|
|
81
|
+
"url",
|
|
82
|
+
"from",
|
|
83
|
+
"to",
|
|
84
|
+
"href",
|
|
85
|
+
"filename",
|
|
86
|
+
"abs_path",
|
|
87
|
+
"referer",
|
|
88
|
+
"referrer",
|
|
89
|
+
"location",
|
|
90
|
+
"http.url",
|
|
91
|
+
"url.full",
|
|
92
|
+
"http.target",
|
|
93
|
+
"sentry.segment.name",
|
|
94
|
+
"http.request.header.referer",
|
|
95
|
+
"http.request.header.referrer",
|
|
96
|
+
"http.request.header.location",
|
|
97
|
+
"http.response.header.location"
|
|
98
|
+
]);
|
|
99
|
+
const QUERY_KEYS = /* @__PURE__ */ new Set([
|
|
100
|
+
"query_string",
|
|
101
|
+
"http.query",
|
|
102
|
+
"url.query"
|
|
103
|
+
]);
|
|
104
|
+
const FRAGMENT_KEYS = /* @__PURE__ */ new Set(["http.fragment", "url.fragment"]);
|
|
105
|
+
const TOKEN_COUNT_KEY_PATTERN = /tokens$/i;
|
|
106
|
+
function isCredentialEntry(key, value) {
|
|
107
|
+
if (!SENSITIVE_KEY_PATTERN.test(key)) return false;
|
|
108
|
+
if (typeof value === "number" && TOKEN_COUNT_KEY_PATTERN.test(key)) return false;
|
|
109
|
+
return value !== null && value !== void 0 && typeof value !== "boolean";
|
|
110
|
+
}
|
|
111
|
+
function mapUrlEntry(entry, context, depth, ancestors) {
|
|
112
|
+
if (typeof entry === "string") return context.url(entry);
|
|
113
|
+
if (Array.isArray(entry) && depth >= 10) return TRUNCATED;
|
|
114
|
+
if (Array.isArray(entry) && !ancestors.has(entry)) {
|
|
115
|
+
ancestors.add(entry);
|
|
116
|
+
const mapped = entry.map((item) => mapUrlEntry(item, context, depth + 1, ancestors));
|
|
117
|
+
ancestors.delete(entry);
|
|
118
|
+
return mapped;
|
|
119
|
+
}
|
|
120
|
+
return scrubValue$1(entry, context, depth + 1, ancestors);
|
|
121
|
+
}
|
|
122
|
+
function scrubQueryPair(pair, context) {
|
|
123
|
+
if (!Array.isArray(pair)) return scrubQueryEntry(pair, context);
|
|
124
|
+
return [typeof pair[0] === "string" ? context.text(pair[0]) : REDACTED, REDACTED];
|
|
125
|
+
}
|
|
126
|
+
function scrubQueryEntry(entry, context) {
|
|
127
|
+
if (typeof entry === "string") return `${entry.startsWith("?") ? "?" : ""}${redactQueryParameters(context.text(entry.replace(/^\?/, "")))}`;
|
|
128
|
+
if (Array.isArray(entry)) return entry.map((pair) => scrubQueryPair(pair, context));
|
|
129
|
+
if (isRecord(entry)) return Object.fromEntries(Object.keys(entry).map((name) => [context.text(name), REDACTED]));
|
|
130
|
+
return entry === null || entry === void 0 ? entry : REDACTED;
|
|
131
|
+
}
|
|
132
|
+
function isEmptyValue(value) {
|
|
133
|
+
return value === null || value === void 0 || value === "";
|
|
134
|
+
}
|
|
135
|
+
const WRAPPER_FIELDS = /* @__PURE__ */ new Set([
|
|
136
|
+
"value",
|
|
137
|
+
"type",
|
|
138
|
+
"unit"
|
|
139
|
+
]);
|
|
140
|
+
function isOptionalString(value) {
|
|
141
|
+
return value === void 0 || typeof value === "string";
|
|
142
|
+
}
|
|
143
|
+
function isWrappedAttribute(entry) {
|
|
144
|
+
return isRecord(entry) && "value" in entry && Object.keys(entry).every((name) => WRAPPER_FIELDS.has(name)) && isOptionalString(entry.type) && isOptionalString(entry.unit);
|
|
145
|
+
}
|
|
146
|
+
function scrubWrappedAttribute(key, wrapper, context, depth, ancestors) {
|
|
147
|
+
if (ancestors.has(wrapper)) return CIRCULAR;
|
|
148
|
+
if (depth >= 10) return TRUNCATED;
|
|
149
|
+
ancestors.add(wrapper);
|
|
150
|
+
try {
|
|
151
|
+
const value = scrubEntry(key, wrapper.value, context, depth + 1, ancestors);
|
|
152
|
+
const retyped = typeof value === "string" && typeof wrapper.value !== "string";
|
|
153
|
+
return {
|
|
154
|
+
...scrubOptionalStrings(wrapper, context),
|
|
155
|
+
value,
|
|
156
|
+
...retyped ? { type: "string" } : {}
|
|
157
|
+
};
|
|
158
|
+
} finally {
|
|
159
|
+
ancestors.delete(wrapper);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function scrubOptionalStrings(wrapper, context) {
|
|
163
|
+
const fields = ["type", "unit"].filter((name) => name in wrapper);
|
|
164
|
+
return Object.fromEntries(fields.map((name) => [name, context.text(wrapper[name])]));
|
|
165
|
+
}
|
|
166
|
+
function scrubEntry(key, entry, context, depth, ancestors) {
|
|
167
|
+
if (isWrappedAttribute(entry)) return scrubWrappedAttribute(key, entry, context, depth, ancestors);
|
|
168
|
+
const lowerKey = key.toLowerCase();
|
|
169
|
+
if (isCredentialEntry(key, entry)) return REDACTED;
|
|
170
|
+
if (URL_KEYS.has(lowerKey)) return mapUrlEntry(entry, context, depth, ancestors);
|
|
171
|
+
if (QUERY_KEYS.has(lowerKey)) return scrubQueryEntry(entry, context);
|
|
172
|
+
if (FRAGMENT_KEYS.has(lowerKey)) return isEmptyValue(entry) ? entry : REDACTED;
|
|
173
|
+
return scrubValue$1(entry, context, depth + 1, ancestors);
|
|
174
|
+
}
|
|
175
|
+
function scrubEntries(source, context, depth, ancestors) {
|
|
176
|
+
return Object.fromEntries(Object.entries(source).map(([key, entry]) => [context.text(key), scrubEntry(key, entry, context, depth, ancestors)]));
|
|
177
|
+
}
|
|
178
|
+
function describeError(error) {
|
|
179
|
+
return {
|
|
180
|
+
...error,
|
|
181
|
+
name: error.name,
|
|
182
|
+
message: error.message,
|
|
183
|
+
stack: error.stack,
|
|
184
|
+
cause: error.cause
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function scrubContainer(value, context, depth, ancestors) {
|
|
188
|
+
if (Array.isArray(value)) return value.map((item) => scrubValue$1(item, context, depth + 1, ancestors));
|
|
189
|
+
if (value instanceof Date) return value;
|
|
190
|
+
if (ArrayBuffer.isView(value) || value instanceof ArrayBuffer) return BINARY;
|
|
191
|
+
if (value instanceof Map) {
|
|
192
|
+
const entries = [...value.entries()].map(([key, entry]) => [String(key), entry]);
|
|
193
|
+
return scrubEntries(Object.fromEntries(entries), context, depth, ancestors);
|
|
194
|
+
}
|
|
195
|
+
if (value instanceof Set) return scrubContainer([...value.values()], context, depth, ancestors);
|
|
196
|
+
return scrubEntries(value instanceof Error ? describeError(value) : value, context, depth, ancestors);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Recursively scrubs strings, credential-named keys, and URL-bearing keys.
|
|
200
|
+
* Returns a copy; cycles and over-deep branches become markers instead of
|
|
201
|
+
* being walked. Class instances are copied as plain objects.
|
|
202
|
+
*/
|
|
203
|
+
function scrubValue$1(value, context, depth = 0, ancestors = /* @__PURE__ */ new WeakSet()) {
|
|
204
|
+
if (typeof value === "string") return context.text(value);
|
|
205
|
+
if (typeof value !== "object" || value === null) return value;
|
|
206
|
+
if (ancestors.has(value)) return CIRCULAR;
|
|
207
|
+
if (depth >= 10) return TRUNCATED;
|
|
208
|
+
ancestors.add(value);
|
|
209
|
+
try {
|
|
210
|
+
return scrubContainer(value, context, depth, ancestors);
|
|
211
|
+
} finally {
|
|
212
|
+
ancestors.delete(value);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// src/fields.ts
|
|
216
|
+
const UNREADABLE_SECTION_NAME = "event";
|
|
217
|
+
const UNTOUCHED_FIELDS = /* @__PURE__ */ new Set([
|
|
218
|
+
"event_id",
|
|
219
|
+
"type",
|
|
220
|
+
"level",
|
|
221
|
+
"platform",
|
|
222
|
+
"timestamp",
|
|
223
|
+
"start_timestamp",
|
|
224
|
+
"release",
|
|
225
|
+
"environment",
|
|
226
|
+
"dist",
|
|
227
|
+
"sdk",
|
|
228
|
+
"sdkProcessingMetadata",
|
|
229
|
+
"measurements",
|
|
230
|
+
"transaction_info"
|
|
231
|
+
]);
|
|
232
|
+
function scrubEachItem(value, context) {
|
|
233
|
+
if (!Array.isArray(value)) return scrubValue$1(value, context);
|
|
234
|
+
return value.map((item) => scrubValue$1(item, context));
|
|
235
|
+
}
|
|
236
|
+
function scrubValueList(value, context) {
|
|
237
|
+
if (!isRecord(value)) return scrubEachItem(value, context);
|
|
238
|
+
const { values, ...rest } = value;
|
|
239
|
+
return {
|
|
240
|
+
...scrubValue$1(rest, context),
|
|
241
|
+
..."values" in value ? { values: scrubEachItem(values, context) } : {}
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
const FIELD_SCRUBBERS = {
|
|
245
|
+
exception: scrubValueList,
|
|
246
|
+
threads: scrubValueList,
|
|
247
|
+
breadcrumbs: scrubEachItem,
|
|
248
|
+
spans: scrubEachItem
|
|
249
|
+
};
|
|
250
|
+
function scrubField(name, value, context) {
|
|
251
|
+
if (UNTOUCHED_FIELDS.has(name)) return value;
|
|
252
|
+
return ((Object.hasOwn(FIELD_SCRUBBERS, name) ? FIELD_SCRUBBERS[name] : void 0) ?? scrubValue$1)(value, context);
|
|
253
|
+
}
|
|
254
|
+
function scrubFieldSafely(source, name, context) {
|
|
255
|
+
try {
|
|
256
|
+
return {
|
|
257
|
+
ok: true,
|
|
258
|
+
value: scrubField(name, source[name], context)
|
|
259
|
+
};
|
|
260
|
+
} catch {
|
|
261
|
+
return { ok: false };
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Scrubs each top-level field on its own. A field that cannot be scrubbed
|
|
266
|
+
* (a getter that throws, a hostile structure) is left out of the result and
|
|
267
|
+
* its name is returned in `dropped`, so a failure never leaks the raw value.
|
|
268
|
+
*/
|
|
269
|
+
function scrubFields(source, context) {
|
|
270
|
+
const results = Object.keys(source).map((name) => [name, scrubFieldSafely(source, name, context)]);
|
|
271
|
+
const entries = results.flatMap(([name, result]) => result.ok ? [[name, result.value]] : []);
|
|
272
|
+
const dropped = results.filter(([, result]) => !result.ok).map(([name]) => name);
|
|
273
|
+
return {
|
|
274
|
+
scrubbed: Object.fromEntries(entries),
|
|
275
|
+
dropped
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
function withDroppedTag(scrubbed, dropped) {
|
|
279
|
+
if (dropped.length === 0) return scrubbed;
|
|
280
|
+
const existing = scrubbed.tags;
|
|
281
|
+
const tags = typeof existing === "object" && existing !== null ? existing : {};
|
|
282
|
+
return {
|
|
283
|
+
...scrubbed,
|
|
284
|
+
tags: {
|
|
285
|
+
...tags,
|
|
286
|
+
[SCRUB_DROPPED_TAG]: dropped.join(",")
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function unreadableResult() {
|
|
291
|
+
return { tags: { [SCRUB_DROPPED_TAG]: UNREADABLE_SECTION_NAME } };
|
|
292
|
+
}
|
|
293
|
+
// src/replay.ts
|
|
294
|
+
function stripUrl(url, scrubText) {
|
|
295
|
+
return typeof url === "string" ? stripQueryAndFragment(scrubText(url)) : REDACTED;
|
|
296
|
+
}
|
|
297
|
+
function stripUrlList(urls, scrubText) {
|
|
298
|
+
if (!Array.isArray(urls)) return urls;
|
|
299
|
+
return urls.map((url) => stripUrl(url, scrubText));
|
|
300
|
+
}
|
|
301
|
+
const URL_HEADER_PATTERN = /^(referer|referrer|location)$/i;
|
|
302
|
+
function stripHeaders(headers, scrubText) {
|
|
303
|
+
if (!isRecord(headers)) return headers;
|
|
304
|
+
return Object.fromEntries(Object.entries(headers).map(([name, value]) => [name, URL_HEADER_PATTERN.test(name) ? stripUrl(value, scrubText) : value]));
|
|
305
|
+
}
|
|
306
|
+
function stripRequest(request, scrubText) {
|
|
307
|
+
if (!isRecord(request)) return request;
|
|
308
|
+
return mapKeyIfPresent(mapKeyIfPresent(request, "url", (url) => stripUrl(url, scrubText)), "headers", (headers) => stripHeaders(headers, scrubText));
|
|
309
|
+
}
|
|
310
|
+
/** Drops query strings and fragments from the page URLs of a replay event. */
|
|
311
|
+
function stripReplayUrls(event, scrubText) {
|
|
312
|
+
return mapKeyIfPresent(mapKeyIfPresent(event, "urls", (urls) => stripUrlList(urls, scrubText)), "request", (request) => stripRequest(request, scrubText));
|
|
313
|
+
}
|
|
314
|
+
// src/text.ts
|
|
315
|
+
const TOKEN_DELIMITER_PATTERN = /[\s,;&"'}\])]/;
|
|
316
|
+
function startOfTrailingToken(head) {
|
|
317
|
+
let index = head.length;
|
|
318
|
+
while (index > 0 && !TOKEN_DELIMITER_PATTERN.test(head.charAt(index - 1))) index -= 1;
|
|
319
|
+
return index;
|
|
320
|
+
}
|
|
321
|
+
function capForScrubbing(text) {
|
|
322
|
+
if (text.length <= 8192) return text;
|
|
323
|
+
const head = text.slice(0, MAX_SCRUB_LENGTH);
|
|
324
|
+
return `${head.slice(0, startOfTrailingToken(head))}${TRUNCATED}`;
|
|
325
|
+
}
|
|
326
|
+
function applyPatterns(text, patterns) {
|
|
327
|
+
return patterns.reduce((scrubbed, [pattern, replacement]) => scrubbed.replace(pattern, replacement), text);
|
|
328
|
+
}
|
|
329
|
+
function createTextScrubber(extraPatterns) {
|
|
330
|
+
const patterns = [...extraPatterns.map((pattern) => [toGlobalPattern(pattern), REDACTED]), ...SECRET_PATTERNS];
|
|
331
|
+
return (text) => redactEmbeddedUrls(applyPatterns(capForScrubbing(text), patterns));
|
|
332
|
+
}
|
|
333
|
+
function createUrlScrubber(scrubText) {
|
|
334
|
+
return (url) => redactUrlParts(scrubText(url));
|
|
335
|
+
}
|
|
336
|
+
// src/scrubber.ts
|
|
337
|
+
const REPLAY_EVENT_TYPE = "replay_event";
|
|
338
|
+
function scrubObject(source, context, markDropped, unreadable) {
|
|
339
|
+
try {
|
|
340
|
+
const { scrubbed, dropped } = scrubFields(source, context);
|
|
341
|
+
return markDropped(scrubbed, dropped);
|
|
342
|
+
} catch {
|
|
343
|
+
return unreadable;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
function markDroppedOnSpan(scrubbed, dropped) {
|
|
347
|
+
if (dropped.length === 0) return scrubbed;
|
|
348
|
+
const names = dropped.join(",");
|
|
349
|
+
if (dropped.includes("attributes") || isRecord(scrubbed.attributes)) {
|
|
350
|
+
const attributes = isRecord(scrubbed.attributes) ? scrubbed.attributes : {};
|
|
351
|
+
return {
|
|
352
|
+
...scrubbed,
|
|
353
|
+
attributes: {
|
|
354
|
+
...attributes,
|
|
355
|
+
[SCRUB_DROPPED_TAG]: {
|
|
356
|
+
value: names,
|
|
357
|
+
type: "string"
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
const data = isRecord(scrubbed.data) ? scrubbed.data : {};
|
|
363
|
+
return {
|
|
364
|
+
...scrubbed,
|
|
365
|
+
data: {
|
|
366
|
+
...data,
|
|
367
|
+
[SCRUB_DROPPED_TAG]: names
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
function isReplayEvent(event) {
|
|
372
|
+
try {
|
|
373
|
+
return event.type === REPLAY_EVENT_TYPE;
|
|
374
|
+
} catch {
|
|
375
|
+
return false;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
function createScrubber(options = {}) {
|
|
379
|
+
const text = createTextScrubber(options.extraPatterns ?? []);
|
|
380
|
+
const context = {
|
|
381
|
+
text,
|
|
382
|
+
url: createUrlScrubber(text)
|
|
383
|
+
};
|
|
384
|
+
const scrubEvent = (subject) => {
|
|
385
|
+
if (!isObject(subject)) return subject;
|
|
386
|
+
return scrubObject(subject, context, withDroppedTag, unreadableResult());
|
|
387
|
+
};
|
|
388
|
+
const scrubSpan = (span) => {
|
|
389
|
+
if (!isObject(span)) return span;
|
|
390
|
+
return scrubObject(span, context, markDroppedOnSpan, { data: { [SCRUB_DROPPED_TAG]: "span" } });
|
|
391
|
+
};
|
|
392
|
+
const scrubRecordingEvent = (event) => {
|
|
393
|
+
if (!isObject(event)) return event;
|
|
394
|
+
try {
|
|
395
|
+
const { scrubbed, dropped } = scrubFields(event, context);
|
|
396
|
+
return dropped.length === 0 ? scrubbed : null;
|
|
397
|
+
} catch {
|
|
398
|
+
return null;
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
const scrubAnyValue = (value) => {
|
|
402
|
+
try {
|
|
403
|
+
return scrubValue$1(value, context);
|
|
404
|
+
} catch {
|
|
405
|
+
return REDACTED;
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
const scrubReplayEvent = (event) => {
|
|
409
|
+
if (!isReplayEvent(event)) return event;
|
|
410
|
+
return stripReplayUrls(scrubObject(event, context, withDroppedTag, unreadableResult()), text);
|
|
411
|
+
};
|
|
412
|
+
return {
|
|
413
|
+
scrubText: text,
|
|
414
|
+
scrubUrl: context.url,
|
|
415
|
+
scrubValue: scrubAnyValue,
|
|
416
|
+
scrubEvent,
|
|
417
|
+
scrubSpan,
|
|
418
|
+
scrubRecordingEvent,
|
|
419
|
+
scrubReplayEvent
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
// src/environment.ts
|
|
423
|
+
const SENTRY_ENVIRONMENT_PRODUCTION = "production";
|
|
424
|
+
const SENTRY_ENVIRONMENT_PREVIEW = "preview";
|
|
425
|
+
const SENTRY_ENVIRONMENT_E2E = "e2e";
|
|
426
|
+
const SENTRY_ENVIRONMENT_DEVELOPMENT = "development";
|
|
427
|
+
const PREVIEW_CONTEXTS = /* @__PURE__ */ new Set(["deploy-preview", "branch-deploy"]);
|
|
428
|
+
/**
|
|
429
|
+
* Sentry's own default environment is "production", which files preview
|
|
430
|
+
* errors as production incidents. Anything that is not a recognised Netlify
|
|
431
|
+
* context (local dev, a local build) is "development" so it can never be
|
|
432
|
+
* mistaken for production.
|
|
433
|
+
*/
|
|
434
|
+
function resolveSentryEnvironment(input = {}) {
|
|
435
|
+
if (input.isE2e) return "e2e";
|
|
436
|
+
const context = input.netlifyContext?.trim().toLowerCase() ?? "";
|
|
437
|
+
if (context === "production") return SENTRY_ENVIRONMENT_PRODUCTION;
|
|
438
|
+
if (PREVIEW_CONTEXTS.has(context)) return SENTRY_ENVIRONMENT_PREVIEW;
|
|
439
|
+
return SENTRY_ENVIRONMENT_DEVELOPMENT;
|
|
440
|
+
}
|
|
441
|
+
// src/expected-errors.ts
|
|
442
|
+
const MIN_EXPECTED_STATUS = 300;
|
|
443
|
+
const MAX_EXPECTED_STATUS = 499;
|
|
444
|
+
function readStatusCode(error) {
|
|
445
|
+
if (!isObject(error)) return;
|
|
446
|
+
const { statusCode } = error;
|
|
447
|
+
return typeof statusCode === "number" ? statusCode : void 0;
|
|
448
|
+
}
|
|
449
|
+
function isMarkedUnhandled(error, event) {
|
|
450
|
+
if (error?.unhandled === true) return true;
|
|
451
|
+
return (event.exception?.values ?? []).some((exception) => exception.mechanism?.handled === false);
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Returns `null` for a handled error whose `statusCode` is 300 to 499 (a 404
|
|
455
|
+
* or a validation failure thrown on purpose), so it never reaches Sentry.
|
|
456
|
+
* Detected by shape, so it works with any framework's error class. Use it
|
|
457
|
+
* inside `beforeSend`.
|
|
458
|
+
*/
|
|
459
|
+
function dropExpectedClientErrors(event, hint) {
|
|
460
|
+
const error = hint?.originalException;
|
|
461
|
+
const statusCode = readStatusCode(error);
|
|
462
|
+
if (statusCode === void 0 || isMarkedUnhandled(error, event)) return event;
|
|
463
|
+
return statusCode >= MIN_EXPECTED_STATUS && statusCode <= MAX_EXPECTED_STATUS ? null : event;
|
|
464
|
+
}
|
|
465
|
+
// src/filters.ts
|
|
466
|
+
const DENIED_URLS = [
|
|
467
|
+
/^chrome-extension:\/\//,
|
|
468
|
+
/^moz-extension:\/\//,
|
|
469
|
+
/^safari-(web-)?extension:\/\//,
|
|
470
|
+
/^ms-browser-extension:\/\//
|
|
471
|
+
];
|
|
472
|
+
const IGNORED_ERRORS = [/ResizeObserver loop (limit exceeded|completed with undelivered notifications)/];
|
|
473
|
+
const WEB_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:"]);
|
|
474
|
+
function escapeRegExp(text) {
|
|
475
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
|
476
|
+
}
|
|
477
|
+
function originToPattern(origin) {
|
|
478
|
+
let parsed;
|
|
479
|
+
try {
|
|
480
|
+
parsed = new URL(origin);
|
|
481
|
+
} catch {
|
|
482
|
+
throw new TypeError(`allowUrlsFor: "${origin}" is not an absolute origin`);
|
|
483
|
+
}
|
|
484
|
+
if (!WEB_PROTOCOLS.has(parsed.protocol)) throw new TypeError(`allowUrlsFor: "${origin}" is not an http(s) origin`);
|
|
485
|
+
return new RegExp(`^${escapeRegExp(parsed.origin)}(/|$)`);
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Builds Sentry's `allowUrls` list from origins such as
|
|
489
|
+
* `https://example.com`. Throws on an origin that does not parse, because an
|
|
490
|
+
* empty `allowUrls` silently allows every script.
|
|
491
|
+
*/
|
|
492
|
+
function allowUrlsFor(origins) {
|
|
493
|
+
if (origins.length === 0) throw new TypeError("allowUrlsFor: pass at least one origin");
|
|
494
|
+
return origins.map(originToPattern);
|
|
495
|
+
}
|
|
496
|
+
// src/index.ts
|
|
497
|
+
const defaultScrubber = createScrubber();
|
|
498
|
+
const scrubEvent = defaultScrubber.scrubEvent;
|
|
499
|
+
const scrubSpan = defaultScrubber.scrubSpan;
|
|
500
|
+
const scrubRecordingEvent = defaultScrubber.scrubRecordingEvent;
|
|
501
|
+
const scrubReplayEvent = defaultScrubber.scrubReplayEvent;
|
|
502
|
+
const scrubText = defaultScrubber.scrubText;
|
|
503
|
+
const scrubUrl = defaultScrubber.scrubUrl;
|
|
504
|
+
const scrubValue = defaultScrubber.scrubValue;
|
|
505
|
+
export { BINARY, CIRCULAR, DENIED_URLS, IGNORED_ERRORS, MAX_SCRUB_DEPTH, MAX_SCRUB_LENGTH, REDACTED, REDACTED_URL, SCRUB_DROPPED_TAG, SENTRY_ENVIRONMENT_DEVELOPMENT, SENTRY_ENVIRONMENT_E2E, SENTRY_ENVIRONMENT_PREVIEW, SENTRY_ENVIRONMENT_PRODUCTION, TRUNCATED, allowUrlsFor, createScrubber, dropExpectedClientErrors, resolveSentryEnvironment, scrubEvent, scrubRecordingEvent, scrubReplayEvent, scrubSpan, scrubText, scrubUrl, scrubValue };
|
package/package.json
CHANGED
|
@@ -1 +1,43 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "@neon-pixels/sentry",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Sentry event scrubbing, expected-error filtering, filter lists, and environment naming as plain functions for any Sentry SDK.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/neonpixels-studio/packages.git",
|
|
10
|
+
"directory": "packages/sentry"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": "^22.17.0 || ^24.0.0 || >=26.0.0"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@sentry/core": ">=9.0.0"
|
|
30
|
+
},
|
|
31
|
+
"peerDependenciesMeta": {
|
|
32
|
+
"@sentry/core": {
|
|
33
|
+
"optional": true
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@sentry/core": "^11.16.0"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsdown",
|
|
41
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
42
|
+
}
|
|
43
|
+
}
|