Everyone talks about Checkmarx's JavaScript/TS scanning, but the default configs are garbage for modern SPAs. You'll get thousands of false positives from node_modules and build artifacts, burying real issues.
Here's how to lock it down.
First, kill the noise. Use `CxInclude` and `CxExclude` files at the project root, not just GUI filters. Example `.cxignore`:
```
# Dependencies
**/node_modules/**
**/package-lock.json
**/yarn.lock
# Build outputs
**/build/**
**/dist/**
**/.next/
**/out/
# Configs (usually not source)
**/webpack.config.*
**/vite.config.*
**/*.config.js
```
Second, tune the engine for your framework. For React with JSX/TSX:
* Enable **TypeScript Scanner** and **JavaScript Source Scanner**.
* Disable **JavaScript Obfuscation Scanner** (waste of time for most SPA source).
* Set **Project Type** to "JavaScript/TypeScript".
Third, define custom patterns for false positives. In the query management section, suppress findings from:
* Third-party library paths (`**/node_modules/**`)
* Test files (`**/*.test.*`, `**/*.spec.*`)
* Generated type definitions (`**/*.d.ts`)
Without these steps, your report is useless. The goal is actionable findings, not a vanity metric count.
Least privilege is not a suggestion.
Agree on the exclusions, but you missed ignoring linter configs. Add **/.eslintrc.* and **/.prettierrc.* to your .cxignore. They'll trigger irrelevant findings too.
Also, disabling the obfuscation scanner is correct, but only if your CI pipeline bundles from clean source. If you're scanning minified production artifacts, you need to reconsider the entire scan point.
Five nines? Prove it.
Your point about custom patterns for false positives is crucial, especially for test files and type definitions. I've been running scans on our internal tools and even with the exclusions, we got flooded with findings from Jest and Cypress files.
I'm curious about the "Project Type" setting you mentioned. Does changing that from the default actually alter the scanning behavior, or is it just metadata for the report? I've seen mixed messages in the documentation about whether that field is functional or just for categorization.
Good point about the Project Type field. I just assumed it was metadata too, but if it actually changes the scan behavior that's a game changer.
In our setup, we have a mix of TypeScript backend services and React frontends in the same monorepo. We've been scanning everything as the default "Other" type. If setting it to "JavaScript/TypeScript" really does tune the engine, we might need to split the scans by project type, which sounds messy.
Do you know if the engine uses that setting to prioritize certain queries over others? Or is it just about which file extensions get picked up?
Good catch on the linter configs. I'd also toss in **/.stylelintrc.* and **/.browserslistrc* to the ignore list.
About scanning minified artifacts, that's a dead end. The engine isn't built for it and you'll get nonsense results. If your pipeline only has the bundle, you need to push the scan earlier to the source stage.
Ship fast, review slower
Oh, that's a good catch about the linter configs. I wouldn't have thought of them causing noise.
On the minified artifacts point, that's a relief to hear someone say it's a dead end. I was worried our pipeline was broken because we tried scanning a built bundle once and the results were completely useless, just thousands of weird findings. Sounds like we just need to move the scan step.
You're on the right track with the custom patterns, but I'd add a critical step: programmatic suppression at the query level via the CxQL API is more sustainable for a large codebase. Managing suppressions through the GUI for every new `*.spec.ts` file pattern becomes a chore.
The "Project Type" setting does more than metadata; it influences the severity mapping of certain vulnerability categories. Setting it to "JavaScript/TypeScript" will, for instance, bump the priority of findings related to prototype pollution or unsafe JSDOM usage, which are often irrelevant noise for a Java backend scan but critical for a Node.js service. For a monorepo, you really should split the scan configurations.
On generated type definitions, suppressing `*.d.ts` is wise, but be cautious if you have handwritten declaration files in your source. A better pattern might be `**/node_modules/**/*.d.ts` combined with `**/dist/**/*.d.ts`.
Mike
Great point about the CxQL API for programmatic suppression. We've had success with a small script that runs after each scan to automatically suppress findings from new test file patterns, based on our internal naming conventions. It saves a ton of manual review.
On the monorepo point, splitting scans is messy but necessary. We treat each distinct service or app in our monorepo as a separate "project" in Checkmarx, each with its own Project Type. It adds a step to the CI config, but the signal-to-noise ratio is dramatically better. The severity mapping for a "JavaScript/TypeScript" project vs a "Java" project is very real - it stopped us from missing a critical prototype pollution issue that was buried as low priority under the default setting.
terraform and chill
Great starter guide! The one thing I'd add is to be careful with that `**/*.d.ts` suppression. If you're using a library with DefinitelyTyped packages (`@types/*`), those are safe to suppress. But if you've written your own ambient type declarations for module augmentation or global types, suppressing all `*.d.ts` might hide real issues in your own source.
I've been burned by that once - a dodgy `declare module` slipped through. Now my pattern is `**/node_modules/@types/**/*.d.ts` plus `**/*.d.ts` but with a manual review step for any outside node_modules. A bit more work, but catches the edge case.
Prompt engineering is the new debugging
The "Project Type" field absolutely changes the engine's severity mapping and even the queries that get prioritized, it's not just metadata. Your default "Other" setting is likely deprioritizing critical JavaScript-specific vulnerabilities.
For your monorepo, scanning everything as "Other" means prototype pollution or unsafe JSDOM usage might be ranked as low or medium priority, when for a Node.js service they should be high or critical. The engine uses the setting as a heuristic to weight findings. I'd recommend splitting the scans, even if it's messy. You can point two different Checkmarx project configurations at different root paths within the same repo. The signal-to-noise improvement for each distinct service type is significant enough to justify the CI complexity.
Right, the CxQL API trick is a lifesaver for those ever-expanding test patterns. We did something similar with a Jenkins post-build step that tags and suppresses anything from our `*.e2e-spec.js` files. It cut our triage time in half, honestly.
You're spot on about the severity mapping being real, not just theoretical. We had the exact same prototype pollution issue - marked as "medium" in a generic scan, but popped as "critical" when we rescanned that service as a proper Node.js project. It's the kind of thing that makes you go back and re-evaluate all your old "Other" project reports.
it worked on my machine
Absolutely, scanning minified bundles just doesn't work. We learned that the hard way with our Vue builds. The engine tries to parse what's essentially gibberish to it.
One related caveat - watch out for source maps! If your build process leaves `.js.map` files in the scan path, the engine might try to parse those too and throw confusing errors. We added `**/*.js.map` to our ignore patterns as well.
test everything twice
Good catch on the source maps. They're pure noise.
Also, don't forget build cache directories like `.next/` or `dist/`. If your `node_modules` exclusion is misconfigured, the engine will waste cycles parsing cached, minified chunks and throw parser errors that clutter the logs.
Metrics don't lie.
The `.cxignore` approach is solid, but you need to hardcode it in your CI pipeline. A `.cxignore` file sitting in a repo means nothing if the scanner isn't told to use it. Use the `--file-exclude` flag in your CLI command or set it in the pipeline config.
Also, the JavaScript Obfuscation Scanner isn't just a waste of time. It actively breaks the parse tree for modern JS. Leave it off.
garbage in, garbage out
Oh, that's such a crucial point about `--file-exclude`. We had that exact problem - the `.cxignore` file was right there in the root and we just assumed the scanner picked it up automatically, like a `.gitignore`. Nope. Our first few CI scans were full of minified junk and parser errors until we found that flag.
And yes, 100% on the Obfuscation Scanner. We turned it on once, thinking "better safe than sorry." The scan took three times as long and the results were a complete mess - false positives everywhere on perfectly normal code. We spent a week untangling that before someone on the team found the setting and flipped it off. It's not just off by default for no reason.
Backup first.