232 Commits

Author SHA1 Message Date
Sam Ford
fcc87c901d
Cask::Audit: Align user agents with livecheck
The `#page_headers` and `#page_content` methods in
`Livecheck::Strategy` will fetch a URL using our default user agent
but if the request fails it will retry with the `:browser` user agent.
[For context, it was added as an interim measure to make URLs work
that require a different user agent but I aim to remove it in the
future in favor of specifying the user agent in a `livecheck` block
(so we don't make unnecessary requests that we know will fail).]

`Cask::Audit#audit_livecheck_https_availability` checks the
`livecheck` block URL but it only does so using our default user
agent (i.e., it calls `#validate_url_for_https_availability` which
calls `Utils::Curl#curl_check_http_content` which has a `user_agents:
[:default]` parameter). Due to this behavioral mismatch, it's possible
for a `livecheck` block to work but for this cask audit to fail.

This addresses the issue by adding `user_agents: [:default, :browser]`
to the arguments the audit uses, which aligns its behavior with
livecheck's.
2024-06-14 15:38:24 -04:00
Justin Krehel
700cbd893b
cask/audit: fix nested container extraction
Fixes edge cases where nested containers are used. Extraction for auditing artifacts did not pull the secondary container, which tried to audit the container instead of the contents.
2024-05-29 11:38:25 -04:00
Sam Ford
e2220ecc42
cask/audit: Rework tmpdir removal
I previously introduced a finalizer method in `Cask::Audit` to remove
the created `@tmpdir` once it's no longer needed but the existing
approach produces a `finalizer references object to be finalized`
warning when `brew audit` is run. I didn't see this warning when I
was originally testing it but now it reliably appears.

This reworks the finalizer to define it within the
`#extract_artifacts` method and use `@tmpdir` as the target object.
2024-05-27 13:09:46 -04:00
Mike McQuaid
ed73551cc7
cask/audit: remove debug message. 2024-05-27 08:10:20 +01:00
Aaron Ruan
ae851a7aa4
seperate audit for osdn url 2024-05-27 12:22:48 +08:00
Aaron Ruan
7b21cc1856
fix typecheck 2024-05-27 09:32:54 +08:00
Aaron Ruan
73ead3e5f5
match with url host instead of string 2024-05-27 00:26:35 +08:00
Aaron Ruan
7da9ea07d0
fix style 2024-05-26 17:00:42 +08:00
Aaron Ruan
2fcbff8ee2
disable osdn.jp URL 2024-05-26 16:51:44 +08:00
Sam Ford
5701f92321
Clean up cask audit tmpdir after use
`Cask::Audit#extract_artifacts` is used in the `#audit_signing` and
`#cask_plist_min_os` methods to create a directory in `/tmp` and
extract cask artifacts without duplicating the work if it's already
done. However, due to how this is set up, `tmpdir` isn't removed
afterward and the extracted artifacts will take up disk space until
the `tmp` directory is cleaned up. As a result, running
`brew audit --strict --online` locally can chew through disk space
and it may not be clear to the user where their free space has gone.

This adds a finalizer method to `Cask::Audit` to remove the created
`@tmpdir` (if any) once it's no longer needed. There may be a better
way of addressing the issue but this works for now without having to
restructure how these audits work.
2024-05-24 09:22:12 -04:00
Mike McQuaid
82591d12dc
Merge pull request #17031 from krehel/update-artifact-audit
cask/audit: update signing checks for app, binary, and pkg
2024-05-22 17:39:27 +01:00
Justin Krehel
344a5021d8
cask/audit.rb: update signing checks for app, binary, and pkg 2024-05-22 10:29:47 -04:00
Patrick Linnane
773dbfa92a
docs: update for Homebrew/cask-fonts deprecation
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-05-16 09:21:14 -07:00
Bevan Kay
db4099d977
cask/audit: fix sharding for font-* casks 2024-05-16 11:29:58 +10:00
Justin Krehel
836d819c43
Support font sharding in Homebrew/cask 2024-05-10 11:48:56 -04:00
Mike McQuaid
222fe8ef0b
Homebrew 4.3.0 deprecation/disable/removals.
The usual pass of deprecating/disabling/removing code for the next
minor Homebrew release.
2024-05-07 12:18:04 +01:00
Eric Knibbe
d1d0bfc0ba
cask/audit: tune sourceforge.net URL regex 2024-05-06 22:56:28 -04:00
Patrick Linnane
7fe4d2e42f
various: remove remaining Homebrew/cask-versions references
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-05-02 15:29:21 -07:00
Razvan Azamfirei
0b0fcdcdd2
homebrew/cask-versions: remove 2024-05-02 16:59:33 -04:00
Markus Reiter
480e264d9a
Lint Ruby docs. 2024-05-01 11:35:21 +02:00
Markus Reiter
0f0055ede4
Make documentation @api private by default. 2024-04-26 19:04:20 +02:00
Bevan Kay
160e9d44dd
Revert "cask/audit: always enable codesign audit for casks" 2024-04-03 08:15:05 +11:00
Bevan Kay
038a3eb155
cask/audit: always enable codesign audit for casks 2024-04-02 21:53:07 +11:00
Michael Cho
85a08bcdc4
cask/audit: allow @ for versioned casks
Signed-off-by: Michael Cho <michael@michaelcho.dev>
2024-03-09 12:20:27 -05:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Bo Anderson
1d7101d8a3
Use HOMEBREW_TEMP more universally 2024-02-26 16:58:53 +00:00
Douglas Eichelberger
eb7c3e52a0 Require SystemInclude only where needed 2024-01-31 11:42:01 -08:00
apainintheneck
926c5b739a cmd/audit: fix type error in cask livecheck url audit
This got updated recently in 42a42c96acc5193dbb6e321ff2aaecceb00e48a4
to split out the livecheck audits and as a result of that the type
signature for the #validate_url_for_https_availablity method got updated.

This did not account for the possibility that the livecheck url was nil.
I've added a nil check here since it makes no sense to try and validate
a nil url and we have nil checks for the other two http availability
audits already. Plus, the livecheck blocks are audited thoroughly already
for syntax.
2024-01-07 15:45:24 -08:00
Markus Reiter
d496d044f1
Split https_availability audit. 2024-01-06 11:40:56 +01:00
Douglas Eichelberger
ffd761d2e9 Create dedicated Attrable mixin for attr_ methods 2023-12-28 11:46:27 -08:00
Douglas Eichelberger
caf8259ae6 Code review changes 2023-12-27 15:29:33 -08:00
Douglas Eichelberger
3abbf4447e Some minor regexp match perf improvements 2023-12-27 13:16:36 -08:00
Razvan Azamfirei
2dc3741f08
audit: fix formula path 2023-12-26 08:19:49 +02:00
Rylan Polster
25b753fe51
Re-add some discontinued? checks for casks 2023-12-17 19:07:37 -05:00
Rylan Polster
4793677123
Merge pull request #16292 from Rylan12/cask-deprecate-disable
Add `deprecate!` and `disable!` to casks
2023-12-17 15:03:39 -05:00
Rylan Polster
7eb3f1a314
Replace discontinued? with deprecated? 2023-12-16 20:01:47 -05:00
Valentin Kulesh
06155ff6e0
Work around recent Akamai/Microsoft issues
At the moment, Microsoft Office and related casks fail audit due to
failure to fetch a product homepage from the main Microsoft site
(https://www.microsoft.com/) served by Akamai CDN.
The failure is severe and weird: no status code is received as the
connection is reset.
The analysis revealed the issue is linked to `User-Agent` and
`Accept-Language` headers parsing. Homebrew uses involved user agent
strings and has language hardcoded as `en`.
The simplest workaround is to use a simple user agent string when checking
homepage availability if the cask is in an audit exceptions list.

Merging this would fix Microsoft Office updates (including
https://github.com/Homebrew/homebrew-cask/pull/162671)
2023-12-16 22:20:17 +03:00
Mike McQuaid
79a6091d08
Cask#full_name: properly output Homebrew org names
This was not returning the full name correctly for e.g. anything in
Homebrew/homebrew-fonts.

While we're here, fix up a few other places where `tap.core_cask_tap?`
can be used more appropriately.
2023-12-13 13:17:12 +00:00
Sam Ford
491e2c4a80
Reorder #audit_min_os array for consistency
This change doesn't affect the behavior of the `#audit_min_os`
method and simply reorders the array members to place `plist_min_os`
before `sparkle_min_os` for the sake of consistency (using the same
order as the preceding lines).
2023-11-16 12:05:25 -05:00
Sam Ford
28451bd2bc
Use Sparkle sorting/filtering in #livecheck_min_os
The `#livecheck_min_os` cask audit method manually replicates some of
the `Sparkle` strategy's behavior but in an incomplete way that has
lead to inappropriate audit failures at times. This reimplements it
to use `Livecheck` methods, so it will align with the `Sparkle`
strategy's behavior.
2023-11-16 12:05:24 -05:00
Sam Ford
d376b46a7d
Skip items strategy blocks in #livecheck_min_os
The `#livecheck_min_os` cask audit method should be skipped when a
`Sparkle` `livecheck` block contains a `strategy` block that uses
the `items` argument (instead of `item`). These `strategy` blocks
contain arbitrary logic that ignores/overrides the strategy's sorting,
so we can't identify which item would be first/newest.
2023-11-16 12:05:24 -05:00
Razvan Azamfirei
df2aee4553
audit: add extract artifcats method 2023-11-05 17:18:32 -05:00
Razvan Azamfirei
e60523766e
audit: code review changes 2023-11-05 17:18:32 -05:00
Razvan Azamfirei
c90e6e7b4b
cask/audit: add audit_min_os 2023-11-05 17:18:31 -05:00
apainintheneck
85bd4c7e1f utils/backtrace: scrub sorbet-runtime from backtrace
Ever since we started using this at runtime it's been polluting
the backtrace output. This makes it harder to debug errors and
increases the amount of info users have to paste into the box
when filing an issue.

This is a very direct approach. Essentially, we strip out
everything related to the `sorbet-runtime` gem whenever the top
line in the backtrace is unrelated to sorbet-runtime.

The hope is that this will allow errors related to sorbet to
be diagnosed easily while also reducing the backtrace size
for all other types of errors.

Sometimes it is useful to see the full backtrace though.
For those cases, we include the full backtrace when
`--verbose` is passed in and print a warning that the
Sorbet lines have been removed from the backtrace the
first time they are removed.

Note: This requires gems to be set up so that the call to
`Gem.paths.home` works correctly. For that reason, it must
be included after `utils/gems` which is included in
`standalone/load_path` already.
2023-09-21 21:07:22 -07:00
apainintheneck
1dc9274f62 Improve cask audit
- check for cask.url in audit steps
- check for cask.version in audit steps
- check for cask.sha256 in fetch command
- stop omitting casks based on nil url in audit command

It would be nice to be able to omit casks from the audit
if the os is not supported but there is not easy way to
do that without updating the SimulateSystem code or
refactoring how MacOSRequirement's are defined in the DSL.
2023-09-07 20:38:17 -07:00
Ruoyu Zhong
05ffff09ed
cask/audit: fix Utils::Curl usage
Needed after #15940.
2023-09-06 00:12:57 +08:00
Mike McQuaid
1a91157590
Fix more missing Utils::Curl references.
e.g. https://github.com/Homebrew/brew/pull/15940#issuecomment-1706486816
2023-09-05 08:27:02 -04:00
Eric Knibbe
686638b683
cask/audit: format-check block URLs only if online 2023-08-29 17:10:40 -04:00
Razvan Azamfirei
72df964b33
change path 2023-08-09 15:27:36 -04:00