-
Notifications
You must be signed in to change notification settings - Fork 194
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
Detect Brave fingerprint farbling #16
Labels
enhancement
New feature or request
Comments
|
abrahamjuliot
added a commit
that referenced
this issue
Nov 1, 2020
EDIT: Fixed in desktop versions. From #53, this catches (function() {
'use strict';
const getNestedIframes = (n, context = window) => {
n = +n
let parent, total = n
return (function getIframeWindow(win, {
previous = context
} = {}) {
if (!win) {
console.log('stopped at ', total - n) // Firefox has a limit
return previous
}
const numberIframes = win.length
const div = win.document.createElement('div')
win.document.body.appendChild(div)
div.innerHTML = '<iframe></iframe>'
const iframeWindow = win[numberIframes]
if (total == n) {
parent = div
parent.setAttribute('style', 'display:none')
}
n--
if (!n) {
parent.parentNode.removeChild(parent) //
return iframeWindow
}
return getIframeWindow(iframeWindow, {
previous: win
})
})(context)
}
const nestedWindow = getNestedIframes(20)
console.log('top: ', window.navigator.hardwareConcurrency)
console.log('nested: ', nestedWindow.navigator.hardwareConcurrency)
})() |
abrahamjuliot
added a commit
that referenced
this issue
Nov 21, 2020
abrahamjuliot
added a commit
that referenced
this issue
Nov 21, 2020
abrahamjuliot
added a commit
that referenced
this issue
Nov 21, 2020
abrahamjuliot
added a commit
that referenced
this issue
Nov 21, 2020
abrahamjuliot
added a commit
that referenced
this issue
Nov 21, 2020
abrahamjuliot
changed the title
Add Brave lie detection
Detect Brave fingerprint farbling
Nov 21, 2020
abrahamjuliot
added a commit
that referenced
this issue
Nov 22, 2020
abrahamjuliot
added a commit
that referenced
this issue
Nov 22, 2020
abrahamjuliot
added a commit
that referenced
this issue
Nov 22, 2020
abrahamjuliot
added a commit
that referenced
this issue
Nov 23, 2020
function getBraveMode() {
try {
// strict mode returns null supported extensions
const canvas = document.createElement('canvas')
const gl = canvas.getContext('webgl')
if (!gl.getSupportedExtensions()) {
return 'strict'
}
// standard and strict mode do not have chrome plugins
const chromePlugins = /(Chrom(e|ium)|Microsoft Edge) PDF (Plugin|Viewer)/
const pluginsList = [...navigator.plugins]
const hasChromePlugins = pluginsList
.filter(plugin => chromePlugins.test(plugin.name)).length == 2
if (!hasChromePlugins) {
return 'standard'
}
return 'allow'
} catch (e) {
return 'unknown'
}
}
// if 'brave' in navigator...
getBraveMode() |
const detectBrave = async () => {
const windowKeys = Object.keys(Object.getOwnPropertyDescriptors(window))
const fileSystemKeys = /FileSystem((|Directory|File)Handle|WritableFileStream)|show((Directory|((Open|Save)File))Picker)/
// each can be spoofed or blocked
return {
// moving to flags
fileSystemAccessDisabled: !windowKeys.filter(key => fileSystemKeys.test(key)).length,
webSerialDisabled: !('Serial' in window || 'SerialPort' in window),
reportingDisabled: !('ReportingObserver' in window),
// not strictly brave
gpcInNavigator: 'globalPrivacyControl' in navigator,
// primary method
braveInNavigator: (
'brave' in navigator &&
Object.getPrototypeOf(navigator.brave).constructor.name == 'Brave' &&
navigator.brave.isBrave.toString() == 'function isBrave() { [native code] }'
),
// rule out other brands
brandIsNotGoogleMicrosoftOrOpera: (
!navigator.userAgentData ? 'unknown' :
!navigator.userAgentData.brands
.filter(item => /Google Chrome|Microsoft Edge|Opera/.test(item.brand)).length
),
// blink w/2147483648 is brave (spoofable and blockable)
storageQuotaIs2Gb: 2147483648 == (await navigator.storage.estimate()).quota,
}
}
;(async () => {
const x = await detectBrave()
console.log(x)
})() |
abrahamjuliot
added a commit
that referenced
this issue
Jun 10, 2021
abrahamjuliot
added a commit
that referenced
this issue
Jun 11, 2021
abrahamjuliot
added a commit
that referenced
this issue
Jun 11, 2021
abrahamjuliot
added a commit
that referenced
this issue
Jun 12, 2021
abrahamjuliot
added a commit
that referenced
this issue
Jun 12, 2021
abrahamjuliot
added a commit
that referenced
this issue
Nov 30, 2021
abrahamjuliot
added a commit
that referenced
this issue
Dec 4, 2021
abrahamjuliot
added a commit
that referenced
this issue
Dec 5, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tracking:
v2
https://github.com/brave/brave-browser/issues/8787
v3
https://github.com/brave/brave-browser/issues/11770
Testing at https://dev-pages.bravesoftware.com
The text was updated successfully, but these errors were encountered: