diff options
author | Matt Jolly <kangie@gentoo.org> | 2024-09-27 09:19:37 +1000 |
---|---|---|
committer | Matt Jolly <kangie@gentoo.org> | 2024-09-27 10:52:11 +1000 |
commit | 9e4fee2f5fa978bfd98367e78bfc0fb87e3548f9 (patch) | |
tree | e05e6ff1bf77999a759e39468b5508b4b5a14147 | |
parent | Trim trailing whitespace (diff) | |
download | chromium-tools-9e4fee2f5fa978bfd98367e78bfc0fb87e3548f9.tar.gz chromium-tools-9e4fee2f5fa978bfd98367e78bfc0fb87e3548f9.tar.bz2 chromium-tools-9e4fee2f5fa978bfd98367e78bfc0fb87e3548f9.zip |
flake8: Add config and do some trivial style changes
Signed-off-by: Matt Jolly <kangie@gentoo.org>
-rw-r--r-- | .flake8 | 4 | ||||
-rwxr-xr-x | get-edge-cves.py | 20 | ||||
-rwxr-xr-x | get-opera-version-mapping.py | 3 | ||||
-rwxr-xr-x | opera-bump | 1 |
4 files changed, 25 insertions, 3 deletions
@@ -0,0 +1,4 @@ +[flake8] +ignore = E401 +max-line-length = 120 +max-complexity = 15 diff --git a/get-edge-cves.py b/get-edge-cves.py index 515c986..44b2eef 100755 --- a/get-edge-cves.py +++ b/get-edge-cves.py @@ -70,6 +70,18 @@ class EdgeCVE: def get_edge_cves(year, month) -> list[EdgeCVE]: + """ + Queries the Microsoft Security Response Center (MSRC) API for the Common Vulnerability Reporting Framework (CVRF) + for a given month and extracts the Chromium version mapping for Microsoft Edge (Chromium-based) from the CVRF. + + Args: + year: The year to query. + month: The month to query. + + Returns: + list[EdgeCVE]: A list of EdgeCVE objects. + """ + msrcapi = f"https://api.msrc.microsoft.com/cvrf/v3.0/cvrf/{year}-{month}" # Get the CVRF for the specified month @@ -106,7 +118,7 @@ def get_edge_cves(year, month) -> list[EdgeCVE]: # Fall back to parsing that horrible, horrible table in the notes notes = vulnerability.find(".//{http://www.icasi.org/CVRF/schema/vuln/1.1}Notes") # There appear to be multiple notes, but only one has content that we want: - # <vuln:Note Title="FAQ" Type="FAQ" Ordinal="10"><p><strong>What is the version information for this release?</strong></p> + # <vuln:Note Title="FAQ" Type="FAQ" Ordinal="10"><p><strong>What is the version information for this release?</strong></p> # noqa: E501 found = False for note in notes: if note.attrib['Title'] == "FAQ" and note.attrib['Type'] == "FAQ": @@ -121,7 +133,7 @@ def get_edge_cves(year, month) -> list[EdgeCVE]: if len(rows) > 1: cells = rows[1].find_all('td') if len(cells) > 1: - # We want the second cell (The first is the channel, the third the chromium version it's based on) + # We want the second cell (1st is channel, 3rd is chromium version) edge_version = cells[1].text if portage_versions.ververify(edge_version): found = True @@ -197,11 +209,14 @@ def parse_arguments(): def main(): args = parse_arguments() + # If we have a CVE to query (bugs contain them in the Alias field) we can query the API directly + # and work out which CVRF(s) to query. if not args.bug and not args.cve: month = calendar.month_name[args.month][0:3] for cve in get_edge_cves(args.year, month): print(cve) + # If we have a bug, we can query the bugzilla API to get the CVEs associated with it elif args.bug: for bug in args.bug: cves = get_cve_from_bug_alias(bug) @@ -218,6 +233,7 @@ def main(): if cve.cve in cves: print(cve) + # If we have a CVE (or list of CVEs), we can query the API directly to identify the CVRFs to query elif args.cve: msrcs = [] cves = [] diff --git a/get-opera-version-mapping.py b/get-opera-version-mapping.py index ef60683..6d6f3de 100755 --- a/get-opera-version-mapping.py +++ b/get-opera-version-mapping.py @@ -9,7 +9,8 @@ def get_opera_chromium_versions(base_url, start_version, end_version): parsing content sections for versions from start_version to end_version (inclusive). Args: - base_url: The base URL for Opera changelogs with a version placeholder (e.g., "https://blogs.opera.com/desktop/changelog-for-{version}/"). + base_url: The base URL for Opera changelogs with a version placeholder (e.g., + "https://blogs.opera.com/desktop/changelog-for-{version}/"). start_version: The starting version to extract information for (inclusive). end_version: The ending version to extract information for (inclusive). @@ -393,5 +393,6 @@ def main(): f"www-client/{pkg}: remove old", "-s", "-S") + if __name__ == "__main__": main() |