-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
Consider disabling caching by default for unversioned URLs in casks #18630
Comments
This should already happen by default for brew/Library/Homebrew/download_strategy.rb Line 410 in 3b52a46
|
@Bo98 Hi Bo. Thanks for pointing out the
While
This would help maintain Homebrew's reliability while encouraging better practices in the broader ecosystem. PS While this issue is not about a specific formula or cask, I will mention that I have also raised an issue with Roboform about the unversioned URL. They responded with the following, which I think demonstrates that the alternative to handling unversioned URLs better is to rely on each and every provider to choose to do things correctly. "Thank you for your suggestion and feedback. We appreciate it and will forward it to the developers for consideration. |
I see a case for this being the default for all Homebrew downloads. The download cache is a cache after all, and therefore subject to invalidation at any time. I think this helps streamline the user experience:
|
Please don't @aholland. These LLMs are just not accurate enough. If you don't know something: ask us.
To help us better figure out this issue can you explain:
This is an interesting idea. I'm curious what our @Homebrew/security folks think here. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
@MikeMcQuaid Thanks for following up. Sorry that I was not able to respond sooner. Should I open a new issue or can this one be re-opened? Here are the details: What I was trying to do (and why):
What happened:
What I expected to happen:
Reproduction:
Regarding cache invalidation being default: My experience provides a good example of why this could help. When SHA verification fails, a fresh download would naturally solve cases where remote content has changed while maintaining security through SHA verification. |
@aholland Have you been able to reproduce this behaviour with other casks? If not: this sounds like an issue with the Roboform cask specifically and it'd be good to submit a new issue if so to Homebrew/homebrew-cask, thanks! |
@MikeMcQuaid the issue here is that a cache, which is meant to be simply for performance improvement (eg by avoiding downloading something twice), is being assumed to hold a valid copy of something when in fact it holds an out-of-date copy. I think the issue is clearly described above. Is there a part that is unclear? I appreciate that thread has grown a bit. Would you like me to describe it again, from scratch? |
@aholland No, the issue here is that the Roboform cask specifically is not being cached correctly. I understand that you'd saying this is a wider issue that should result in a behaviour change in all of Homebrew but: this seems excessive to me until it's been demonstrated that this cannot be fixed at the cask level. |
@MikeMcQuaid if we persuade the maintainers of the Roboform formula (who are not Roboform) to adjust the formula to take into account that Roboform doesn't set a new URL for every new minor version, we solve that one problem once, and to solve it everywhere would have to invest in conversations with every other such publisher. On the other hand, if we implement what @gromgit suggested above (see #18630 (comment)) then it is fixed permanently across the board, right? |
@aholland We maintain and support all the formulae in homebrew-cask. The number of maintainers involved here is fairly small. What @gromgit suggested would be cool but we had a private conversation with Homebrew security folks who felt it would be a security regression (important information I didn't add here until now, sorry). |
Thanks for the clarification about security considerations. Since RoboForm is a core cask and this is a recurring issue (just happened again with 9.6.4), perhaps we could consider:
The current situation leads to a poor user experience where users need to know about Homebrew's cache behavior to resolve the issue. I've just encountered this again this week upgrading to 9.6.4—it's particularly confusing because the upgrade appears to succeed but actually installs the old version. Would any of these alternatives be acceptable from a security perspective? Regarding point 3 above, the screenshot below illustrates that the page is simply a link on Roboform's webpage, presenting as the install button. I have already raised this issue with Roboform. Their issue management system is not public. So I have copied and pasted the interaction (ticket) below this screenshot. The messages are in order with the most recent at the top. The original message at the very bottom is possibly not useful to read, as it is a bit out of date now. Vito replied (2024/10/24 10:02 pm EST)Thanks for the addition, Anthony. We will surely forward it to our development. You may close the ticket. You wrote (2024/10/24 08:33 pm EST)PS in case you are interested, here is the corresponding issue on Homebrew's repo: #18630 Justin replied (2024/10/24 05:25 pm EST)Thank you for your suggestion and feedback. We appreciate it and will forward it to the developers for consideration. You wrote (2024/10/24 03:19 pm EST)Subject: Re: Update to 9.6.2 via Homebrew failing due to SHA256 mismatch Hi Justin, Thanks for your response about getting RoboForm directly from your website. I understand that Homebrew is not officially supported, but I'd like to provide some technical feedback that could help improve the RoboForm distribution process. I've identified the root cause of the SHA256 mismatch. RoboForm currently uses a single, unchanging URL (https://www.roboform.com/dist/roboform-mac-v9.dmg) to distribute different versions of the software. When version 9.6.3 was released, this file was replaced at the same URL: Old file (v9.6.2):
New file (v9.6.3):
This practice of replacing files at stable URLs can cause issues with package managers and caching systems. A more robust approach would be to use versioned URLs, such as:
This would ensure that:
Would you consider implementing versioned URLs for future RoboForm releases? This would improve compatibility with package managers like Homebrew and provide a better experience for users who need programmatic access to specific versions. Thanks for considering this feedback. Best regards, Justin replied (2024/10/23 12:58 pm EST)Hello, Homebrew is not affiliated with RoboForm and operates independently. The best way to get the latest installation is directly from our website, where you'll find the most up-to-date version. Please let me know if the issue continues after installing from there. https://www.roboform.com/download FYI I am getting the following message, which is very similar to last time. But interestingly, when I try to update from RoboForm itself (RoboForm menu, Check for Update), it says "You have a latest version 9.6.2 installed." even though your download and news pages do show that a version 9.6.3 is available. The installation was performed with errors - instead of installing the application, it put the installer in the applications folder. We do not recommend to use any 3rd party utilities for the updates/installation of RoboForm. You wrote (2024/08/10 06:15 pm EST)roboform 9.6.1 -> 9.6.2 I removed the file and tried again, but now there is no update. Then I did a specific Apple Ticket Text: Update to 9.6.2 via Homebrew failing due to SHA256 mismatch roboform 9.6.1 -> 9.6.2 I remove the file and tried again, but now there is no update.” After this I did the But then, on quiting Roboform and starting the new version, I got this error (the one that resulted in this feedback dialogue I am currently filling in. Given what I know, this could be Roboform’s fault, or it could be because I am using the macOS Sequoia Public Beta (macOS Sequoia Beta 15.0 (24A5309e). |
@aholland Did you file a homebrew-cask issue about this like I suggested? If not: yes, it's expected this will keep happening until you file an issue and someone makes a PR to fix this there.
We'll consider one of these once we see a bunch of other similar reports for other casks that cannot be fixed in the casks.
This seems sensible but Homebrew doesn't need to be part of this discussion.
Don't report this to them, it's not on them to fix it.
I have no idea what Roboform is or how it works. We're very off track on this issue at this point so locking in hope this moves to a more fruitful location. |
Verification
brew install wget
. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.Provide a detailed description of the proposed feature
Add the ability to disable caching for cask formulae that use unversioned URLs, either automatically or through explicit formula directives. This could be implemented as either:
Additionally, add linter warnings for unversioned URLs and enhanced error messages when SHA mismatches occur with unversioned URLs. The error messages should indicate that a fresh download is being attempted and explain why the mismatch might have occurred with an unversioned URL.
What is the motivation for the feature?
When cask formulae use unversioned URLs (e.g., app-v9.dmg instead of app-v9.6.3.dmg), developers can replace the file with newer versions while Homebrew's cache retains the old version. This leads to SHA256 mismatches and failed installations.
Example: The roboform cask recently had its v9.6.2 file (SHA 8e66a246) replaced with v9.6.3 (SHA a1aff799) at the same URL (roboform-mac-v9.dmg). Users with the cached v9.6.2 file experience SHA mismatches when trying to upgrade to v9.6.3.
How will the feature be relevant to at least 90% of Homebrew users?
All Homebrew users who install or upgrade casks with unversioned URLs are affected by this issue. While users can work around it with --no-cache, they shouldn't need to know about or remember this flag. Many popular applications use unversioned URLs in their distribution, making this a widespread issue that affects the reliability of Homebrew's core functionality for most users.
What alternatives to the feature have been considered?
The proposed solution provides flexibility while maintaining backward compatibility and puts control in the hands of formula maintainers who know their formulae best.
The text was updated successfully, but these errors were encountered: