Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@datadog/browser-core

Package Overview
Dependencies
Maintainers
1
Versions
258
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datadog/browser-core - npm Package Compare versions

Comparing version 4.10.3 to 4.10.4

2

cjs/boot/init.js

@@ -9,3 +9,3 @@ "use strict";

var publicApi = (0, utils_1.assign)({
version: "4.10.3",
version: "4.10.4",
// This API method is intentionally not monitored, since the only thing executed is the

@@ -12,0 +12,0 @@ // user-provided 'callback'. All SDK usages executed in the callback should be monitored, and

@@ -28,5 +28,5 @@ "use strict";

var parameters = "ddsource=".concat(source || 'browser') +
"&ddtags=".concat(encodeURIComponent(["sdk_version:".concat("4.10.3")].concat(tags).join(','))) +
"&ddtags=".concat(encodeURIComponent(["sdk_version:".concat("4.10.4")].concat(tags).join(','))) +
"&dd-api-key=".concat(clientToken) +
"&dd-evp-origin-version=".concat(encodeURIComponent("4.10.3")) +
"&dd-evp-origin-version=".concat(encodeURIComponent("4.10.4")) +
'&dd-evp-origin=browser' +

@@ -33,0 +33,0 @@ "&dd-request-id=".concat((0, utils_1.generateUUID)());

import type { Context } from '../../tools/context';
import type { Configuration } from '../configuration';
import type { StackTrace } from '../tracekit';
import { Observable } from '../../tools/observable';

@@ -37,3 +38,4 @@ import type { TelemetryEvent } from './telemetryEvent.types';

export declare function addMonitoringError(e: unknown): void;
export declare function scrubCustomerFrames(stackTrace: StackTrace): StackTrace;
export declare function setDebugMode(debugMode: boolean): void;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setDebugMode = exports.addMonitoringError = exports.addMonitoringMessage = exports.callMonitored = exports.monitor = exports.monitored = exports.isTelemetryReplicationAllowed = exports.resetInternalMonitoring = exports.startFakeInternalMonitoring = exports.startInternalMonitoring = void 0;
exports.setDebugMode = exports.scrubCustomerFrames = exports.addMonitoringError = exports.addMonitoringMessage = exports.callMonitored = exports.monitor = exports.monitored = exports.isTelemetryReplicationAllowed = exports.resetInternalMonitoring = exports.startFakeInternalMonitoring = exports.startInternalMonitoring = void 0;
var display_1 = require("../../tools/display");

@@ -11,6 +11,12 @@ var error_1 = require("../../tools/error");

var configuration_1 = require("../configuration");
var ALLOWED_FRAME_URLS = [
'https://www.datadoghq-browser-agent.com',
'https://www.datad0g-browser-agent.com',
'http://localhost',
'<anonymous>',
];
var TELEMETRY_ALLOWED_SITES = [
configuration_1.INTAKE_SITE_US5,
configuration_1.INTAKE_SITE_US3,
// INTAKE_SITE_EU,
configuration_1.INTAKE_SITE_EU,
// INTAKE_SITE_US,

@@ -45,3 +51,3 @@ ];

service: 'browser-sdk',
version: "4.10.3",
version: "4.10.4",
source: 'browser',

@@ -153,3 +159,3 @@ _dd: {

kind: stackTrace.name,
stack: (0, error_1.toStackTraceString)(stackTrace),
stack: (0, error_1.toStackTraceString)(scrubCustomerFrames(stackTrace)),
},

@@ -166,2 +172,7 @@ message: stackTrace.message,

}
function scrubCustomerFrames(stackTrace) {
stackTrace.stack = stackTrace.stack.filter(function (frame) { return !frame.url || ALLOWED_FRAME_URLS.some(function (allowedFrameUrl) { return (0, utils_1.startsWith)(frame.url, allowedFrameUrl); }); });
return stackTrace;
}
exports.scrubCustomerFrames = scrubCustomerFrames;
function setDebugMode(debugMode) {

@@ -168,0 +179,0 @@ monitoringConfiguration.debugMode = debugMode;

@@ -21,3 +21,3 @@ "use strict";

endpointType: endpointType,
version: "4.10.3",
version: "4.10.4",
connection: navigator.connection ? navigator.connection.effectiveType : undefined,

@@ -24,0 +24,0 @@ onLine: navigator.onLine,

@@ -6,3 +6,3 @@ import { setDebugMode } from '../domain/internalMonitoring';

var publicApi = assign({
version: "4.10.3",
version: "4.10.4",
// This API method is intentionally not monitored, since the only thing executed is the

@@ -9,0 +9,0 @@ // user-provided 'callback'. All SDK usages executed in the callback should be monitored, and

@@ -25,5 +25,5 @@ import { timeStampNow } from '../../tools/timeUtils';

var parameters = "ddsource=".concat(source || 'browser') +
"&ddtags=".concat(encodeURIComponent(["sdk_version:".concat("4.10.3")].concat(tags).join(','))) +
"&ddtags=".concat(encodeURIComponent(["sdk_version:".concat("4.10.4")].concat(tags).join(','))) +
"&dd-api-key=".concat(clientToken) +
"&dd-evp-origin-version=".concat(encodeURIComponent("4.10.3")) +
"&dd-evp-origin-version=".concat(encodeURIComponent("4.10.4")) +
'&dd-evp-origin=browser' +

@@ -30,0 +30,0 @@ "&dd-request-id=".concat(generateUUID());

import type { Context } from '../../tools/context';
import type { Configuration } from '../configuration';
import type { StackTrace } from '../tracekit';
import { Observable } from '../../tools/observable';

@@ -37,3 +38,4 @@ import type { TelemetryEvent } from './telemetryEvent.types';

export declare function addMonitoringError(e: unknown): void;
export declare function scrubCustomerFrames(stackTrace: StackTrace): StackTrace;
export declare function setDebugMode(debugMode: boolean): void;
export {};
import { display } from '../../tools/display';
import { toStackTraceString } from '../../tools/error';
import { assign, combine, jsonStringify, performDraw, includes } from '../../tools/utils';
import { assign, combine, jsonStringify, performDraw, includes, startsWith } from '../../tools/utils';
import { computeStackTrace } from '../tracekit';
import { Observable } from '../../tools/observable';
import { timeStampNow } from '../../tools/timeUtils';
import { isExperimentalFeatureEnabled, INTAKE_SITE_US5, INTAKE_SITE_US3, INTAKE_SITE_STAGING } from '../configuration';
import { isExperimentalFeatureEnabled, INTAKE_SITE_US5, INTAKE_SITE_US3, INTAKE_SITE_STAGING, INTAKE_SITE_EU, } from '../configuration';
var ALLOWED_FRAME_URLS = [
'https://www.datadoghq-browser-agent.com',
'https://www.datad0g-browser-agent.com',
'http://localhost',
'<anonymous>',
];
var TELEMETRY_ALLOWED_SITES = [
INTAKE_SITE_US5,
INTAKE_SITE_US3,
// INTAKE_SITE_EU,
INTAKE_SITE_EU,
// INTAKE_SITE_US,

@@ -41,3 +47,3 @@ ];

service: 'browser-sdk',
version: "4.10.3",
version: "4.10.4",
source: 'browser',

@@ -140,3 +146,3 @@ _dd: {

kind: stackTrace.name,
stack: toStackTraceString(stackTrace),
stack: toStackTraceString(scrubCustomerFrames(stackTrace)),
},

@@ -153,2 +159,6 @@ message: stackTrace.message,

}
export function scrubCustomerFrames(stackTrace) {
stackTrace.stack = stackTrace.stack.filter(function (frame) { return !frame.url || ALLOWED_FRAME_URLS.some(function (allowedFrameUrl) { return startsWith(frame.url, allowedFrameUrl); }); });
return stackTrace;
}
export function setDebugMode(debugMode) {

@@ -155,0 +165,0 @@ monitoringConfiguration.debugMode = debugMode;

@@ -17,3 +17,3 @@ import { isExperimentalFeatureEnabled } from '../domain/configuration';

endpointType: endpointType,
version: "4.10.3",
version: "4.10.4",
connection: navigator.connection ? navigator.connection.effectiveType : undefined,

@@ -20,0 +20,0 @@ onLine: navigator.onLine,

{
"name": "@datadog/browser-core",
"version": "4.10.3",
"version": "4.10.4",
"license": "Apache-2.0",

@@ -24,3 +24,3 @@ "main": "cjs/index.js",

},
"gitHead": "2bc03d853ebd99cc2ed52af7c1bbabae74be9b88"
"gitHead": "9a082831d321fad09e9a6f1f4c6c73b9449a9869"
}

@@ -0,1 +1,2 @@

import type { StackTrace } from '@datadog/browser-core'
import type { Context } from '../../tools/context'

@@ -20,2 +21,3 @@ import { display } from '../../tools/display'

setDebugMode,
scrubCustomerFrames,
} from './internalMonitoring'

@@ -248,3 +250,3 @@ import type { TelemetryEvent } from './telemetryEvent.types'

{ site: INTAKE_SITE_US3, enabled: true },
{ site: INTAKE_SITE_EU, enabled: false },
{ site: INTAKE_SITE_EU, enabled: true },
{ site: INTAKE_SITE_US, enabled: false },

@@ -365,1 +367,19 @@ ].forEach(({ site, enabled }) => {

})
describe('scrubCustomerFrames', () => {
it('should remove stack trace frames that are related to customer files', () => {
;[
{ scrub: false, url: 'https://www.datadoghq-browser-agent.com/datadog-rum-v4.js' },
{ scrub: false, url: 'https://www.datad0g-browser-agent.com/datadog-rum-v5.js' },
{ scrub: false, url: 'http://localhost/index.html' },
{ scrub: false, url: undefined },
{ scrub: false, url: '<anonymous>' },
{ scrub: true, url: 'https://foo.bar/path?qux=qix' },
].forEach(({ url, scrub }) => {
const candidate: Partial<StackTrace> = {
stack: [{ url }],
}
expect(scrubCustomerFrames(candidate as StackTrace).stack.length).toBe(scrub ? 0 : 1, `for url: ${url!}`)
})
})
})
import type { Context } from '../../tools/context'
import { display } from '../../tools/display'
import { toStackTraceString } from '../../tools/error'
import { assign, combine, jsonStringify, performDraw, includes } from '../../tools/utils'
import { assign, combine, jsonStringify, performDraw, includes, startsWith } from '../../tools/utils'
import type { Configuration } from '../configuration'
import type { StackTrace } from '../tracekit'
import { computeStackTrace } from '../tracekit'
import { Observable } from '../../tools/observable'
import { timeStampNow } from '../../tools/timeUtils'
import { isExperimentalFeatureEnabled, INTAKE_SITE_US5, INTAKE_SITE_US3, INTAKE_SITE_STAGING } from '../configuration'
import {
isExperimentalFeatureEnabled,
INTAKE_SITE_US5,
INTAKE_SITE_US3,
INTAKE_SITE_STAGING,
INTAKE_SITE_EU,
} from '../configuration'
import type { TelemetryEvent } from './telemetryEvent.types'

@@ -20,2 +27,9 @@

const ALLOWED_FRAME_URLS = [
'https://www.datadoghq-browser-agent.com',
'https://www.datad0g-browser-agent.com',
'http://localhost',
'<anonymous>',
]
export interface InternalMonitoring {

@@ -41,3 +55,3 @@ setExternalContextProvider: (provider: () => Context) => void

INTAKE_SITE_US3,
// INTAKE_SITE_EU,
INTAKE_SITE_EU,
// INTAKE_SITE_US,

@@ -225,3 +239,3 @@ ]

kind: stackTrace.name,
stack: toStackTraceString(stackTrace),
stack: toStackTraceString(scrubCustomerFrames(stackTrace)),
},

@@ -239,2 +253,9 @@ message: stackTrace.message!,

export function scrubCustomerFrames(stackTrace: StackTrace) {
stackTrace.stack = stackTrace.stack.filter(
(frame) => !frame.url || ALLOWED_FRAME_URLS.some((allowedFrameUrl) => startsWith(frame.url!, allowedFrameUrl))
)
return stackTrace
}
export function setDebugMode(debugMode: boolean) {

@@ -241,0 +262,0 @@ monitoringConfiguration.debugMode = debugMode

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc