Repository navigation
feat: add security scripts for auditing and fixing vulnerabilities; checked for Shai-Hulud malware. - #32
Conversation
…pdate prismjs version
WalkthroughAdds new npm security scripts and a new security-scripts.json plus a standalone security-scan script; updates package.json scripts and replaces multiple color-related overrides/resolutions with a single Changes
Sequence Diagram(s)sequenceDiagram
actor Dev as Developer
participant CLI as npm CLI
participant Scripts as package.json / security-scripts.json
participant Node as Node script (security-scan.js / inline)
participant Registry as npm Registry
Dev->>CLI: npm run security:full-scan
CLI->>Scripts: load `security:full-scan`
Scripts->>Node: run audit then outdated (capture audit exit)
Node->>Registry: npm audit
Registry-->>Node: audit results (may be non-zero)
Node->>Registry: npm outdated
Registry-->>Node: outdated results
Node-->>CLI: "Security scan complete" (exit with audit exit code)
CLI-->>Dev: output + final exit status
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
package.json(2 hunks)security-scripts.json(1 hunks)
…t safe exit for audit and outdated checks
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
package.json (1)
12-18:security:full-scanmust fail on vulnerabilities.Because
security:audit-safeforces exit code 0, the full scan now always exits successfully—even whennpm auditreports vulnerabilities—so automated checks stop catching issues. Inline the audit/outdated sequence and preserve the original audit status, e.g.:- "security:audit-safe": "npm audit || exit 0", - "security:outdated-safe": "npm outdated || exit 0", - "security:full-scan": "npm run security:audit-safe && npm run security:outdated-safe && echo Security scan complete" + "security:full-scan": "npm audit || AUDIT_EXIT=$?; npm outdated; echo Security scan complete; exit ${AUDIT_EXIT:-0}"Update any duplicated definitions (like
security-scripts.json) the same way so the scan still runs every step yet returns non-zero when vulnerabilities are present.
…comprehensive security scan script
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
package.json(2 hunks)scripts/security-scan.js(1 hunks)security-scripts.json(1 hunks)
🔇 Additional comments (3)
scripts/security-scan.js (1)
1-33: LGTM! Clean implementation of security scan with proper exit code handling.The script correctly:
- Captures the audit exit code for CI/CD purposes
- Ensures both audit and outdated checks always run
- Treats outdated packages as informational only
- Exits with the original audit status to fail CI when vulnerabilities exist
package.json (2)
12-16: LGTM! Security scripts are well-structured and correctly implemented.The security scripts properly leverage the dedicated
security-scan.jsfile for the full scan, which ensures proper exit code handling for CI/CD pipelines.
40-40: Clarify security rationale for prismjs and color updates
- prismjs is now pinned to >=1.30.0 to address the DOM-Clobbering vulnerability fixed in 1.30.0.
- The removed color overrides relate to the color@5.0.1 npm account-takeover malware (Shai-Hulud), patched in 5.0.2.
Please update the PR description to reflect these security objectives.
Updated the security enhancements and addressed for the Shai-Hulud malware
Summary by CodeRabbit