Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tighten eligibility vpn check #2150

Merged
merged 3 commits into from
Nov 22, 2024
Merged

Tighten eligibility vpn check #2150

merged 3 commits into from
Nov 22, 2024

Conversation

usame-algan
Copy link
Member

Summary

Follow up on #2103

Through testing we noticed that Fingerprint sometimes mistakenly marks a request as using a VPN but with a low confidence. This change tightens the condition that decides whether vpn is true or false by also checking the confidence score.

Changes

  • Only marks vpn: true if it also has a confidence score of high

@usame-algan usame-algan requested a review from a team as a code owner November 22, 2024 13:50
data: z
.object({
result: z.boolean(),
confidence: z.enum(['low', 'medium', 'high']),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could we extract this to an enum, as it's used in across several places?

(as an example):

export enum FingerprintConfidenceLevels {...}

data: z
.object({
result: z.boolean(),
confidence: z.enum(['low', 'medium', 'high']),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: we should add an unknown value that we fallback to as we do elsewhere to ensure we cover unknowns. We should also add test coverage for this.

@@ -39,7 +39,9 @@ export class FingerprintApiService implements IIdentityApi {
return {
requestId,
isAllowed: this.isAllowed(unsealedData),
isVpn: unsealedData.products.vpn?.data?.result === true,
isVpn:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: maybe we could extract this to a new private isVpn(unsealedData: FingerprintUnsealedData): boolean function?

data: z
.object({
result: z.boolean(),
confidence: z.enum(['low', 'medium', 'high']),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could we extract this to an enum, as it's used in across several places?

(as an example):

export enum FingerprintConfidenceLevels {...}

Copy link
Member

@hectorgomezv hectorgomezv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@usame-algan usame-algan merged commit 637416c into main Nov 22, 2024
20 checks passed
@usame-algan usame-algan deleted the fingerprint-vpn branch November 22, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants