Skip to content
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

add npm command for running a network audit #1682

Merged
merged 4 commits into from
Oct 18, 2018
Merged

Conversation

diracdeltas
Copy link
Member

@diracdeltas diracdeltas commented Oct 18, 2018

'npm run network-audit' runs the browser with a clean profile for 2 minutes or until the browser quits. it returns non-zero if any of the URL requests that happened within that time aren't whitelisted and prints the failures to stdout.

it also produces a JSON file, network-audit-results.json, which contains all the network requests from the audit and produces a raw JSON file network_log.json which can be loaded in chrome://net-internals

whenever CI is ready, we should run npm run test-security automatically with each PR to check for unexpected network requests and known vulns in dependencies

fix #1694

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Verified that these changes build without errors on
    • Windows
    • macOS
    • Linux
  • Verified that these changes pass automated tests (npm test brave_unit_tests && npm test brave_browser_tests) on
    • Windows
    • macOS
    • Linux
  • Ran git rebase master (if needed).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.
  • Requested a security/privacy review as needed.

Test Plan:

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions.

'npm run network-audit' produces a JSON file,
network-audit-results.json, which contains the URL requests and 307's in
the current build.

it exits with non-zero status if any of the URLs in the audit are not
whitelisted
Copy link
Member

@bbondy bbondy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great, I posted an issue for devops to get this in CI:
https://github.com/brave/devops/issues/343

@bbondy bbondy merged commit bc86509 into master Oct 18, 2018
bbondy added a commit that referenced this pull request Oct 18, 2018
add npm command for running a network audit
bbondy added a commit that referenced this pull request Oct 18, 2018
add npm command for running a network audit
bbondy added a commit that referenced this pull request Oct 18, 2018
add npm command for running a network audit
@bbondy
Copy link
Member

bbondy commented Oct 18, 2018

master: bc86509
0.57.x: 88237c8
0.56.x 1b3c1b7
0.55.x: 42857d4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make it easier to run network audits for every PR
2 participants