Skip to content

warn or info for similar looking advisory URLs #11

@g-k

Description

@g-k

refs: #2 nodesecurity.io redirect and mozilla/fxa-profile-server#353 and related discussion on #fxa on IRC (job https://travis-ci.org/mozilla/fxa-profile-server/jobs/457024645).

Exit codes and filter matching would be unchanged, but when similar looking URLs show up in the audit JSON output we write to stderr something like:

"found the url 'https://www.npmjs.com/advisories/598' on .nsmprc line X did you mean 'https://npmjs.com/advisories/598' to match line Y from the audit JSON output?"

and suggest that they check both URLs resolve to the same advisory.

We can define "similar looking URLs" to 1) contain the same advisory ID and 2) have one of more of the following be true:

  • domain differs between nodesecurity.io and npmjs.com
  • protocol differs between http and https (also probably want to warn for http)
  • an optional www subdomain e.g. from npmjs.com/advisories/ and www.npmjs.com/advisories/

Unit tests would check that we make suggestions for:

  • https://nodesecurity.io/advisories/598 and https://npmjs.com/advisories/598
  • http://nodesecurity.io/advisories/598 vs https://nodesecurity.io/advisories/598
  • https://npmjs.com/advisories/598 and https://www.npmjs.com/advisories/598

and no suggestion for other URLs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions