Skip to content

Conversation

@gatsby003
Copy link

@gatsby003 gatsby003 commented Jul 24, 2025

Summary by CodeRabbit

  • New Features

    • Added comprehensive static analysis rules for C, C++, C#, Go, Java, JavaScript, and HTML to detect a wide range of security issues, including insecure cryptography, hard-coded secrets, improper cookie flags, unsafe file operations, and more.
    • Introduced interactive rule database tools and web dashboard documentation for exploring and analyzing security rules.
    • Enhanced documentation with new and updated README files, contributing guidelines, and a code of conduct.
    • Updated and expanded test and script configurations for improved development workflows.
  • Bug Fixes

    • Removed outdated or duplicate static analysis rules to reduce false positives and improve rule accuracy.
  • Chores

    • Added license and requirements files to clarify project licensing and dependencies.
  • Documentation

    • Improved and expanded documentation for rule usage, contribution, and community engagement.

harjotgill and others added 30 commits July 24, 2025 14:15
* express-session-hardcoded-secret-javascript

* express-session-hardcoded-secret-typescript
* express-jwt-hardcoded-secret-typescript

* express-jwt-hardcoded-secret-javascript
* express-jwt-hardcoded-secret-typescript

* express-jwt-hardcoded-secret-javascript

* node-rsa-weak-key-typescript

* node-rsa-weak-key-javascript
* use-of-default-aes-java

* ssl-verify-none-rust
* missing-secure-java

* missing-httponly-java
* ssl-v3-is-insecure-go

* missing-ssl-minversion-go
* cookie-missing-secure-flag-java

* jedis-jedisfactory-hardcoded-password-java
* dont-call-system-cpp

* dont-call-system-c
* blowfish-insufficient-key-size-java

* tls-with-insecure-cipher-go
ESS-ENN and others added 28 commits July 24, 2025 14:15
* removed missing-secure-java

* httponly-false-csharp

* use-of-md5-digest-utils-java

* removing use-of-md5-digest-utils and httponly-false-csharp

* Removing python-ldap3-empty-password-python and express-jwt-hardcoded-secret-typescript

---------

Co-authored-by: Sakshis <sakshil@abc.com>
…#172)

* hardcoded-password-rust

* empty-password-rust

* secrets-reqwest-hardcoded-auth-rust

---------

Co-authored-by: Sakshis <sakshil@abc.com>
* use-of-sha1-java

* use-of-default-aes

* use-of-blowfish

---------

Co-authored-by: Sakshis <sakshil@abc.com>
…and OkHttp (#175)

* system-setproperty-hardcoded-secret-java

* hardcoded-secret-in-credentials-java

---------

Co-authored-by: Sakshis <sakshil@abc.com>
* jedis-jedisfactory-hardcoded-password-java

* java-jwt-hardcoded-secret-java

* passwordauthentication-hardcoded-password-java

---------

Co-authored-by: Sakshis <sakshil@abc.com>
* removed missing-secure-java

* httponly-false-csharp

* use-of-md5-digest-utils-java

* removing use-of-md5-digest-utils and httponly-false-csharp

* Changed folder structure for C and CPP rules

---------

Co-authored-by: Sakshis <sakshil@abc.com>
#177)

* removed missing-secure-java

* httponly-false-csharp

* use-of-md5-digest-utils-java

* removing use-of-md5-digest-utils and httponly-false-csharp

* std-return-data-cpp

* std-vector-invalidation-cpp

* return-c-str-cpp

---------

Co-authored-by: Sakshis <sakshil@abc.com>
* hardcoded-connection-password-java

* datanucleus-hardcoded-connection-password-java

* jedis-jedisclientconfig-hardcoded-password-java

---------

Co-authored-by: Sakshis <sakshil@abc.com>
* python-ldap3-empty-password-python

* python-ldap3-hardcoded-secret-python

* python-mariadb-hardcoded-secret-python

* python-mariadb-password-empty-python

---------

Co-authored-by: Sakshis <sakshil@abc.com>
)

* python-mysql-empty-password-python

* python-mysql-hardcoded-secret-python

* python-neo4j-hardcoded-secret-auth-python

* python-neo4j-hardcoded-secret-python

* python-neo4j-empty-password-python

---------

Co-authored-by: Sakshis <sakshil@abc.com>
Co-authored-by: Ganesh Patro <ganeshpatro321@gmail.com>
* removed missing-secure-java

* httponly-false-csharp

* use-of-md5-digest-utils-java

* removing use-of-md5-digest-utils and httponly-false-csharp

* python-mysqlclient-empty-password-python

* python-mysqlclient-hardcoded-secret-python

---------

Co-authored-by: Sakshis <sakshil@abc.com>
* removed missing-secure-java

* httponly-false-csharp

* use-of-md5-digest-utils-java

* removing use-of-md5-digest-utils and httponly-false-csharp

* jwt-scala-hardcode-scala

* jwt-go-none-algorithm-go

* changing folder location for jwt-go-none-algorithm-go

* jwt-hardcode-kotlin

* scala-jwt-hardcoded-secret-scala

---------

Co-authored-by: Sakshis <sakshil@abc.com>
* removed missing-secure-java

* httponly-false-csharp

* use-of-md5-digest-utils-java

* removing use-of-md5-digest-utils and httponly-false-csharp

* string-view-temporary-string-cpp

* missing-nul-cpp-string-memcpy-copy-cpp

---------

Co-authored-by: Sakshis <sakshil@abc.com>
…184)

* removed missing-secure-java

* httponly-false-csharp

* use-of-md5-digest-utils-java

* removing use-of-md5-digest-utils and httponly-false-csharp

* missing-secure-java

* missing-httponly-java

---------

Co-authored-by: Sakshis <sakshil@abc.com>
* removed missing-secure-java

* httponly-false-csharp

* use-of-md5-digest-utils-java

* removing use-of-md5-digest-utils and httponly-false-csharp

* python-requests-hardcoded-secret-python

* python-requests-oauth-hardcoded-secret-python

---------

Co-authored-by: Sakshis <sakshil@abc.com>
* removed missing-secure-java

* httponly-false-csharp

* use-of-md5-digest-utils-java

* removing use-of-md5-digest-utils and httponly-false-csharp

* stacktrace-disclosure-csharp

* weak-ssl-context-java

* hardcoded-secret-rsa-passphrase-ruby

---------

Co-authored-by: Sakshis <sakshil@abc.com>
…189)

* removed missing-secure-java

* httponly-false-csharp

* use-of-md5-digest-utils-java

* removing use-of-md5-digest-utils and httponly-false-csharp

* swift-webview-config-base-url-swift

* Removed python-neo4j extra files

---------

Co-authored-by: Sakshis <sakshil@abc.com>
* removed missing-secure-java

* httponly-false-csharp

* use-of-md5-digest-utils-java

* removing use-of-md5-digest-utils and httponly-false-csharp

* scrypt-hardcoded-secret-swift

* pkcs5-hardcoded-secret-swift

* hkdf-hardcoded-secret-swift

* Removed python-neo4j extra files

---------

Co-authored-by: Sakshis <sakshil@abc.com>
#190)

* removed missing-secure-java

* httponly-false-csharp

* use-of-md5-digest-utils-java

* removing use-of-md5-digest-utils and httponly-false-csharp

* Remove swift rules from PRs 188 and 189

---------

Co-authored-by: Sakshis <sakshil@abc.com>
* removed missing-secure-java

* httponly-false-csharp

* use-of-md5-digest-utils-java

* removing use-of-md5-digest-utils and httponly-false-csharp

* world-writable-file-c

* world-writable-file-cpp

---------

Co-authored-by: Sakshis <sakshil@abc.com>
#193)

* removed missing-secure-java

* httponly-false-csharp

* use-of-md5-digest-utils-java

* removing use-of-md5-digest-utils and httponly-false-csharp

* file-stat-before-action-c

* file-stat-before-action-cpp

---------

Co-authored-by: Sakshis <sakshil@abc.com>
* removed missing-secure-java

* httponly-false-csharp

* use-of-md5-digest-utils-java

* removing use-of-md5-digest-utils and httponly-false-csharp

* use-ecb-mode-csharp

* Delete tests/__snapshots__/use_ecb_mode-csharp-snapshot.yml

---------

Co-authored-by: Sakshis <sakshil@abc.com>
…#195)

* removed missing-secure-java

* httponly-false-csharp

* use-of-md5-digest-utils-java

* removing use-of-md5-digest-utils and httponly-false-csharp

* jwt-hardcoded-secret-csharp

* jwt-decode-without-verify-csharp

---------

Co-authored-by: Sakshis <sakshil@abc.com>
…++ (#192)

* removed missing-secure-java

* httponly-false-csharp

* use-of-md5-digest-utils-java

* removing use-of-md5-digest-utils and httponly-false-csharp

* file-access-before-action-c

* file-access-before-action-cpp

* Modified file-access-before-action-c and cpp

---------

Co-authored-by: Sakshis <sakshil@abc.com>
…196)

* removed missing-secure-java

* httponly-false-csharp

* use-of-md5-digest-utils-java

* removing use-of-md5-digest-utils and httponly-false-csharp

* Update file-access-before-action-c rule file

* Added ast-grep-essentials: true key to all rules not having this key-value pair

---------

Co-authored-by: Sakshis <sakshil@abc.com>
- argon2-weak-type-typescript: Detect weak Argon2 hash type usage
- avoid-crypto-rc4-typescript: Detect RC4 cryptographic usage
- avoid-crypto-sha1-typescript: Detect SHA1 cryptographic usage
- avoid-des-typescript: Detect DES encryption usage
- chmod-permissions-typescript: Detect insecure file permission settings

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Jul 24, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces a large set of new static analysis rules for C, C++, C#, Go, Java, JavaScript, and HTML, targeting security vulnerabilities such as hard-coded secrets, cryptographic weaknesses, insecure cookie flags, and race conditions. It also removes several outdated or redundant rules. New documentation, licensing, and contribution files are added, and a Python-based rule database tool is introduced. The package.json scripts and dependencies are updated.

Changes

File(s) / Path(s) Change Summary
CODE_OF_CONDUCT.md, CONTRIBUTING.md, LICENSE, README.md, README_rule_db.md, README_web_dashboard.md Added standard community, licensing, and documentation files; improved README structure and content.
package.json, requirements.txt Updated test scripts, upgraded ast-grep CLI version, and added Python dependencies for rule database tooling.
rule_db.py Added a new Python module and CLI for managing, querying, and analyzing AST-Grep rules in a SQLite database with full-text search and statistics.
rules/c/security/*.yml, rules/cpp/security/*.yml, rules/csharp/security/*.yml, rules/go/security/*.yml, rules/html/security/*.yml, rules/java/security/*.yml, rules/javascript/security/*.yml Added many new static analysis rules for security checks across C, C++, C#, Go, Java, JavaScript, and HTML; rules target issues like hard-coded secrets, insecure crypto, cookie flags, and more.
rules/c/security/info-leak-on-non-formated-string.yml, rules/c/security/insecure-use-gets-function.yml, rules/c/security/insecure-use-memset.yml, rules/c/security/insecure-use-scanf-function.yml, rules/c/security/insecure-use-strcat-function.yml, rules/c/security/insecure-use-string-copy-function.yml, rules/c/security/insecure-use-strtok-function.yml, rules/csharp/security/binary-formatter.yml, rules/csharp/security/data-contract-resolver.yml, rules/csharp/security/html-raw-json.yml, rules/csharp/security/insecure-fspickler-deserialization.yml, rules/csharp/security/insecure-netdatacontract-deserialization.yml, rules/csharp/security/los-formatter.yml, rules/go/gorilla/session-cookie-missing-httponly.yml, rules/go/gorilla/session-cookie-missing-secure.yml, rules/go/grpc/grpc-client-insecure-connection.yml, rules/go/injection/bad-tmp.yml, rules/go/jwt-go/jwt-go-none-algorithm.yml, rules/go/jwt-go/jwt-go-parse-unverified.yml, rules/go/jwt-go/jwt.yml, rules/go/templates/go-insecure-types.yml, rules/java/security/cbc-padding-oracle.yml, rules/java/security/object-deserialization.yaml, rules/javascript/audit/detect-replaceall-sanitization.yml, rules/javascript/browser/wildcard-postmessage-configuration.yml, rules/javascript/jwt/jwt-simple-noverify-astgrep.yml Removed deprecated or redundant static analysis rules from C, C++, C#, Go, Java, and JavaScript rule sets.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant RuleDB_CLI
    participant RuleDatabase
    participant SQLiteDB

    Developer->>RuleDB_CLI: init/load rules
    RuleDB_CLI->>RuleDatabase: parse YAML rules
    RuleDatabase->>SQLiteDB: insert rules, create FTS index

    Developer->>RuleDB_CLI: query/search/stats
    RuleDB_CLI->>RuleDatabase: execute SQL or search
    RuleDatabase->>SQLiteDB: run SQL/FTS query
    SQLiteDB-->>RuleDatabase: return results
    RuleDatabase-->>RuleDB_CLI: format results
    RuleDB_CLI-->>Developer: display output
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~90+ minutes
Complexity: Extensive changes across many files, multiple new security rules, documentation, tooling, and removals; requires thorough review for correctness, completeness, and integration.

Possibly related PRs

  • Two Java rules #14: Introduces the missing-httponly-java and missing-secure-java rules for Java cookies, which are directly related to the new cookie security rules added in this PR.

Suggested reviewers

  • petrisorcoderabbit

Poem

In the garden of code, new rules now bloom,
Guarding secrets, cookies, and cryptographic doom.
With Python scripts and docs so neat,
Security’s strengthened, vulnerabilities beat!
Hop, hop, hooray—let’s review with delight,
For safer code is now in sight!

((\
( -.-)
o_(")(")

— A CodeRabbit poem

Pre-Merge Checks (1 passed, 2 warnings)

❌ Failed Checks (2 warnings)
Check Name Status Explanation Resolution
Title Check ⚠️ Warning The title 'Add ts rules' is too vague and does not accurately describe the extensive additions of documentation files and static analysis rules across multiple languages. Revise the pull request title to be clear and specific, for example: 'Add static analysis rules and documentation for multiple languages'.
Description Check ⚠️ Warning The pull request description is empty and lacks context, details, and rationale for the changes. Provide a detailed description (e.g., using a template) that summarizes the changes, motivations, and impact, and include sections such as Summary, Motivation, Changes, and Testing.
✅ Passed Checks (1 passed)
Check Name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 93.75% which is sufficient. The required threshold is 80.00%.
Impact Analysis

Updated static analysis rule set: new rules added and obsolete rules removed

⚠️ High 🔄 Impacts behavior 🔒Impacts security

A comprehensive set of new security rules has been added across C, C++, C#, Go, Java, HTML, and JavaScript (e.g. TOCTOU checks, insecure‐hash detectors, null‐pointer, format‐string, world-writable file, JWT misuses, AngularJS SCE, plaintext HTTP links, etc.), while many older rules have been deleted (e.g. gets(), memset(), scanf(), strtok(), BinaryFormatter, Jwt-none, unsafe gRPC, insecure template types, manual sanitization, wildcard postMessage, JWT no-verify). This changes the tool’s output: new warnings will appear for the added checks, and warnings from removed rules will no longer be reported.

Verify the correctness of each new rule’s AST patterns and metadata; confirm the rationale for rule removals aligns with updated security policy and doesn’t introduce blind spots.

Run the full rule set on representative codebases and compare outputs before/after: ensure new rules fire on intended patterns without false positives, and that deleted rules no longer generate alerts.

🔍 Related Files
  • rules/c/security/*.yml
  • rules/cpp/security/*.yml
  • rules/csharp/security/*.yml
  • rules/go/security/*.yml
  • rules/go/gorilla/*.yml
  • rules/go/jwt-go/*.yml
  • rules/html/security/plaintext-http-link-html.yml
  • rules/javascript/security/detect-angular-sce-disabled-javascript.yml
  • rules/javascript/audit/detect-replaceall-sanitization.yml (deleted)
  • rules/javascript/browser/wildcard-postmessage-configuration.yml (deleted)
  • rules/javascript/jwt/jwt-simple-noverify-astgrep.yml (deleted)

Introduce interactive RuleDatabase CLI with SQLite backend

📢 Medium 🔗 Impacts API 🔄 Impacts behavior

A new Python module (rule_db.py) and associated CLI commands have been added, enabling users to initialize an SQLite database of AST-Grep rules, load rule metadata, execute arbitrary SQL queries, perform full-text searches, and view statistics and language filters. This provides an interactive interface for exploring and exporting rule data.

Review the database schema (table definitions, indexes, FTS5 setup) and SQL handling for injection risks; ensure CLI option parsing and error messages are clear and robust.

Test each CLI command (init, query, search, stats, languages, lang) with valid and invalid inputs; verify correct data loading from a rules directory and accurate query/search results in table/JSON/CSV formats.

🔍 Related Files
  • rule_db.py
  • requirements.txt
  • README_rule_db.md

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-ts-rules

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@gatsby003 gatsby003 closed this Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants