Open
Conversation
06a64f1 to
b659eaa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Semgrep (Static Analysis)
Semgrep (docs) is an open-source, lightweight static analysis tool that searches for the semantic meaning of code (e.g., matching
x + y == 2even whenx = 1; y = x) to find security vulnerabilities, correctness bugs, and coding standard violations.Evidence of Installation
.github/workflows/semgrep.yml: New CI workflow that runs Semgrep on every push/PR tomain/master/developvia the officialsemgrep/semgrepDocker image (zero local install needed in CI).UserGuide.md: New Tools section with usage docs, pro/con analysis, and local install instructions.Evidence of Successful Execution
Installed locally via
brew install semgrep(v1.155.0) and ran:Artifacts:
semgrep-evidence.txtsemgrep-results.jsonWhat does it catch?
Semgrep uses Taint Analysis to track untrusted user input (sources) as it flows into dangerous functions (sinks), identifying vulnerabilities that standard linters like ESLint typically miss.
src/webserver.js,install/web.jsreq.params→path.join)src/controllers/admin/themes.js,src/middleware/assert.jsres.sendFilewith user inputsrc/controllers/write/users.jsrequire()install/web.jssrc/emailer.jsFalse positives / negatives?
session()calls. NodeBB handles these dynamically vianconf/setupCookie(), so they are correct-in-isolation but false-positive-in-context. These can be suppressed to keep CI "green."Customization
Before first use: None required—the community rulesets (the
p/prefix stands for Registry Packages likep/javascript) work out of the box. The CI workflow is only 35 lines of YAML.Over time:
.semgrepignoreto exclude vendored/generated code.// nosemgrepcomments.privileges.check()is called before any data access logic).Integration into development process
.github/workflows/semgrep.ymlruns automatically on push/PR. It uses a baseline threshold of 24 findings—existing findings are tolerated, but any new findings will fail the build.semgrep scan --config "p/javascript" --config "p/nodejs" .after installing viabreworpip.Pros / Cons
brew/pipseparately.Local run commands
semgrep-results.txt
semgrep-results.json