Please note that this is not an official Veracode project, not supported by Veracode in any form, and comes with no warranty whatsoever. It is simply a little pet project of mine trying to make the life of Veracode's Node.js customers a bit easier. Use at your own risk.
The Veracode Node Packager is a tool that packages your Node.js application for Veracode Static Analysis. The idea is to avoid common mistakes that I, in my role as a Veracode Application Security Consultant, commonly see in customer uploads.
There also is a sample-node-project folder that contains a "Hello World"-ish Node.js application with a lot of the files that we want to filter out. This test project can be used to take Veracode Node Packager for a spin.
Please feel free to extend the existing functionality, followed by a Merge Request.
Help is built-in!
vc-node-packager --help- outputs the help.
Usage:
vc-node-packager [flags]
Flags:
-source string The path of the Node.js app you want to package (default "sample-node-project")
-target string The path where you want the vc-output.zip to be stored to (default ".")
-tests string The path that contains your Node.js test files (relative to the source) (default "test")
- Creates a zip of the
-sourcefolder and puts it into the provided-targetdirectory asvc-output.zip Features:- This tool creates a zip of your application ready to be uploaded to the Veracode Platform
- It prevents common, non-required, files from being a part of the zip (such as
node_modules,tests) - The tool also checks for "smells" that indicate something might not be right with the packaging, and prints corresponding warnings/errors if a "smell" was found
Omitted Files/Folders:- Omit the
node_modulesfolder (usually only contains 3rd party libraries) - Omit the
testsdirectory (that contains e.g. your unit- and integration tests)- Specified via
-tests <path>
- Specified via
- Omit style sheets (
.cssand.scssfiles) - Omit images (e.g.
.jpg,.png) - Omit documents (e.g.
.pdf) - Omit the
.gitfolder - Omit other non-required files (e.g.
.DS_Store)
- Omit the
Additional Checks:- Check if
package-lock.jsonexists (this is required for Veracode SCA) - Check if
/publicexists (may contain resources that are not part of your actual 1st party source code) - Check if
/distexists (may contain minified JavaScript) - Check for
.mapfiles (indicates that your JS files might be minified)
- Check if
- You can simply run this tool from source via
go run main.go - You can build the tool yourself via
go build
- The
Releasessection contains some binary releases already so that you might not have to build it yourself