@superblocksteam/telemetry 2.0.123-next.0 → 2.0.124-next.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/README.md +113 -0
- package/dist/common/contracts/tier2-traces.d.ts +3 -3
- package/dist/common/contracts/tier2-traces.d.ts.map +1 -1
- package/dist/common/contracts/tier2-traces.js +33 -6
- package/dist/common/contracts/tier2-traces.js.map +1 -1
- package/dist/common/index.d.ts +2 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +2 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/npm-install-metrics.d.ts +88 -0
- package/dist/common/npm-install-metrics.d.ts.map +1 -0
- package/dist/common/npm-install-metrics.js +140 -0
- package/dist/common/npm-install-metrics.js.map +1 -0
- package/dist/common/sanitize-npm-attributes.d.ts +156 -0
- package/dist/common/sanitize-npm-attributes.d.ts.map +1 -0
- package/dist/common/sanitize-npm-attributes.js +268 -0
- package/dist/common/sanitize-npm-attributes.js.map +1 -0
- package/dist/node/init.d.ts.map +1 -1
- package/dist/node/init.js +7 -0
- package/dist/node/init.js.map +1 -1
- package/dist-esm/common/contracts/tier2-traces.d.ts +3 -3
- package/dist-esm/common/contracts/tier2-traces.d.ts.map +1 -1
- package/dist-esm/common/contracts/tier2-traces.js +33 -6
- package/dist-esm/common/contracts/tier2-traces.js.map +1 -1
- package/dist-esm/common/index.d.ts +2 -0
- package/dist-esm/common/index.d.ts.map +1 -1
- package/dist-esm/common/index.js +2 -0
- package/dist-esm/common/index.js.map +1 -1
- package/dist-esm/common/npm-install-metrics.d.ts +88 -0
- package/dist-esm/common/npm-install-metrics.d.ts.map +1 -0
- package/dist-esm/common/npm-install-metrics.js +135 -0
- package/dist-esm/common/npm-install-metrics.js.map +1 -0
- package/dist-esm/common/sanitize-npm-attributes.d.ts +156 -0
- package/dist-esm/common/sanitize-npm-attributes.d.ts.map +1 -0
- package/dist-esm/common/sanitize-npm-attributes.js +258 -0
- package/dist-esm/common/sanitize-npm-attributes.js.map +1 -0
- package/dist-esm/node/init.d.ts.map +1 -1
- package/dist-esm/node/init.js +7 -0
- package/dist-esm/node/init.js.map +1 -1
- package/package.json +11 -11
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NPM Registry Attribute Sanitization (APPS-4190)
|
|
3
|
+
*
|
|
4
|
+
* Sanitization helpers for the telemetry attributes that P6.2 (APPS-4189
|
|
5
|
+
* metrics) and P6.3 (APPS-4191 audit events) emit from every npm install
|
|
6
|
+
* path. Every emitter MUST pass values through these helpers before
|
|
7
|
+
* attaching them to a span, metric, log, or audit event so that cloud-prem
|
|
8
|
+
* telemetry never carries customer infra hostnames or registry tokens.
|
|
9
|
+
*
|
|
10
|
+
* Policy split — package_name is destination-dependent (decision-point
|
|
11
|
+
* captured in PR / README "NPM Registry Sanitization"):
|
|
12
|
+
*
|
|
13
|
+
* - For metric destinations (Datadog tags, OTel metric attributes,
|
|
14
|
+
* anything where cardinality is a billing/scale concern OR the
|
|
15
|
+
* destination is shared across orgs): emit a low-cardinality bucket
|
|
16
|
+
* instead of the raw name. Use `npmAttributesForMetric` →
|
|
17
|
+
* `package_name_bucket` ∈ { public | private | unknown | invalid }.
|
|
18
|
+
*
|
|
19
|
+
* - For audit / log destinations (per-org event streams, forensic
|
|
20
|
+
* value, internally retained): emit the lowercased name verbatim,
|
|
21
|
+
* gated against known-secret value shapes. Use `npmAttributesForAudit`
|
|
22
|
+
* → `package_name` ∈ { <verbatim> | unknown | invalid }.
|
|
23
|
+
*
|
|
24
|
+
* Other attributes (the same across destinations):
|
|
25
|
+
* - registry_host → bounded enum: public_npm | private | unknown
|
|
26
|
+
* - npm.outcome → closed allowlist; unknown values → `other`
|
|
27
|
+
* - tokens → never appear in any attribute (regression-tested)
|
|
28
|
+
*/
|
|
29
|
+
export declare const NPM_REGISTRY_BUCKETS: readonly ["public_npm", "private", "unknown"];
|
|
30
|
+
export type NpmRegistryBucket = (typeof NPM_REGISTRY_BUCKETS)[number];
|
|
31
|
+
/**
|
|
32
|
+
* Map a registry URL or bare hostname to a bounded bucket. Raw hostnames
|
|
33
|
+
* are never emitted; downstream emitters always pass values through here.
|
|
34
|
+
*
|
|
35
|
+
* Rules:
|
|
36
|
+
* - null/undefined/blank → `unknown`
|
|
37
|
+
* - parse failure → `unknown`
|
|
38
|
+
* - hostname exact-matches PUBLIC_NPM_HOSTS (case-insensitive) → `public_npm`
|
|
39
|
+
* - anything else → `private`
|
|
40
|
+
*
|
|
41
|
+
* `npm.pkg.github.com` is conservatively bucketed as `private`: customers
|
|
42
|
+
* deploy it as their private registry, and bucketing it as private avoids
|
|
43
|
+
* the false-negative of suppressing private-registry behavior in telemetry.
|
|
44
|
+
*/
|
|
45
|
+
export declare function bucketNpmRegistryHost(input: string | null | undefined): NpmRegistryBucket;
|
|
46
|
+
/**
|
|
47
|
+
* Audit/log-destination form of the `package_name` attribute. Returns the
|
|
48
|
+
* lowercased input verbatim when it parses as an npm name AND does not
|
|
49
|
+
* match a known-secret value shape. Use only for destinations that can
|
|
50
|
+
* tolerate per-package cardinality and per-org name sensitivity (audit
|
|
51
|
+
* event streams, internal logs). For metric destinations, use
|
|
52
|
+
* `bucketNpmPackageName` instead — emitting raw names as metric tags is
|
|
53
|
+
* unbounded cardinality and leaks customer-internal package names across
|
|
54
|
+
* orgs sharing a metric destination.
|
|
55
|
+
*
|
|
56
|
+
* - null/undefined/blank → `unknown`
|
|
57
|
+
* - matches a known-secret value pattern (token, JWT, AWS key, etc.)
|
|
58
|
+
* → `invalid` (defense for developer error
|
|
59
|
+
* that stuffs a secret into a name arg)
|
|
60
|
+
* - input fails npm name spec → `invalid`
|
|
61
|
+
* - otherwise → lowercased input verbatim
|
|
62
|
+
*
|
|
63
|
+
* The known-secret check uses `containsForbiddenPattern` from the tier-2
|
|
64
|
+
* traces contract, so this helper stays in sync with the existing
|
|
65
|
+
* runtime/lint guardrails as new secret shapes are added there.
|
|
66
|
+
*/
|
|
67
|
+
export declare function sanitizeNpmPackageName(input: string | null | undefined): string;
|
|
68
|
+
/**
|
|
69
|
+
* Metric-destination bucket for the package name. Low-cardinality and
|
|
70
|
+
* agnostic of the specific name — dashboards split installs by registry
|
|
71
|
+
* source without ever seeing customer-internal package names.
|
|
72
|
+
*
|
|
73
|
+
* - public_npm registry + valid name → `public`
|
|
74
|
+
* - private registry + valid name → `private`
|
|
75
|
+
* - unknown registry + valid name → `unknown`
|
|
76
|
+
* - name fails npm spec OR matches a known-secret value pattern → `invalid`
|
|
77
|
+
* - name is null/empty → `unknown`
|
|
78
|
+
*
|
|
79
|
+
* The registry bucket is taken as input rather than recomputed so callers
|
|
80
|
+
* never accidentally bucket a name without also bucketing its registry.
|
|
81
|
+
*/
|
|
82
|
+
export declare const NPM_PACKAGE_NAME_BUCKETS: readonly ["public", "private", "unknown", "invalid"];
|
|
83
|
+
export type NpmPackageNameBucket = (typeof NPM_PACKAGE_NAME_BUCKETS)[number];
|
|
84
|
+
export declare function bucketNpmPackageName(input: string | null | undefined, registryBucket: NpmRegistryBucket): NpmPackageNameBucket;
|
|
85
|
+
/**
|
|
86
|
+
* Closed outcome enum. First five values match the structured error from
|
|
87
|
+
* APPS-4179 (P1.2) and APPS-4195 (P1.5); `tls_failed` was added in
|
|
88
|
+
* APPS-4381 to give TLS handshake failures their own dashboard facet
|
|
89
|
+
* (previously routed to `other` and lost the actionable CA-bundle signal);
|
|
90
|
+
* `other` is the catch-all so dashboards never see free-form strings.
|
|
91
|
+
*/
|
|
92
|
+
export declare const NPM_OUTCOMES: readonly ["success", "not_in_registry", "registry_unreachable", "registry_auth_failed", "tls_failed", "lockfile_url_mismatch", "other"];
|
|
93
|
+
export type NpmOutcome = (typeof NPM_OUTCOMES)[number];
|
|
94
|
+
/** Coerce an outcome to the closed enum at the emit boundary. */
|
|
95
|
+
export declare function normalizeNpmOutcome(input: string | null | undefined): NpmOutcome;
|
|
96
|
+
export interface NpmAttributesInput {
|
|
97
|
+
registry_host?: string | null;
|
|
98
|
+
package_name?: string | null;
|
|
99
|
+
outcome?: string | null;
|
|
100
|
+
}
|
|
101
|
+
/** Metric-destination output shape. Low-cardinality across all fields. */
|
|
102
|
+
export interface NpmMetricAttributes {
|
|
103
|
+
registry_host: NpmRegistryBucket;
|
|
104
|
+
package_name_bucket: NpmPackageNameBucket;
|
|
105
|
+
outcome: NpmOutcome;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Audit/log-destination output shape. `package_name` is verbatim
|
|
109
|
+
* (lowercased) — use only for destinations that can tolerate per-package
|
|
110
|
+
* cardinality and per-org name sensitivity.
|
|
111
|
+
*/
|
|
112
|
+
export interface NpmAuditAttributes {
|
|
113
|
+
registry_host: NpmRegistryBucket;
|
|
114
|
+
package_name: string;
|
|
115
|
+
outcome: NpmOutcome;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Metric-safe attributes. Emitters of OTel metrics, Datadog metric tags,
|
|
119
|
+
* Tempo span attributes that flow to shared metric destinations, etc.
|
|
120
|
+
* MUST use this wrapper. The output never contains a raw package name.
|
|
121
|
+
*/
|
|
122
|
+
export declare function npmAttributesForMetric(input: NpmAttributesInput): NpmMetricAttributes;
|
|
123
|
+
/**
|
|
124
|
+
* Audit/log-safe attributes. Emitters of audit events and internal logs
|
|
125
|
+
* that retain per-org context (and that operators rely on for forensic
|
|
126
|
+
* value, e.g. "which package failed for org X?") use this wrapper. The
|
|
127
|
+
* verbatim name is gated by the known-secret value pattern set.
|
|
128
|
+
*/
|
|
129
|
+
export declare function npmAttributesForAudit(input: NpmAttributesInput): NpmAuditAttributes;
|
|
130
|
+
/**
|
|
131
|
+
* Redact registry URLs and bare hostnames from a free-text npm/pnpm error
|
|
132
|
+
* blob before it lands in a shared operational log line (auto-upgrade
|
|
133
|
+
* `[npm-install-blocked]` and any future caller). The destination is shared
|
|
134
|
+
* across orgs, so even an incidental hostname in the npm-emitted phrasing —
|
|
135
|
+
* `"401 Unauthorized - GET https://customer.jfrog.io/..."`,
|
|
136
|
+
* `"request to https://npm.private/... failed, reason: ENOTFOUND npm.private"`,
|
|
137
|
+
* `"connect ECONNREFUSED 10.0.0.5:4873"` — is a customer-infra leak that
|
|
138
|
+
* `bucketNpmRegistryHost` already prevents for the structured `registry_host`
|
|
139
|
+
* facet. This helper extends the same rule to free-text fields:
|
|
140
|
+
*
|
|
141
|
+
* - Every `http(s)://...` URL is replaced with its registry bucket token
|
|
142
|
+
* (`<public_npm>` or `<private>`), preserving the diagnostic shape of
|
|
143
|
+
* the line while erasing the host.
|
|
144
|
+
* - Bare `ENOTFOUND <host>` / `EAI_AGAIN <host>` payloads — npm emits the
|
|
145
|
+
* host as the next whitespace-delimited token after these DNS error
|
|
146
|
+
* codes — get the host replaced with `<host>`.
|
|
147
|
+
* - `connect E* <ip>[:port]` payloads (ECONNREFUSED, ETIMEDOUT, …) — the
|
|
148
|
+
* IP literal carries the same private-infra signal as a hostname — get
|
|
149
|
+
* the address replaced with `<host>`.
|
|
150
|
+
*
|
|
151
|
+
* The replacement is intentionally lossy: the npm phrasing ("Unauthorized",
|
|
152
|
+
* "self-signed certificate in chain", "ENOTFOUND") is what operators need
|
|
153
|
+
* for triage; the host identity is what we must drop.
|
|
154
|
+
*/
|
|
155
|
+
export declare function redactNpmRegistryHostsFromText(input: string): string;
|
|
156
|
+
//# sourceMappingURL=sanitize-npm-attributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize-npm-attributes.d.ts","sourceRoot":"","sources":["../../src/common/sanitize-npm-attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,eAAO,MAAM,oBAAoB,+CAIvB,CAAC;AACX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAKtE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,GA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KG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,kBAAkB,GACxB,kBAAkB,CAMpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA0BpE"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* NPM Registry Attribute Sanitization (APPS-4190)
|
|
4
|
+
*
|
|
5
|
+
* Sanitization helpers for the telemetry attributes that P6.2 (APPS-4189
|
|
6
|
+
* metrics) and P6.3 (APPS-4191 audit events) emit from every npm install
|
|
7
|
+
* path. Every emitter MUST pass values through these helpers before
|
|
8
|
+
* attaching them to a span, metric, log, or audit event so that cloud-prem
|
|
9
|
+
* telemetry never carries customer infra hostnames or registry tokens.
|
|
10
|
+
*
|
|
11
|
+
* Policy split — package_name is destination-dependent (decision-point
|
|
12
|
+
* captured in PR / README "NPM Registry Sanitization"):
|
|
13
|
+
*
|
|
14
|
+
* - For metric destinations (Datadog tags, OTel metric attributes,
|
|
15
|
+
* anything where cardinality is a billing/scale concern OR the
|
|
16
|
+
* destination is shared across orgs): emit a low-cardinality bucket
|
|
17
|
+
* instead of the raw name. Use `npmAttributesForMetric` →
|
|
18
|
+
* `package_name_bucket` ∈ { public | private | unknown | invalid }.
|
|
19
|
+
*
|
|
20
|
+
* - For audit / log destinations (per-org event streams, forensic
|
|
21
|
+
* value, internally retained): emit the lowercased name verbatim,
|
|
22
|
+
* gated against known-secret value shapes. Use `npmAttributesForAudit`
|
|
23
|
+
* → `package_name` ∈ { <verbatim> | unknown | invalid }.
|
|
24
|
+
*
|
|
25
|
+
* Other attributes (the same across destinations):
|
|
26
|
+
* - registry_host → bounded enum: public_npm | private | unknown
|
|
27
|
+
* - npm.outcome → closed allowlist; unknown values → `other`
|
|
28
|
+
* - tokens → never appear in any attribute (regression-tested)
|
|
29
|
+
*/
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.NPM_OUTCOMES = exports.NPM_PACKAGE_NAME_BUCKETS = exports.NPM_REGISTRY_BUCKETS = void 0;
|
|
32
|
+
exports.bucketNpmRegistryHost = bucketNpmRegistryHost;
|
|
33
|
+
exports.sanitizeNpmPackageName = sanitizeNpmPackageName;
|
|
34
|
+
exports.bucketNpmPackageName = bucketNpmPackageName;
|
|
35
|
+
exports.normalizeNpmOutcome = normalizeNpmOutcome;
|
|
36
|
+
exports.npmAttributesForMetric = npmAttributesForMetric;
|
|
37
|
+
exports.npmAttributesForAudit = npmAttributesForAudit;
|
|
38
|
+
exports.redactNpmRegistryHostsFromText = redactNpmRegistryHostsFromText;
|
|
39
|
+
const tier2_traces_js_1 = require("./contracts/tier2-traces.js");
|
|
40
|
+
exports.NPM_REGISTRY_BUCKETS = [
|
|
41
|
+
"public_npm",
|
|
42
|
+
"private",
|
|
43
|
+
"unknown",
|
|
44
|
+
];
|
|
45
|
+
/** Exact-match allowlist for the `public_npm` bucket. */
|
|
46
|
+
const PUBLIC_NPM_HOSTS = new Set(["registry.npmjs.org"]);
|
|
47
|
+
/**
|
|
48
|
+
* Map a registry URL or bare hostname to a bounded bucket. Raw hostnames
|
|
49
|
+
* are never emitted; downstream emitters always pass values through here.
|
|
50
|
+
*
|
|
51
|
+
* Rules:
|
|
52
|
+
* - null/undefined/blank → `unknown`
|
|
53
|
+
* - parse failure → `unknown`
|
|
54
|
+
* - hostname exact-matches PUBLIC_NPM_HOSTS (case-insensitive) → `public_npm`
|
|
55
|
+
* - anything else → `private`
|
|
56
|
+
*
|
|
57
|
+
* `npm.pkg.github.com` is conservatively bucketed as `private`: customers
|
|
58
|
+
* deploy it as their private registry, and bucketing it as private avoids
|
|
59
|
+
* the false-negative of suppressing private-registry behavior in telemetry.
|
|
60
|
+
*/
|
|
61
|
+
function bucketNpmRegistryHost(input) {
|
|
62
|
+
if (input == null)
|
|
63
|
+
return "unknown";
|
|
64
|
+
const trimmed = input.trim();
|
|
65
|
+
if (trimmed === "")
|
|
66
|
+
return "unknown";
|
|
67
|
+
let host;
|
|
68
|
+
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(trimmed)) {
|
|
69
|
+
try {
|
|
70
|
+
host = new URL(trimmed).hostname.toLowerCase();
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return "unknown";
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
host = trimmed.split(/[/:]/, 1)[0].toLowerCase();
|
|
78
|
+
}
|
|
79
|
+
if (host === "")
|
|
80
|
+
return "unknown";
|
|
81
|
+
return PUBLIC_NPM_HOSTS.has(host) ? "public_npm" : "private";
|
|
82
|
+
}
|
|
83
|
+
/** npm package name spec (lowercased): optional `@scope/` prefix + name body. */
|
|
84
|
+
const VALID_PACKAGE_NAME_RE = /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/;
|
|
85
|
+
/**
|
|
86
|
+
* npm name length cap from the package-name spec. The character-set regex
|
|
87
|
+
* alone admits arbitrarily long strings of `[a-z0-9._-]`; without this cap
|
|
88
|
+
* a hostile or buggy caller can flow a 10k-char payload through the
|
|
89
|
+
* verbatim audit/log path. Enforced on both the audit and metric helpers
|
|
90
|
+
* so an oversize input is `invalid` in either destination.
|
|
91
|
+
*/
|
|
92
|
+
const NPM_PACKAGE_NAME_MAX_LENGTH = 214;
|
|
93
|
+
/**
|
|
94
|
+
* Audit/log-destination form of the `package_name` attribute. Returns the
|
|
95
|
+
* lowercased input verbatim when it parses as an npm name AND does not
|
|
96
|
+
* match a known-secret value shape. Use only for destinations that can
|
|
97
|
+
* tolerate per-package cardinality and per-org name sensitivity (audit
|
|
98
|
+
* event streams, internal logs). For metric destinations, use
|
|
99
|
+
* `bucketNpmPackageName` instead — emitting raw names as metric tags is
|
|
100
|
+
* unbounded cardinality and leaks customer-internal package names across
|
|
101
|
+
* orgs sharing a metric destination.
|
|
102
|
+
*
|
|
103
|
+
* - null/undefined/blank → `unknown`
|
|
104
|
+
* - matches a known-secret value pattern (token, JWT, AWS key, etc.)
|
|
105
|
+
* → `invalid` (defense for developer error
|
|
106
|
+
* that stuffs a secret into a name arg)
|
|
107
|
+
* - input fails npm name spec → `invalid`
|
|
108
|
+
* - otherwise → lowercased input verbatim
|
|
109
|
+
*
|
|
110
|
+
* The known-secret check uses `containsForbiddenPattern` from the tier-2
|
|
111
|
+
* traces contract, so this helper stays in sync with the existing
|
|
112
|
+
* runtime/lint guardrails as new secret shapes are added there.
|
|
113
|
+
*/
|
|
114
|
+
function sanitizeNpmPackageName(input) {
|
|
115
|
+
if (input == null)
|
|
116
|
+
return "unknown";
|
|
117
|
+
const trimmed = input.trim();
|
|
118
|
+
if (trimmed === "")
|
|
119
|
+
return "unknown";
|
|
120
|
+
if (trimmed.length > NPM_PACKAGE_NAME_MAX_LENGTH)
|
|
121
|
+
return "invalid";
|
|
122
|
+
// Check against secret patterns BEFORE lowercasing: AKIA/JWT/PEM patterns
|
|
123
|
+
// are case-sensitive and would otherwise slip through after toLowerCase().
|
|
124
|
+
if ((0, tier2_traces_js_1.containsForbiddenPattern)(trimmed))
|
|
125
|
+
return "invalid";
|
|
126
|
+
const normalized = trimmed.toLowerCase();
|
|
127
|
+
if (!VALID_PACKAGE_NAME_RE.test(normalized))
|
|
128
|
+
return "invalid";
|
|
129
|
+
return normalized;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Metric-destination bucket for the package name. Low-cardinality and
|
|
133
|
+
* agnostic of the specific name — dashboards split installs by registry
|
|
134
|
+
* source without ever seeing customer-internal package names.
|
|
135
|
+
*
|
|
136
|
+
* - public_npm registry + valid name → `public`
|
|
137
|
+
* - private registry + valid name → `private`
|
|
138
|
+
* - unknown registry + valid name → `unknown`
|
|
139
|
+
* - name fails npm spec OR matches a known-secret value pattern → `invalid`
|
|
140
|
+
* - name is null/empty → `unknown`
|
|
141
|
+
*
|
|
142
|
+
* The registry bucket is taken as input rather than recomputed so callers
|
|
143
|
+
* never accidentally bucket a name without also bucketing its registry.
|
|
144
|
+
*/
|
|
145
|
+
exports.NPM_PACKAGE_NAME_BUCKETS = [
|
|
146
|
+
"public",
|
|
147
|
+
"private",
|
|
148
|
+
"unknown",
|
|
149
|
+
"invalid",
|
|
150
|
+
];
|
|
151
|
+
function bucketNpmPackageName(input, registryBucket) {
|
|
152
|
+
if (input == null)
|
|
153
|
+
return "unknown";
|
|
154
|
+
const trimmed = input.trim();
|
|
155
|
+
if (trimmed === "")
|
|
156
|
+
return "unknown";
|
|
157
|
+
if (trimmed.length > NPM_PACKAGE_NAME_MAX_LENGTH)
|
|
158
|
+
return "invalid";
|
|
159
|
+
if ((0, tier2_traces_js_1.containsForbiddenPattern)(trimmed))
|
|
160
|
+
return "invalid";
|
|
161
|
+
if (!VALID_PACKAGE_NAME_RE.test(trimmed.toLowerCase()))
|
|
162
|
+
return "invalid";
|
|
163
|
+
switch (registryBucket) {
|
|
164
|
+
case "public_npm":
|
|
165
|
+
return "public";
|
|
166
|
+
case "private":
|
|
167
|
+
return "private";
|
|
168
|
+
case "unknown":
|
|
169
|
+
return "unknown";
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Closed outcome enum. First five values match the structured error from
|
|
174
|
+
* APPS-4179 (P1.2) and APPS-4195 (P1.5); `tls_failed` was added in
|
|
175
|
+
* APPS-4381 to give TLS handshake failures their own dashboard facet
|
|
176
|
+
* (previously routed to `other` and lost the actionable CA-bundle signal);
|
|
177
|
+
* `other` is the catch-all so dashboards never see free-form strings.
|
|
178
|
+
*/
|
|
179
|
+
exports.NPM_OUTCOMES = [
|
|
180
|
+
"success",
|
|
181
|
+
"not_in_registry",
|
|
182
|
+
"registry_unreachable",
|
|
183
|
+
"registry_auth_failed",
|
|
184
|
+
"tls_failed",
|
|
185
|
+
"lockfile_url_mismatch",
|
|
186
|
+
"other",
|
|
187
|
+
];
|
|
188
|
+
const NPM_OUTCOME_SET = new Set(exports.NPM_OUTCOMES);
|
|
189
|
+
/** Coerce an outcome to the closed enum at the emit boundary. */
|
|
190
|
+
function normalizeNpmOutcome(input) {
|
|
191
|
+
if (typeof input !== "string")
|
|
192
|
+
return "other";
|
|
193
|
+
return NPM_OUTCOME_SET.has(input) ? input : "other";
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Metric-safe attributes. Emitters of OTel metrics, Datadog metric tags,
|
|
197
|
+
* Tempo span attributes that flow to shared metric destinations, etc.
|
|
198
|
+
* MUST use this wrapper. The output never contains a raw package name.
|
|
199
|
+
*/
|
|
200
|
+
function npmAttributesForMetric(input) {
|
|
201
|
+
const registry_host = bucketNpmRegistryHost(input.registry_host);
|
|
202
|
+
return {
|
|
203
|
+
registry_host,
|
|
204
|
+
package_name_bucket: bucketNpmPackageName(input.package_name, registry_host),
|
|
205
|
+
outcome: normalizeNpmOutcome(input.outcome),
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Audit/log-safe attributes. Emitters of audit events and internal logs
|
|
210
|
+
* that retain per-org context (and that operators rely on for forensic
|
|
211
|
+
* value, e.g. "which package failed for org X?") use this wrapper. The
|
|
212
|
+
* verbatim name is gated by the known-secret value pattern set.
|
|
213
|
+
*/
|
|
214
|
+
function npmAttributesForAudit(input) {
|
|
215
|
+
return {
|
|
216
|
+
registry_host: bucketNpmRegistryHost(input.registry_host),
|
|
217
|
+
package_name: sanitizeNpmPackageName(input.package_name),
|
|
218
|
+
outcome: normalizeNpmOutcome(input.outcome),
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Redact registry URLs and bare hostnames from a free-text npm/pnpm error
|
|
223
|
+
* blob before it lands in a shared operational log line (auto-upgrade
|
|
224
|
+
* `[npm-install-blocked]` and any future caller). The destination is shared
|
|
225
|
+
* across orgs, so even an incidental hostname in the npm-emitted phrasing —
|
|
226
|
+
* `"401 Unauthorized - GET https://customer.jfrog.io/..."`,
|
|
227
|
+
* `"request to https://npm.private/... failed, reason: ENOTFOUND npm.private"`,
|
|
228
|
+
* `"connect ECONNREFUSED 10.0.0.5:4873"` — is a customer-infra leak that
|
|
229
|
+
* `bucketNpmRegistryHost` already prevents for the structured `registry_host`
|
|
230
|
+
* facet. This helper extends the same rule to free-text fields:
|
|
231
|
+
*
|
|
232
|
+
* - Every `http(s)://...` URL is replaced with its registry bucket token
|
|
233
|
+
* (`<public_npm>` or `<private>`), preserving the diagnostic shape of
|
|
234
|
+
* the line while erasing the host.
|
|
235
|
+
* - Bare `ENOTFOUND <host>` / `EAI_AGAIN <host>` payloads — npm emits the
|
|
236
|
+
* host as the next whitespace-delimited token after these DNS error
|
|
237
|
+
* codes — get the host replaced with `<host>`.
|
|
238
|
+
* - `connect E* <ip>[:port]` payloads (ECONNREFUSED, ETIMEDOUT, …) — the
|
|
239
|
+
* IP literal carries the same private-infra signal as a hostname — get
|
|
240
|
+
* the address replaced with `<host>`.
|
|
241
|
+
*
|
|
242
|
+
* The replacement is intentionally lossy: the npm phrasing ("Unauthorized",
|
|
243
|
+
* "self-signed certificate in chain", "ENOTFOUND") is what operators need
|
|
244
|
+
* for triage; the host identity is what we must drop.
|
|
245
|
+
*/
|
|
246
|
+
function redactNpmRegistryHostsFromText(input) {
|
|
247
|
+
if (input === "")
|
|
248
|
+
return input;
|
|
249
|
+
// URLs first. The match is greedy on non-whitespace/closing-paren chars to
|
|
250
|
+
// capture query strings and paths along with the host so the whole URL is
|
|
251
|
+
// replaced as a unit (a trailing `/path?token=...` containing a leaked
|
|
252
|
+
// host substring would otherwise survive a host-only replacement).
|
|
253
|
+
let out = input.replace(/https?:\/\/[^\s)]+/gi, (match) => {
|
|
254
|
+
const bucket = bucketNpmRegistryHost(match);
|
|
255
|
+
return bucket === "public_npm" ? "<public_npm>" : "<private>";
|
|
256
|
+
});
|
|
257
|
+
// DNS error codes name the host on the same line. Match the code as a
|
|
258
|
+
// word boundary so substrings inside other tokens don't trigger. The
|
|
259
|
+
// captured host token is whatever sits between the code and the next
|
|
260
|
+
// whitespace / punctuation that npm uses as a separator.
|
|
261
|
+
out = out.replace(/\b(ENOTFOUND|EAI_AGAIN)\s+([^\s,;:'")\]]+)/gi, (_m, code) => `${code} <host>`);
|
|
262
|
+
// `connect E<CODE> <ip>[:port]` — npm phrasing for low-level socket
|
|
263
|
+
// errors. The IP literal is the host facet to redact; the port is dropped
|
|
264
|
+
// alongside because port + private-IP together is the same infra signal.
|
|
265
|
+
out = out.replace(/\bconnect\s+(E[A-Z]+)\s+([0-9a-fA-F.:]+)(?::\d+)?/g, (_m, code) => `connect ${code} <host>`);
|
|
266
|
+
return out;
|
|
267
|
+
}
|
|
268
|
+
//# sourceMappingURL=sanitize-npm-attributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize-npm-attributes.js","sourceRoot":"","sources":["../../src/common/sanitize-npm-attributes.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;;;AA4BH,sDAoBC;AAoCD,wDAaC;AAwBD,oDAkBC;AAuBD,kDAKC;AA+BD,wDAYC;AAQD,sDAQC;AA2BD,wEA0BC;AArRD,iEAAuE;AAE1D,QAAA,oBAAoB,GAAG;IAClC,YAAY;IACZ,SAAS;IACT,SAAS;CACD,CAAC;AAGX,yDAAyD;AACzD,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAS,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAEjE;;;;;;;;;;;;;GAaG;AACH,SAAgB,qBAAqB,CACnC,KAAgC;IAEhC,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,SAAS,CAAC;IACpC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAErC,IAAI,IAAY,CAAC;IACjB,IAAI,0BAA0B,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CA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AAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/node/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/node/init.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAS,MAAM,EAAW,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAQ,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAWvD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/node/init.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAS,MAAM,EAAW,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAQ,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAWvD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAOlD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAGzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAiB,MAAM,oBAAoB,CAAC;AAOpE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMpD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,mEAAmE;IACnE,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,6CAA6C;IAC7C,eAAe,EAAE,wBAAwB,CAAC;IAC1C,mCAAmC;IACnC,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACrC,kCAAkC;IAClC,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,KAAK,CAAC;IACnC,mCAAmC;IACnC,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACrC,oEAAoE;IACpE,aAAa,EAAE,aAAa,CAAC;IAC7B,wBAAwB;IACxB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAmGD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,eAAe,GACtB,qBAAqB,CAuLvB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,qBAAqB,CAO5D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAErC"}
|
package/dist/node/init.js
CHANGED
|
@@ -20,6 +20,7 @@ const exporter_trace_otlp_http_1 = require("@opentelemetry/exporter-trace-otlp-h
|
|
|
20
20
|
const sdk_logs_1 = require("@opentelemetry/sdk-logs");
|
|
21
21
|
const sdk_metrics_1 = require("@opentelemetry/sdk-metrics");
|
|
22
22
|
const sdk_node_1 = require("@opentelemetry/sdk-node");
|
|
23
|
+
const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
|
|
23
24
|
const tier2_traces_js_1 = require("../common/contracts/tier2-traces.js");
|
|
24
25
|
const policy_evaluator_js_1 = require("../common/policy-evaluator.js");
|
|
25
26
|
const resource_js_1 = require("../common/resource.js");
|
|
@@ -187,6 +188,12 @@ function initNodeTelemetry(config, policy) {
|
|
|
187
188
|
});
|
|
188
189
|
const spanProcessorLogger = config.logger ?? createConsoleFallbackLogger();
|
|
189
190
|
spanProcessor = new sanitizing_processor_js_1.SanitizingSpanProcessor(policyEvaluator, sanitizing_processor_js_1.noopSpanProcessor, tier2Exporter, traceSanitizer, spanProcessorLogger);
|
|
191
|
+
// Local-obs override: bypass the sanitizer so the local LGTM stack sees
|
|
192
|
+
// every span (service graph, raw attrs). Same exporter as cloud — only the
|
|
193
|
+
// processor changes.
|
|
194
|
+
if (process.env.SUPERBLOCKS_LOCAL_OBS === "true") {
|
|
195
|
+
spanProcessor = new sdk_trace_base_1.BatchSpanProcessor(tier2Exporter);
|
|
196
|
+
}
|
|
190
197
|
}
|
|
191
198
|
// Create metric exporter if enabled
|
|
192
199
|
// Use isExportEnabled (not canExport) - sampling applies at runtime, not initialization
|
package/dist/node/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/node/init.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/node/init.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAqLH,8CA0LC;AAOD,oDAOC;AAKD,wDAEC;AAMD,wCAEC;AA1YD,4CAAmE;AACnE,sDAAuD;AACvD,4EAAqF;AACrF,8CAAgE;AAChE,oFAAyE;AACzE,0FAA+E;AAC/E,sFAA4E;AAC5E,sDAAkE;AAClE,4DAGoC;AACpC,sDAAkD;AAClD,kEAGuC;AAEvC,yEAAqF;AACrF,uEAAyE;AACzE,uDAAwE;AACxE,qEAA8D;AAE9D,kDAAoE;AACpE,6EAAsE;AACtE,yDAI4B;AAC5B,2DAAoD;AACpD,uEAGmC;AAsBnC,qBAAqB;AACrB,IAAI,QAA2C,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,SAAS,kBAAkB,CACzB,MAA2B,EAC3B,MAAuB;IAEvB,MAAM,eAAe,GAAG,IAAI,8CAAwB,CAAC,MAAM,CAAC,CAAC;IAE7D,2CAA2C;IAC3C,MAAM,YAAY,GAAG,aAAO,CAAC,QAAQ,CACnC,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,cAAc,CACtB,CAAC;IAEF,OAAO;QACL,GAAG,EAAE,SAAS;QACd,eAAe;QACf,SAAS,EAAE,CAAC,IAAa,EAAE,EAAE,CAC3B,WAAK,CAAC,SAAS,CAAC,IAAI,IAAI,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,cAAc,CAAC;QACpE,QAAQ,EAAE,CAAC,IAAa,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0.4.0)
|
|
3
3
|
*
|
|
4
4
|
* Single source of truth for Tier 2 sanitized trace telemetry.
|
|
5
|
-
* Mirrors: engineering/projects/o11y-refactor/contracts/tier2-traces.v0.
|
|
5
|
+
* Mirrors: engineering/projects/o11y-refactor/contracts/tier2-traces.v0.4.0.json
|
|
6
6
|
*
|
|
7
7
|
* Used by:
|
|
8
8
|
* - trace-sanitizer (SDK: which spans/attributes to export)
|
|
@@ -28,7 +28,7 @@ export interface SpanDefinition {
|
|
|
28
28
|
}
|
|
29
29
|
export declare function getAttributeName(attr: AllowedAttribute): string;
|
|
30
30
|
/**
|
|
31
|
-
* Span patterns from tier2-traces.v0.
|
|
31
|
+
* Span patterns from tier2-traces.v0.4.0.json.
|
|
32
32
|
* Suffix wildcard only: "HTTP POST *" matches "HTTP POST /api/..." or "POST /api/...".
|
|
33
33
|
*/
|
|
34
34
|
export declare const TIER_2_TRACE_CONTRACT: SpanDefinition[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tier2-traces.d.ts","sourceRoot":"","sources":["../../../src/common/contracts/tier2-traces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAM7D,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;CACxC;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,mBAAmB,CAAC;AAE5D,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,gBAAg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EtC,CAAC;AACF,eAAO,MAAM,uBAAuB,aAAyC,CAAC;AAC9E,eAAO,MAAM,wBAAwB,aAEpC,CAAC;AASF;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,mBAAmB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACjC,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,sEAAsE;IACtE,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,uFAAuF;IACvF,6BAA6B,EAAE,OAAO,CAAC;CACxC;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,cAAc,EAAE,kBAAkB,GACjC,2BAA2B,CAwB7B;AAMD,0FAA0F;AAC1F,eAAO,MAAM,mBAAmB,aAA2B,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,UAYpC,CAAC;AAMF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAGhE;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE5D"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tier 2 Traces Contract (v0.
|
|
2
|
+
* Tier 2 Traces Contract (v0.4.0)
|
|
3
3
|
*
|
|
4
4
|
* Single source of truth for Tier 2 sanitized trace telemetry.
|
|
5
|
-
* Mirrors: engineering/projects/o11y-refactor/contracts/tier2-traces.v0.
|
|
5
|
+
* Mirrors: engineering/projects/o11y-refactor/contracts/tier2-traces.v0.4.0.json
|
|
6
6
|
*
|
|
7
7
|
* Used by:
|
|
8
8
|
* - trace-sanitizer (SDK: which spans/attributes to export)
|
|
@@ -182,7 +182,7 @@ const GEN_AI_STREAM_STEP_ATTRIBUTES = [
|
|
|
182
182
|
},
|
|
183
183
|
];
|
|
184
184
|
/**
|
|
185
|
-
* Span patterns from tier2-traces.v0.
|
|
185
|
+
* Span patterns from tier2-traces.v0.4.0.json.
|
|
186
186
|
* Suffix wildcard only: "HTTP POST *" matches "HTTP POST /api/..." or "POST /api/...".
|
|
187
187
|
*/
|
|
188
188
|
export const TIER_2_TRACE_CONTRACT = [
|
|
@@ -466,7 +466,7 @@ export const TIER_2_TRACE_CONTRACT = [
|
|
|
466
466
|
},
|
|
467
467
|
],
|
|
468
468
|
},
|
|
469
|
-
// SABS app-builder spans (
|
|
469
|
+
// SABS app-builder spans (v0.3.0) + bundle download span (v0.4.0)
|
|
470
470
|
{
|
|
471
471
|
name: "sabs.build",
|
|
472
472
|
allowedAttributes: [
|
|
@@ -487,6 +487,18 @@ export const TIER_2_TRACE_CONTRACT = [
|
|
|
487
487
|
"otel.status_description",
|
|
488
488
|
],
|
|
489
489
|
},
|
|
490
|
+
// AGENT-2723: aggregate download span replacing ~511 per-file RPC spans
|
|
491
|
+
{
|
|
492
|
+
name: "sabs.bundle.download",
|
|
493
|
+
description: "Aggregate span for the full SABS bundle download. Replaces per-file spans; per-file metrics emitted as sabs.bundle.files_downloaded, sabs.bundle.bytes_downloaded, sabs.bundle.file_fetch_ms.",
|
|
494
|
+
allowedAttributes: [
|
|
495
|
+
{ name: "files.count", type: "number" },
|
|
496
|
+
{ name: "bytes.sum", type: "number" },
|
|
497
|
+
{ name: "slowest.ms", type: "number" },
|
|
498
|
+
"otel.status_code",
|
|
499
|
+
"otel.status_description",
|
|
500
|
+
],
|
|
501
|
+
},
|
|
490
502
|
];
|
|
491
503
|
/**
|
|
492
504
|
* Cloud trace contract: match-all span name ("*") so no spans are dropped by name.
|
|
@@ -510,7 +522,7 @@ export function getTraceContract(deploymentType) {
|
|
|
510
522
|
}
|
|
511
523
|
}
|
|
512
524
|
// ---------------------------------------------------------------------------
|
|
513
|
-
// Forbidden / hashed / dropped attribute names (v0.
|
|
525
|
+
// Forbidden / hashed / dropped attribute names (v0.4.0 JSON)
|
|
514
526
|
// ---------------------------------------------------------------------------
|
|
515
527
|
/** Forbidden in Tier 2 (forbiddenAttributes in contract). Collector strips these entirely. */
|
|
516
528
|
export const FORBIDDEN_TIER_2_SPAN_ATTRIBUTES = [
|
|
@@ -523,7 +535,6 @@ export const FORBIDDEN_TIER_2_SPAN_ATTRIBUTES = [
|
|
|
523
535
|
"file_path",
|
|
524
536
|
"file_content",
|
|
525
537
|
"db.statement",
|
|
526
|
-
"db.query_text",
|
|
527
538
|
"db.query.text",
|
|
528
539
|
"http.request.body",
|
|
529
540
|
"http.response.body",
|
|
@@ -534,7 +545,12 @@ export const FORBIDDEN_TIER_2_SPAN_ATTRIBUTES = [
|
|
|
534
545
|
"user-email",
|
|
535
546
|
"user.email",
|
|
536
547
|
"user_email",
|
|
548
|
+
"user.id",
|
|
537
549
|
"enduser.email",
|
|
550
|
+
// NOTE: api-id/api_id, resource-id/resource_id, integration-id/integration_id,
|
|
551
|
+
// commit-id/commit_id, profile-id/profile_id are in the v0.4.0 JSON contract's
|
|
552
|
+
// forbiddenAttributes but intentionally omitted here. See ENG-3459 to resolve.
|
|
553
|
+
// https://linear.app/superblocks/issue/ENG-3459
|
|
538
554
|
"api-name",
|
|
539
555
|
"api_name",
|
|
540
556
|
"application-id",
|
|
@@ -550,6 +566,13 @@ export const FORBIDDEN_TIER_2_SPAN_ATTRIBUTES = [
|
|
|
550
566
|
"authorization",
|
|
551
567
|
"cookie",
|
|
552
568
|
"x-api-key",
|
|
569
|
+
// APPS-4190: npm registry tokens. Bucketing in sanitize-npm-attributes.ts
|
|
570
|
+
// is the primary defense; this list is the lint/runtime backstop so a
|
|
571
|
+
// future emitter that names an attribute after the token is stripped.
|
|
572
|
+
"npm.token",
|
|
573
|
+
"npm_token",
|
|
574
|
+
"npm.registry_token",
|
|
575
|
+
"registry_token",
|
|
553
576
|
];
|
|
554
577
|
/** Hashed (keyed HMAC) for Tier 2 (hashedAttributes in contract). */
|
|
555
578
|
export const HASHED_TIER_2_SPAN_ATTRIBUTES = [];
|
|
@@ -613,6 +636,10 @@ export const FORBIDDEN_VALUE_PATTERNS = [
|
|
|
613
636
|
/-----BEGIN\s+(RSA\s+)?(PRIVATE|PUBLIC)\s+KEY-----/,
|
|
614
637
|
/\bAKIA[A-Z0-9]{16}\b/,
|
|
615
638
|
/\b(ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{36,}\b/,
|
|
639
|
+
// npm registry tokens (`npm_<36+ alphanumerics>`). The npm-name spec allows
|
|
640
|
+
// underscores, so without this pattern a token shaped like `npm_AAAA...`
|
|
641
|
+
// would slip through `sanitizeNpmPackageName` as a "valid" package name.
|
|
642
|
+
/\bnpm_[A-Za-z0-9]{36,}\b/,
|
|
616
643
|
/\b(api[_-]?key|apikey|secret[_-]?key|access[_-]?token)[=:]\s*[A-Za-z0-9_-]{20,}\b/i,
|
|
617
644
|
];
|
|
618
645
|
// ---------------------------------------------------------------------------
|