Skip to content

Exclude from scan option throwing errors #98

@Graren

Description

@Graren

EDIT: I now know that the correct way of excluded options is not SCREAMING_SNAKE_CASE but in PascalCase and the exclusion works.

Could you support both the SCREAMING_SNAKE_CASE name and the pascal case name? or explicitly indicate in the docs how it should be used?

Describe the bug
Exclude from scan option on API and -x option on CLI throwing the following error

You have an error in your custom checks list. Maybe you misspelt some check names?

I want to run the checker excluding "CSP_GLOBAL_CHECK" and "LIMIT_NAVIGATION_GLOBAL_CHECK", since I know I have them right but they error out anyway, maybe because I have them abstracted under a layer of wrapper testable code since electron itself is too difficult to mock around with

To Reproduce
Steps to reproduce the behavior:

  • Make a node script to run the checker:
const run = require("@doyensec/electronegativity")
const path = require("path")

run({
  // input (directory, .js, .html, .asar)
  input: path.resolve(__dirname, "..", "src"),
  excludeFromScan: ["CSP_GLOBAL_CHECK", "LIMIT_NAVIGATION_GLOBAL_CHECK"],
  parserPlugins: []
})
  .then((result) => {
    const { errors } = result
    if (errors && errors.length > 0) {
      console.error(result)
      process.exit(1)
    }
    process.exit(0)
  })
  .catch((err) => {
    console.error(err)
    process.exit(1)
  })

Outputs You have an error in your custom checks list. Maybe you misspelt some check names?

Expected behavior
For it to run the checker without checking the 2 mentioned check Ids

**Stacktraces **
None

Platform (please complete the following information):

  • OS: Ubuntu 16.04
  • Electronegativity version: 1.9.1

Other info
Besides that, running electronegativity by api without setting

...
  parserPlugins: []

Throws an error because you don't seem to be checking for the value to be a valid array before checking it's length

// Went from this
run({
 input: path.resolve(__dirname, "..", "src"),
 excludeFromScan: ["CSP_GLOBAL_CHECK", "LIMIT_NAVIGATION_GLOBAL_CHECK"]
})

// To this
run({
 // input (directory, .js, .html, .asar)
 input: path.resolve(__dirname, "..", "src"),
 excludeFromScan: ["CSP_GLOBAL_CHECK", "LIMIT_NAVIGATION_GLOBAL_CHECK"],
 parserPlugins: []
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions