Files
brave-core/patches/tools-resources-generate_resource_allowlist.py.patch
Max Karolinskiy 8164cfef19 [cr141] Lower resources threshold for allowlist.
In Release build on Windows we get this error:

------------
brave/vendor/depot_tools/bootstrap-2@3_11_8_chromium_35_bin/python3/bin/python3.exe ../../tools/resources/generate_resource_allowlist.py -o gen/wireguard_resources_allowlist.txt brave_vpn_wireguard_service.exe.pdb
build step: __brave_browser_brave_vpn_win_brave_vpn_wireguard_service_wireguard_resource_allowlist___build_toolchain_win_win_clang_x64__rule "./gen/wireguard_resources_allowlist.txt"
stderr:
Traceback (most recent call last):
  File "tools\resources\generate_resource_allowlist.py", line 161, in <module>
    main()
  File "tools\resources\generate_resource_allowlist.py", line 157, in main
    WriteResourceAllowlist(args)
  File "tools\resources\generate_resource_allowlist.py", line 142, in WriteResourceAllowlist
    ','.join(sorted(resource_ids)))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: sequence item 0: expected str instance, int found
------------

The error message is actually misleading due to a bug in the upstream
script (trying to use string.join on int numbers), but the code where
this error happens is:

------------
  # The last time this broke, exactly two resources were still being found.
  if len(resource_ids) < 100:
    raise Exception('Suspiciously few resources found. Likely an issue with '
                    'the regular expression in this script. Found: ' +
                    ','.join(sorted(resource_ids))
------------

It's unclear what's changed compared to the current master, but there we
currently have 115 resources listed in
brave_vpn_wireguard_service.exe.pdb, whereas in cr141 we only have 46. A
guess is that some dependency of the executable has changed and isn't
bringing in upstream resources. Chromium uses this script at the top
level where a large number of resources is expected, but our vpn service
executable doesn't have that many resources.
2025-09-22 14:59:56 -04:00

14 lines
747 B
Diff

diff --git a/tools/resources/generate_resource_allowlist.py b/tools/resources/generate_resource_allowlist.py
index 94ea65ea253a49b204935f2fbdfe17cf8fb83a6a..d30024556d3de79165814175585dc532494ce34f 100755
--- a/tools/resources/generate_resource_allowlist.py
+++ b/tools/resources/generate_resource_allowlist.py
@@ -136,7 +136,7 @@ def WriteResourceAllowlist(args):
resource_ids.update(func(input))
# The last time this broke, exactly two resources were still being found.
- if len(resource_ids) < 100:
+ if len(resource_ids) < 40:
raise Exception('Suspiciously few resources found. Likely an issue with '
'the regular expression in this script. Found: ' +
','.join(sorted(resource_ids)))