ipfs / ipfs-companion

Browser extension that simplifies access to IPFS resources on the web
https://docs.ipfs.tech/install/ipfs-companion/
Creative Commons Zero v1.0 Universal
2.07k stars 324 forks source link

Words found that violate the Mozilla conditions of use #369

Closed lidel closed 5 years ago

lidel commented 6 years ago

Seems that we have some F-bombs in source that trigger linter notices 😸

MOZILLA_COND_OF_USE   Violation of Mozilla conditions of use.   Words found that violate the Mozilla conditions of use. See                            dist/ipfs-companion-common.js                              
                                                                https://www.mozilla.org/en-US/about/legal/acceptable-use/ for more details.                                                                       
MOZILLA_COND_OF_USE   Violation of Mozilla conditions of use.   Words found that violate the Mozilla conditions of use. See                            dist/contentScripts/ipfs-proxy/page.js                     
                                                                https://www.mozilla.org/en-US/about/legal/acceptable-use/ for more details.
alanshaw commented 6 years ago

It's likely in ipfs or one of it's dependencies.

alanshaw commented 6 years ago

One of these: https://github.com/mozilla/addons-linter/blob/master/src/badwords.json

alanshaw commented 6 years ago

find-badwords.js

const Fs = require('fs')
const file = Fs.readFileSync('../../ipfs-companion-common.js', 'utf8')
const badwords = require('./badwords.json')

const BADWORDS_RE = {
  en: new RegExp(`\\b(?:${badwords.en.join('|')})\\b`, 'gi'),
}

console.log('finding badwords...')

const matches = file.match(BADWORDS_RE.en)

console.log(matches)

output:

$ node find-badwords.js 
finding badwords...
[ 'fucked', 'Fuck' ]
alanshaw commented 6 years ago

https://github.com/ethereumjs/merkle-patricia-tree/blob/828febf0904553b29c1e310104b997c8bd023621/trieNode.js#L238

https://github.com/stevemao/left-pad/blob/32d6036ac3d352c0a8e331ad6fdd664e4fa0a620/index.js#L3

Both of these are in comments so shouldn't be a problem. We can resolve if we uglify ipfs-companion-common.js

ghost commented 6 years ago

Fuck and queer are badwords? :S That's pretty bad. I took the liberty to file mozilla/addons-linter#1851.

olizilla commented 6 years ago

Moz closed the request to modify the badwords list, so we'll have to uglify ipfs-companion-common.js

lidel commented 6 years ago

Closing (uglified sensitive parts and MOZILLA_COND_OF_USE is no longer present)

alanshaw commented 6 years ago

fixed in https://github.com/ipfs-shipyard/ipfs-companion/pull/402

lidel commented 5 years ago

Aaaaand we are at this again:

$ yarn lint

Code                  Message                                   Description                                                                   File                                    Line   Column
MOZILLA_COND_OF_USE   Violation of Mozilla conditions of use.   Words found that violate the Mozilla conditions of use. See                   dist/bundles/backgroundPage.bundle.js                
                                                                https://www.mozilla.org/en-US/about/legal/acceptable-use/ for more details.                                                        
$ node find-badwords.js
finding badwords...
[ 'Cum' ]

Cum is introduced by a day name translation (tr_TR) in https://github.com/samsonjs/strftime/blob/v0.10.0/strftime.js#L227:

shortDays:["Paz","Pzt","Sal","Çrş","Prş","Cum","Cts"]

Filled upstream issue: https://github.com/mozilla/addons-linter/issues/2553

lidel commented 5 years ago

Fixed in https://github.com/mozilla/addons-linter/issues/2591