Exclude Scan files and folders with the Contrast web interface
You have the option to exclude specified files or folders from scans. This feature is useful when you want to exclude artifacts that generate a lot of noise or are irrelevant to the scan.
Contrast excludes some files and folders by default.
Before you begin
If you exclude files from a previously scanned project, Contrast changes the status of vulnerabilities affected by the exclusions to Remediated. For example, after you exclude files, the number of vulnerabilities in the scan results could be reduced from the original findings and the number of remediated vulnerabilities could increase.
Specified file and folder names are case-sensitive.
Steps
In the root of the ZIP file you are scanning, create a file named
.contrast-scan.json
.In the JSON file, specify the files and folders you want to exclude using this format:
{ "excludes": [ "**/MavenWrapperDownloader.java", "**/*.js" ] }
Replace the examples of
MavenWrapperDownloader.java
and*.js
with the names of your files and folders.Run the scan in the Contrast web interface.
Pattern examples
These examples show how you can specify excluded files and folders.
Patterns are considered relative paths.
This pattern example: | Excludes... |
---|---|
| Files with zero or more than one character before the Not excluded: Files that are not in the root directory being scanned, even if the filename has an extension of |
| Files with one character before the Not excluded: Files such as |
| All folders and files with the extension of |
| All files in |
| All files in the Not excluded: The file |
| All files in Not excluded: A file named |
| All files that have |
| Excludes the string |
Default exclusions
By default, Contrast Scan excludes these files, folders, patterns, and extensions:
Excluded file and folder patterns | Excluded extensions | Excluded files |
---|---|---|
|
|
|
See also
Directory-based tasks provides additional information on patterns for specifying files and folders.