Skip to content

Conversation

@GrantBirki
Copy link
Contributor

…s for ISO 8601 UTC format

Copilot AI review requested due to automatic review settings June 12, 2025 20:34
Copy link
Contributor

Copilot AI left a 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 enhances timestamp validation for HMAC authentication by unifying parsing to epoch seconds, tightening input checks, and adding an acceptance test for Ruby’s default ISO 8601 format.

  • Added an acceptance test covering Time.now.utc.iso8601 timestamps
  • Refactored parse_timestamp to reject control chars/whitespace and return integer seconds
  • Updated ISO 8601 regex and parsing to use Time.parse, with warning logs for invalid inputs

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
spec/acceptance/acceptance_tests.rb Added acceptance test for ISO 8601 timestamps using Ruby’s iso8601 method
lib/hooks/plugins/auth/hmac.rb Refactored timestamp parsing: control-character checks, unified return type, regex adjustment
Comments suppressed due to low confidence (1)

spec/unit/hooks/plugins/auth/hmac_spec.rb:1

  • There are no unit tests covering parse_timestamp, parse_iso8601_timestamp, and parse_unix_timestamp edge cases (e.g., invalid formats, control characters, whitespace); consider adding tests to verify each path.
// new tests for parse_timestamp

@GrantBirki GrantBirki merged commit f8eaf03 into main Jun 12, 2025
22 checks passed
@GrantBirki GrantBirki deleted the hmac-improvements branch June 12, 2025 21:02
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.

1 participant