Skip to content

Commit

Permalink
detect brave plugins prototype lie #16
Browse files Browse the repository at this point in the history
  • Loading branch information
abrahamjuliot committed Nov 21, 2020
1 parent fed4030 commit a3ec91a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion modules/navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ export const getNavigator = (imports, workerScope) => {
return mimeTypes ? [...mimeTypes].map(m => m.type) : []
}, 'mimeTypes failed'),
plugins: attempt(() => {
const navigatorPlugins = navigator.plugins
const ownProperties = Object.keys(Object.getOwnPropertyDescriptors(navigatorPlugins))
const ownPropertiesSet = new Set(ownProperties)
const plugins = contentWindowNavigator.plugins
const response = plugins ? [...contentWindowNavigator.plugins]
.map(p => ({
Expand All @@ -293,7 +296,17 @@ export const getNavigator = (imports, workerScope) => {
})) : []
if (!!response.length) {
response.forEach(plugin => {
const { name } = plugin
const { name } = plugin

if (!ownPropertiesSet.has(name)) {
lied = true
const pluginsLie = {
fingerprint: '',
lies: [{ [`Expected name "${name}" in plugins own properties and got [${ownProperties.join(', ')}]`]: true }]
}
documentLie(`Navigator.plugins`, hashMini(ownProperties), pluginsLie)
}

const gibbers = gibberish(name)
if (!!gibbers.length) {
sendToTrash(`plugin contains gibberish`, `[${gibbers.join(', ')}] ${name}`)
Expand Down

0 comments on commit a3ec91a

Please sign in to comment.