fix: remove mock signature from chat signature in production code#305
fix: remove mock signature from chat signature in production code#305think-in-universe merged 6 commits intomainfrom
Conversation
Summary of ChangesHello @hanakannzashi, 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 refactors the handling of chat completion request and response signature hashes, specifically for the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe 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
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 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the signature generation logic for the mock inference provider. The responsibility for calculating response hashes and preparing signature data is moved from the API route handlers and attestation service into the MockProvider itself. This is a great simplification, making the mock provider more self-contained and removing special-case logic from the core services.
My review focuses on the new logic within the MockProvider. I've identified a couple of places where unwrap() is used for JSON serialization, which could lead to panics during tests. I've suggested replacing these with proper error handling to improve robustness and provide clearer test failure messages, consistent with how errors are handled elsewhere in the codebase.
Code Review
|
|
The reported security vulnerability is from We're waiting for a patch from |
There was a problem hiding this comment.
Pull request overview
This PR refactors mock signature generation by moving the responsibility from the gateway layer to the MockProvider itself, simplifying the architecture and removing MockProvider-specific logic from the AttestationService.
Key changes:
- Signature hash registration moved from gateway API route to MockProvider implementation
- MockProvider now computes response hashes internally during chat_completion and chat_completion_stream
- Removed gateway-side signature synthesis logic from AttestationService
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/services/src/inference_provider_pool/mod.rs | Removed signature_hashes field and associated methods (register_signature_hashes_for_chat, get_signature_hashes_for_chat) that were used for gateway-side hash tracking |
| crates/services/src/attestation/mod.rs | Removed MockProvider-specific signature synthesis logic; now always fetches signatures directly from the provider |
| crates/inference_providers/src/mock.rs | Added compute_sha256_hex helper and signature hash registration in both streaming and non-streaming chat completion methods; changed request_hash parameter from unused to used |
| crates/api/src/routes/completions.rs | Removed gateway-side response hash computation and signature registration code for streaming completions |
| crates/inference_providers/Cargo.toml | Added sha2 dependency for hash computation in MockProvider |
| Cargo.lock | Updated with sha2 dependency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Not relevant to the change in the PR, but I think there're several causes of the issue: @nickpismenkov @PierreLeGuen
|
Fixes #308