Skip to content

Conversation

@strantalis
Copy link
Member

Proposed Changes

Checklist

  • I have added or updated unit tests
  • I have added or updated integration tests (if appropriate)
  • I have added or updated documentation

Testing Instructions

@strantalis strantalis requested review from a team as code owners November 6, 2025 21:40
@strantalis strantalis marked this pull request as draft November 6, 2025 21:40
@github-actions github-actions bot added comp:kas Key Access Server docs Documentation labels Nov 6, 2025
@strantalis strantalis requested a review from Copilot November 6, 2025 21:40
@github-actions github-actions bot added the size/m label Nov 6, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @strantalis, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the KAS service by introducing a configurable clock skew tolerance for Signed Request Tokens (SRTs). This allows for more flexible handling of time differences between clients and the KAS during token validation. Additionally, it significantly improves the diagnostic capabilities for SRT validation failures by providing detailed logging, which will assist in troubleshooting and maintaining system reliability related to time-sensitive operations.

Highlights

  • Configurable SRT Skew Tolerance: Introduced a new configuration parameter, srt_acceptable_skew, allowing administrators to define the maximum client/server clock skew tolerated when validating Signed Request Tokens (SRTs). The default value is 1 minute.
  • Enhanced SRT Validation Diagnostics: Improved logging for SRT validation failures, providing detailed information such as server time, configured acceptable skew, and specific JWT claims (e.g., iat, exp, nbf) that caused the validation to fail. This aids in debugging time synchronization issues.
  • Refactored SRT Processing Logic: The internal logic for parsing, validating claims, and verifying signatures of SRTs has been refactored into distinct, more modular methods within the Provider struct, enhancing code organization and testability.
  • Configuration Integration: The new srt_acceptable_skew setting is integrated into the KAS configuration, with updates to docs/Configuring.md and opentdf-kas-mode.yaml to reflect its availability and usage.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Time's gentle drift, a minute's grace, For tokens signed, in digital space. Skewed clocks may err, but KAS will see, With watchful logs, for you and me.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a configurable skew tolerance for Signed Request Token (SRT) validation and enhances the diagnostic logging for validation failures. The changes are well-structured, with the SRT validation logic refactored into smaller, more testable functions. The new configuration option is also properly documented.

My review focuses on the correctness of the new validation and logging logic. I've found a minor issue in the diagnostic logging that could lead to misleading information when debugging clock skew problems. Overall, this is a great improvement for the service's robustness and maintainability.

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 refactors Signed Request Token (SRT) validation to make clock skew tolerance configurable and adds detailed logging for validation failures. The change replaces a hardcoded 30-second acceptable skew with a configurable value (default: 1 minute) and restructures the SRT parsing/verification flow to be more modular while providing better diagnostics when tokens fail validation.

Key changes:

  • Introduces configurable srt_acceptable_skew parameter (defaults to 1 minute, previously hardcoded at 30 seconds)
  • Refactors SRT validation into separate parsing, validation, and signature verification steps with enhanced logging
  • Adds comprehensive test coverage for new configuration and logging behavior

Reviewed Changes

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

Show a summary per file
File Description
service/kas/kas.go Updates calls to use new ApplyConfig method instead of direct field assignment
service/kas/access/rewrap_test.go Adds test utilities and test cases for the new configuration method and validation logging
service/kas/access/rewrap.go Refactors SRT verification into modular methods with detailed failure logging
service/kas/access/provider.go Adds ApplyConfig method, acceptableSkew helper, and SRTAcceptableSkew configuration field
opentdf-kas-mode.yaml Documents the new optional configuration parameter with example
docs/Configuring.md Documents the srt_acceptable_skew configuration option in the main documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@strantalis strantalis requested a review from Copilot November 7, 2025 16:39
@strantalis
Copy link
Member Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a configurable skew tolerance for Signed Request Tokens (SRTs) and enhances diagnostic logging, which are excellent improvements for security and debuggability. The refactoring of the SRT validation logic in rewrap.go into smaller, more focused methods significantly improves code clarity and maintainability. The new tests are thorough and correctly validate the new functionality.

I have a couple of suggestions to improve the clarity of log messages in service/kas/access/rewrap.go for cases where token parsing or validation fails when signature verification is not required. Overall, this is a high-quality contribution.

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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@strantalis strantalis marked this pull request as ready for review November 7, 2025 19:12
jakedoublev
jakedoublev previously approved these changes Nov 7, 2025
@strantalis
Copy link
Member Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a configurable clock skew tolerance for Signed Request Tokens (SRT), which is a valuable feature for deployments where clock drift is a concern. The addition of detailed diagnostic logs for token validation failures is particularly well-executed and will be a great help for troubleshooting. The overall refactoring of the token validation logic in rewrap.go improves code clarity and maintainability. One thing to note is that the default acceptable skew has been increased from 30 seconds to 1 minute; this seems reasonable but is a change in behavior to be aware of. I've left a couple of suggestions for improvement, one related to making the new configuration more robust and another to improve logging diagnostics.

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

Copilot reviewed 10 out of 10 changed files in this pull request and generated 21 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Merged via the queue into opentdf:main with commit 1a57227 Nov 14, 2025
75 checks passed
@strantalis strantalis deleted the dspx-1804/kas-srt-skew branch November 14, 2025 18:18
@strantalis
Copy link
Member Author

/backport

opentdf-automation bot pushed a commit that referenced this pull request Nov 14, 2025
### Proposed Changes

*

### Checklist

- [ ] I have added or updated unit tests
- [ ] I have added or updated integration tests (if appropriate)
- [ ] I have added or updated documentation

### Testing Instructions

(cherry picked from commit 1a57227)
@opentdf-automation
Copy link
Contributor

Successfully created backport PR for release/service/v0.11:

opentdf-automation bot added a commit that referenced this pull request Nov 14, 2025
### Proposed Changes

*

### Checklist

- [ ] I have added or updated unit tests
- [ ] I have added or updated integration tests (if appropriate)
- [ ] I have added or updated documentation

### Testing Instructions

(cherry picked from commit 1a57227)
@jakedoublev
Copy link
Contributor

/backport

opentdf-automation bot pushed a commit that referenced this pull request Nov 14, 2025
### Proposed Changes

*

### Checklist

- [ ] I have added or updated unit tests
- [ ] I have added or updated integration tests (if appropriate)
- [ ] I have added or updated documentation

### Testing Instructions

(cherry picked from commit 1a57227)
@opentdf-automation
Copy link
Contributor

Successfully created backport PR for release/service/v0.11:

opentdf-automation bot added a commit that referenced this pull request Nov 14, 2025
### Proposed Changes

*

### Checklist

- [ ] I have added or updated unit tests
- [ ] I have added or updated integration tests (if appropriate)
- [ ] I have added or updated documentation

### Testing Instructions

(cherry picked from commit 1a57227)
strantalis pushed a commit that referenced this pull request Nov 14, 2025
…ort to release/service/v0.11] (#2913)

# Description
Backport of #2886 to `release/service/v0.11`.

Co-authored-by: opentdf-automation[bot] <149537512+opentdf-automation[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants