-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add "shared secret" request_validator #6
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
Merged
Conversation
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
Co-authored-by: GrantBirki <[email protected]>
Co-authored-by: GrantBirki <[email protected]>
request_validator
Copilot finished work on behalf of
GrantBirki
June 10, 2025 20:03
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 PR adds a new SharedSecret request validator that checks a shared secret in a configurable HTTP header against an expected value using secure comparison.
- Introduces
SharedSecret
class underlib/hooks/plugins/request_validator
with configurable header, whitespace/control-character checks, and timing-attack protection - Provides extensive RSpec coverage for normal, edge, and security scenarios (adding 33 tests)
- Includes an unintended change to
.bundle/config
with an environment-specific absolute path
Reviewed Changes
Copilot reviewed 5031 out of 5031 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
lib/hooks/plugins/request_validator/shared_secret.rb | Implements the new SharedSecret validator |
spec/unit/lib/hooks/plugins/request_validator/shared_secret_spec.rb | Adds comprehensive tests for SharedSecret behavior |
.bundle/config | Updates BUNDLE_PATH to an absolute CI-specific path |
Comments suppressed due to low confidence (1)
.bundle/config:3
- Avoid committing environment-specific absolute paths in
.bundle/config
; revert to a relative vendor path (e.g.vendor/gems
) or configure this per-developer in Git ignored files.
BUNDLE_PATH: "/home/runner/work/hooks/hooks/vendor/bundle"
Co-authored-by: Copilot <[email protected]>
GrantBirki
reviewed
Jun 10, 2025
GrantBirki
approved these changes
Jun 10, 2025
Copilot finished work on behalf of
GrantBirki
June 10, 2025 20:18
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.
This PR implements a new "shared secret" request validator that provides simple authentication for webhook requests by comparing a secret value sent in a configurable HTTP header against the expected secret value.
What's Changed
Added
lib/hooks/plugins/request_validator/shared_secret.rb
- a new validator that:Base
class following established patterns from the HMAC validatorRack::Utils.secure_compare
to prevent timing attacksConfiguration Example
Security Considerations
While simpler than HMAC, this validator maintains security best practices:
Testing
Real-world Usage
This validator supports webhook services like Okta that use simple shared secrets for authentication, as described in their documentation where they send the secret in the
Authorization
header.Fixes #5.