Skip to content

Commit

Permalink
Revert "[Fraud] Get Fingerprinted Visitor ID (#93952)" (#94346)
Browse files Browse the repository at this point in the history
This reverts commit 1e83dc8.
  • Loading branch information
rcanepa authored Sep 9, 2024
1 parent 910c4da commit 5461f53
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 65 deletions.
3 changes: 0 additions & 3 deletions client/lib/wp/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import wpcomProxyRequest from 'wpcom-proxy-request';
import * as oauthToken from 'calypso/lib/oauth-token';
import wpcomSupport from 'calypso/lib/wp/support';
import wpcomXhrWrapper, { jetpack_site_xhr_wrapper } from 'calypso/lib/wpcom-xhr-wrapper';
import { injectFingerprint } from './handlers/fingerprint';
import { injectGuestSandboxTicketHandler } from './handlers/guest-sandbox-ticket';
import { injectLocalization } from './localization';

Expand Down Expand Up @@ -48,8 +47,6 @@ injectLocalization( wpcom );

injectGuestSandboxTicketHandler( wpcom );

injectFingerprint( wpcom );

/**
* Expose `wpcom`
*/
Expand Down
34 changes: 0 additions & 34 deletions client/lib/wp/handlers/fingerprint.js

This file was deleted.

1 change: 0 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"@automattic/domains-table": "workspace:^",
"@automattic/explat-client": "workspace:^",
"@automattic/explat-client-react-helpers": "workspace:^",
"@automattic/fingerprintjs": "workspace:^",
"@automattic/format-currency": "workspace:^",
"@automattic/generate-password": "workspace:^",
"@automattic/global-styles": "workspace:^",
Expand Down
3 changes: 0 additions & 3 deletions client/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,6 @@ const webpackConfig = {
!! process.env.FORCE_REDUCED_MOTION || false
),
__i18n_text_domain__: JSON.stringify( 'default' ),
fingerprintJsVersion: JSON.stringify(
require( '../packages/fingerprintjs/package.json' ).version
),
global: 'window',
} ),
// Node polyfills
Expand Down
1 change: 0 additions & 1 deletion packages/fingerprintjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"url": "https://github.com/fingerprintjs/fingerprintjs/issues"
},
"homepage": "https://github.com/fingerprintjs/fingerprintjs",
"calypso:src": "src/index.ts",
"main": "dist/fp.cjs.js",
"module": "dist/fp.esm.js",
"types": "dist/fp.d.ts",
Expand Down
3 changes: 2 additions & 1 deletion packages/fingerprintjs/src/agent.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { version } from '../package.json';
import { withMockProperties } from '../tests/utils';
import { load as loadAgent } from './agent';
import { sources } from './sources';
Expand All @@ -12,7 +13,7 @@ describe( 'Agent', () => {
expect( result.visitorId ).not.toEqual( '' );
expect( typeof result.confidence.score ).toBe( 'number' );
expect( typeof result.confidence.comment ).toBe( 'string' );
expect( result.version ).toBe( window.fingerprintJsVersion );
expect( result.version ).toBe( version );

const expectedComponents = Object.keys( sources ).sort() as Array< keyof typeof sources >;
expect( expectedComponents.length ).toBeGreaterThan( 10 ); // To check the test itself
Expand Down
5 changes: 3 additions & 2 deletions packages/fingerprintjs/src/agent.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { version } from '../package.json';
import { requestIdleCallbackIfAvailable } from './utils/async';
import { UnknownComponents } from './utils/entropy_source';
import { x64hash128 } from './utils/hashing';
Expand Down Expand Up @@ -127,7 +128,7 @@ function makeLazyGetResult( components: BuiltinComponents ): GetResult {
},
confidence,
components,
version: window.fingerprintJsVersion,
version,
};
}

Expand Down Expand Up @@ -189,7 +190,7 @@ function monitor() {
const request = new XMLHttpRequest();
request.open(
'get',
`https://m1.openfpcdn.io/fingerprintjs/v${ window.fingerprintJsVersion }/npm-monitoring`,
`https://m1.openfpcdn.io/fingerprintjs/v${ version }/npm-monitoring`,
true
);
request.send();
Expand Down
1 change: 0 additions & 1 deletion packages/fingerprintjs/src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ interface Window {
webkitOfflineAudioContext?: OfflineAudioContext;
openDatabase?( ...args: unknown[] ): void;
__fpjs_d_m?: unknown;
fingerprintJsVersion: string;
}

interface Navigator {
Expand Down
36 changes: 23 additions & 13 deletions packages/fingerprintjs/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
import { load, hashComponents, componentsToDebugString } from './agent';
import {
load,
Agent,
LoadOptions,
GetOptions,
GetResult,
hashComponents,
componentsToDebugString,
} from './agent';
import { BuiltinComponents } from './sources';
import { Confidence } from './confidence';
import { Component, UnknownComponents } from './utils/entropy_source';
import { x64hash128 } from './utils/hashing';
import type { Agent, GetOptions, GetResult, LoadOptions } from './agent';
import type { BuiltinComponents } from './sources';
import type { Component, UnknownComponents } from './utils/entropy_source';
import type { Confidence } from './confidence';

// Exports that are under Semantic versioning
export { load, hashComponents, componentsToDebugString };
export type {
export {
load,
Agent,
BuiltinComponents,
Component,
Confidence,
LoadOptions,
GetOptions,
GetResult,
LoadOptions,
hashComponents,
componentsToDebugString,
Component,
UnknownComponents,
BuiltinComponents,
Confidence,
};

// The default export is a syntax sugar (`import * as FP from '...' → import FP from '...'`).
// It should contain all the public exported values.
export default { load, hashComponents, componentsToDebugString };
Expand All @@ -40,7 +48,9 @@ export {
} from './utils/browser';
export {
loadSources,
Source,
SourcesToComponents,
transformSource, // Not used here but adds only 222 uncompressed (60 compressed) bytes of code
UnknownSources,
} from './utils/entropy_source';
export type { Source, SourcesToComponents, UnknownSources } from './utils/entropy_source';
export { withIframe } from './utils/dom';
5 changes: 1 addition & 4 deletions packages/fingerprintjs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@
"importHelpers": true,
"noErrorTruncation": true,
"strict": true,
"composite": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"isolatedModules": false,
"types": [ "node", "jasmine" ],
"typeRoots": [ "../../node_modules/@types", "node_modules/@types/jasmine" ],
"sourceMap": false,
"types": [ "jasmine" ],
"declarationDir": "dist/types",
"outDir": "dist/esm",
"rootDir": "."
Expand Down
3 changes: 1 addition & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ __metadata:
languageName: unknown
linkType: soft

"@automattic/fingerprintjs@workspace:^, @automattic/fingerprintjs@workspace:packages/fingerprintjs":
"@automattic/fingerprintjs@workspace:packages/fingerprintjs":
version: 0.0.0-use.local
resolution: "@automattic/fingerprintjs@workspace:packages/fingerprintjs"
dependencies:
Expand Down Expand Up @@ -12685,7 +12685,6 @@ __metadata:
"@automattic/domains-table": "workspace:^"
"@automattic/explat-client": "workspace:^"
"@automattic/explat-client-react-helpers": "workspace:^"
"@automattic/fingerprintjs": "workspace:^"
"@automattic/format-currency": "workspace:^"
"@automattic/generate-password": "workspace:^"
"@automattic/global-styles": "workspace:^"
Expand Down

0 comments on commit 5461f53

Please sign in to comment.