fix: narinfo should return NAR URL normalized [backport #843]#853
fix: narinfo should return NAR URL normalized [backport #843]#853kalbasit merged 1 commit intorelease-0.8from
Conversation
When computing a narinfo, normalize the embedded URL before returning it. (cherry picked from commit cdbe67d)
Summary of ChangesHello @kalbasit, 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 addresses an issue where the narinfo endpoint could return NAR URLs that were incorrectly prefixed, leading to failures when attempting to fetch the actual NARs. The changes implement robust URL normalization within the narinfo response, ensuring that the provided NAR URL is always in the correct format. This significantly improves the reliability of NAR fetching from the server. Highlights
Changelog
Activity
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 correctly normalizes NAR URLs within narinfo responses, addressing an issue where upstream caches might provide URLs with a narinfo hash prefix that the server cannot serve. While the implementation demonstrates good practices like defensive copying, proper error handling, and thorough integration testing, the Normalize function in pkg/nar/url.go introduces several critical security and portability flaws. These include platform-dependent behavior on Windows and a fail-open validation logic, which must be resolved to ensure the server remains secure and compatible across different operating systems.
Bot-based backport to
release-0.8, triggered by a label in #843.When computing a narinfo, normalize the embedded URL before returning
it.