Add bypass for Realeyes VerifEye (@realeyes/verifeye-sdk)#30
Conversation
helloyanis
left a comment
There was a problem hiding this comment.
Also, maybe add a few comments explaining what each of the listeners do? It's hard to understand from a distance.
| browser.webRequest.onBeforeRequest.addListener(_injectPatcher, { urls: ["*://*/*faceDetectionService-CohHJWWF*"] }, []); | ||
| browser.webRequest.onBeforeRequest.addListener(_injectPatcher, { urls: ["*://verifeye-service-eu.realeyes.ai/api/v1/verification/init-session*", "*://verifeye-service-us.realeyes.ai/api/v1/verification/init-session*"] }, []); |
There was a problem hiding this comment.
These could be merged into a single listener. But with onHeadersReceived I don't think there should be a need to initialize these since it gets called directly when the URL is called.
| target: { tabId: details.tabId, allFrames: true }, | ||
| func: () => { | ||
| if (document.__verifeyePatcherInjected) return; | ||
| document.__verifeyePatcherInjected = true; |
There was a problem hiding this comment.
This can be very easily patched and checked by the site so that they can detect that the extension is installed. I'll have to see if it's possible to change that
| func: () => { | ||
| if (document.__verifeyePatcherInjected) return; | ||
| document.__verifeyePatcherInjected = true; | ||
| const s = document.createElement("script"); |
There was a problem hiding this comment.
This can also be detected by the page. I recommend using the API executeScript like on the reddit bypass, so that it's not injected on the page and so they can't check for an added script tag
| if(window.__verifeyeBypassInstalled)return; | ||
| window.__verifeyeBypassInstalled=true; | ||
| const orig=window.fetch; | ||
| window.fetch=async function(resource,options){ | ||
| const url=resource instanceof Request?resource.url:String(resource); | ||
| if(url.includes("verifeye-service-")&&url.includes("/api/v1/verification/")){ | ||
| if(url.includes("/init-session")){ | ||
| let sid;try{sid=JSON.parse(options?.body||"{}").verificationSessionId;}catch{} | ||
| return new Response(JSON.stringify({verificationSessionId:sid||crypto.randomUUID(),livenessCheckType:"disabled",kinesisConfig:null,accountHash:""}),{status:200,headers:{"Content-Type":"application/json"}}); | ||
| } | ||
| return new Response("{}",{status:200,headers:{"Content-Type":"application/json"}}); | ||
| } | ||
| return orig.apply(this,arguments); | ||
| }; | ||
| })();`; |
There was a problem hiding this comment.
I think it's best if we don't patch the fetch function. A better practice is to use onHeadersReceived to modify the response headers like the status code
https://realeyes.ai/try-demo/#demo
https://realeyes.ai/verifeye-demo-eu/