-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Ruby: Add support for Grape Framework #20427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request introduces comprehensive CodeQL modeling support for the Ruby Grape API framework. The implementation identifies Grape API classes, their endpoints, and various sources of user input including parameters, headers, cookies, route parameters, and request objects.
Key changes:
- New
Grape.qll
library with classes to model Grape API structure and taint sources - Framework integration by importing Grape in the main Ruby frameworks library
- Comprehensive test coverage with vulnerability detection validation
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
ruby/ql/lib/codeql/ruby/frameworks/Grape.qll |
Core Grape framework modeling with API class detection and taint source definitions |
ruby/ql/lib/codeql/ruby/Frameworks.qll |
Integration of Grape framework into main Ruby frameworks library |
ruby/ql/test/library-tests/frameworks/grape/Grape.ql |
Query predicates for testing Grape framework modeling |
ruby/ql/test/library-tests/frameworks/grape/app.rb |
Test application demonstrating various Grape API patterns |
ruby/ql/test/library-tests/frameworks/grape/Grape.expected |
Expected test results for Grape framework modeling |
ruby/ql/test/query-tests/security/cwe-089/ArelInjection.rb |
Additional vulnerability test cases using Grape taint sources |
ruby/ql/test/query-tests/security/cwe-089/SqlInjection.expected |
Updated expected results including Grape-based SQL injection detection |
ruby/ql/lib/change-notes/2025-09-15-grape-framework-support.md |
Release notes documenting the new Grape framework support |
Co-authored-by: Copilot <[email protected]>
This pull request adds modeling support for the Grape Ruby API framework to the CodeQL library. It introduces a new
Grape.qll
library that models Grape API classes, endpoints, and sources of user input such as parameters, headers, cookies, and route parameters.The changes are validated with new framework and vulnerability tests and expected outputs, and Grape is now imported in the main Ruby frameworks library.
Vulnerable tests verified: https://github.com/vulna-felickz/ruby-grape-sqli/blob/main/app/api/potato_api.rb
