<commit_before>// This are the functions that DO NOT require an allow/deny decision by the user.
// All other IPFS functions require authorization.
const ACL_WHITELIST = Object.freeze(require('./acl-whitelist.json'))

// Creates a "pre" function that is called prior to calling a real function
// on the IPFS instance. It will throw if access is denied, and ask the user if
// no access decision has been made yet.
function createPreAcl (getState, accessControl, getScope, permission, requestAccess) {
  return async (...args) => {
    // Check if all access to the IPFS node is disabled
    if (!getState().ipfsProxy) throw new Error('User disabled access to IPFS')

    // No need to verify access if permission is on the whitelist
    if (ACL_WHITELIST.includes(permission)) return args
<commit_msg>temporarily disables access to MFS functions on window.ipfs<commit_after>// This are the functions that DO NOT require an allow/deny decision by the user.
// All other IPFS functions require authorization.
const ACL_WHITELIST = Object.freeze(require('./acl-whitelist.json'))

// TEMPORARY blacklist of MFS functions that are automatically denied access
// https://github.com/ipfs-shipyard/ipfs-companion/issues/330#issuecomment-367651787
const MFS_BLACKLIST = Object.freeze([
  'files.cp',
  'files.mkdir',
  'files.stat',
  'files.rm',
  'files.read',
  'files.write',
  'files.mv',
  'files.flush',
  'files.ls'
])

// Creates a "pre" function that is called prior to calling a real function
// on the IPFS instance. It will throw if access is denied, and ask the user if
// no access decision has been made yet.
function createPreAcl (getState, accessControl, getScope, permission, requestAccess) {
  return async (...args) => {
    // Check if all access to the IPFS node is disabled
    if (!getState().ipfsProxy) throw new Error('User disabled access to IPFS')

    if (MFS_BLACKLIST.includes(permission)) {
      throw new Error('MFS functions are temporarily disabled')
    }

    // No need to verify access if permission is on the whitelist
    if (ACL_WHITELIST.includes(permission)) return args

{'fraction_non_alphanumeric': 0.09625414888572784, 'fraction_numerical': 0.005689900426742532, 'mean_word_length': 3.884259259259259, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5199040', 'n_tokens_mistral': 617, 'n_tokens_neox': 597, 'n_words': 247}