Skip to content

Commit fd3f619

Browse files
committed
suggested changes, lint fix
1 parent 20feb0f commit fd3f619

File tree

8 files changed

+15
-49
lines changed

8 files changed

+15
-49
lines changed

examples/web/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
"description": "Example of using web plugins in browser",
66
"main": "index.js",
77
"scripts": {
8-
"lint": "eslint . --ext=ts,js,mjs",
9-
"lint:fix": "eslint . --ext=ts,js,mjs --fix",
108
"docker:start": "cd ./docker && docker-compose down && docker-compose up",
119
"docker:startd": "cd ./docker && docker-compose down && docker-compose up -d",
1210
"start": "webpack serve --mode development --progress --port 8090 --config webpack.config.js --hot --host 0.0.0.0"

packages/instrumentation-browser-navigation/.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/instrumentation-browser-navigation/.eslintrc.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

packages/instrumentation-browser-navigation/karma.conf.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
/*!
1+
/*
22
* Copyright The OpenTelemetry Authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* https://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,

packages/instrumentation-browser-navigation/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
"repository": "open-telemetry/opentelemetry-js-contrib",
1010
"scripts": {
1111
"clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
12-
"lint": "eslint --ext .ts",
13-
"lint:fix": "eslint --ext .ts --fix",
14-
"lint:readme": "node ../../scripts/lint-readme.js",
1512
"prewatch": "npm run version:update",
1613
"version:update": "node ../../scripts/version-update.js",
1714
"compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json",

packages/instrumentation-browser-navigation/src/instrumentation.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ export class BrowserNavigationInstrumentation extends InstrumentationBase<Browse
171171
try {
172172
const navigationApi = (window as any).navigation as EventTarget;
173173
navigationApi?.removeEventListener?.('navigate', this._onNavigateHandler);
174-
} catch {}
174+
} catch {
175+
// Ignore errors when removing Navigation API listeners
176+
}
175177
this._onNavigateHandler = undefined;
176178
}
177179
}
@@ -314,6 +316,11 @@ export class BrowserNavigationInstrumentation extends InstrumentationBase<Browse
314316
* - Preserves fragment when available
315317
*/
316318
private _sanitizeUrl(url: string): string {
319+
const sensitiveParams = [
320+
'password', 'passwd', 'secret', 'api_key', 'apikey', 'auth', 'authorization',
321+
'token', 'access_token', 'refresh_token', 'jwt', 'session', 'sessionid',
322+
'key', 'private_key', 'client_secret', 'client_id', 'signature', 'hash'
323+
];
317324
try {
318325
const urlObj = new URL(url);
319326

@@ -324,11 +331,7 @@ export class BrowserNavigationInstrumentation extends InstrumentationBase<Browse
324331
}
325332

326333
// Redact sensitive query parameters
327-
const sensitiveParams = [
328-
'password', 'passwd', 'secret', 'api_key', 'apikey', 'auth', 'authorization',
329-
'token', 'access_token', 'refresh_token', 'jwt', 'session', 'sessionid',
330-
'key', 'private_key', 'client_secret', 'client_id', 'signature', 'hash'
331-
];
334+
332335

333336
for (const param of sensitiveParams) {
334337
if (urlObj.searchParams.has(param)) {
@@ -341,13 +344,6 @@ export class BrowserNavigationInstrumentation extends InstrumentationBase<Browse
341344
// If URL parsing fails, redact credentials and sensitive query parameters
342345
let sanitized = url.replace(/\/\/[^:]+:[^@]+@/, '//REDACTED:REDACTED@');
343346

344-
// Redact sensitive query parameters using regex
345-
const sensitiveParams = [
346-
'password', 'passwd', 'secret', 'api_key', 'apikey', 'auth', 'authorization',
347-
'token', 'access_token', 'refresh_token', 'jwt', 'session', 'sessionid',
348-
'key', 'private_key', 'client_secret', 'client_id', 'signature', 'hash'
349-
];
350-
351347
for (const param of sensitiveParams) {
352348
// Match param=value or param%3Dvalue (URL encoded)
353349
const regex = new RegExp(`([?&]${param}(?:%3D|=))[^&]*`, 'gi');

packages/instrumentation-browser-navigation/test/navigation.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ describe('Browser Navigation Instrumentation', () => {
391391
}
392392
}, 50);
393393
}
394-
} catch (error) {
394+
} catch (_error) {
395395
// Fallback if Navigation API methods fail
396396
console.log('Navigation API methods not fully supported, using fallback');
397397
history.pushState({}, '', '?test=fallback');
@@ -484,7 +484,7 @@ describe('Browser Navigation Instrumentation', () => {
484484
}
485485
}, 50);
486486
}
487-
} catch (error) {
487+
} catch (_error) {
488488
// Fallback to traditional hash change
489489
location.hash = '#section1';
490490
setTimeout(() => {

packages/instrumentation-browser-navigation/web-test-runner.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
/*!
1+
/*
22
* Copyright The OpenTelemetry Authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* https://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,

0 commit comments

Comments
 (0)