fix(security): add tls warnings, standard cookie parsing and explicit ti#198
Open
fix(security): add tls warnings, standard cookie parsing and explicit ti#198
Conversation
- Add runtime warning when skip_verify is enabled (TLS bypass for dev only) - Replace custom cookie parsing with standard library (CGI.unescape) - Ensure HTTP timeout is properly configured from @timeout_seconds - Apply verify_ssl setting to RestClient when skip_verify is enabled These changes address security review findings while maintaining backward compatibility. The skip_verify option remains available for local development but now emits a clear warning about its insecure nature. Co-authored-by: Shuni <251468265+shuni-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR implements several Ruby SDK security-related improvements: warning when TLS verification is disabled, switching cookie parsing away from a regex extractor, and ensuring the configured request timeout is actually used by the HTTP layer.
Changes:
- Log a warning when
skip_verifydisables TLS certificate verification, and explicitly propagate timeout to the HTTP mixin. - Replace regex-based
Set-Cookieparsing with a split-based approach and decoding via the Ruby standard library. - Add
verify_ssl: OpenSSL::SSL::VERIFY_NONEto RestClient requests whenskip_verifyis enabled.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| lib/descope/mixins/initializer.rb | Adds TLS-skip warning and sets @timeout from configured timeout seconds. |
| lib/descope/mixins/http.rb | Updates cookie parsing logic and applies verify_ssl option when TLS verification is disabled. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
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.
Fixes descope/etc#14534
View workflow run
Summary
I've successfully implemented the security improvements requested for the Ruby SDK. Here's what was done:
1. TLS Skip Verification Warning ✅
lib/descope/mixins/initializer.rbwhenskip_verifyis enabledverify_ssloption is properly passed to RestClient2. Standard Library Cookie Parsing ✅
CGI.unescape)lib/descope/mixins/http.rbfollows RFC 6265 more closely3. HTTP Timeout Configuration ✅
@timeout_secondsis configured (default: 60 seconds fromCommon::DEFAULT_TIMEOUT_SECONDS)@timeout = @timeout_secondsassignment to ensure the HTTP module uses the correct timeout value4. JWT Validation ✅
jwtgem (v2.7) for JWT validationChanges Made:
lib/descope/mixins/initializer.rb:
skip_verifyis true@timeoutfrom@timeout_secondsfor HTTP requestslib/descope/mixins/http.rb:
require 'cgi'for standard library cookie parsingparse_cookie_valuewith standard library approach usingCGI.unescapeverify_ssl: OpenSSL::SSL::VERIFY_NONEto RestClient whenskip_verifyis enabledAll changes maintain backward compatibility while improving security. The commit has been created and is ready for review.
Created by Shuni 🐕