From d8b3db7b00087466788f7226c733f2999716b9ba Mon Sep 17 00:00:00 2001 From: jboursier Date: Wed, 7 Dec 2022 13:38:43 +0100 Subject: [PATCH 01/29] Rename some variables Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/ghas_cli/utils/teams.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ghas_cli/utils/teams.py b/src/ghas_cli/utils/teams.py index bdc90c7..85eae91 100644 --- a/src/ghas_cli/utils/teams.py +++ b/src/ghas_cli/utils/teams.py @@ -53,19 +53,20 @@ def list(organization: str, token: str) -> str: params = {"per_page": 100, "page": page} - teams = requests.get( + teams_res = requests.get( url=f"https://api.github.com/orgs/{organization}/teams", params=params, headers=headers, ) - if network.check_rate_limit(teams): + if network.check_rate_limit(teams_res): break - if teams.status_code != 200: + if teams_res.status_code != 200: break - if [] == teams.json(): + + if [] == teams_res.json(): break - teams = teams.json() + teams = teams_res.json() for team in teams: teams_list.append(team["slug"]) From aceb30aca08dc346cf6b79d338691a58fa845172 Mon Sep 17 00:00:00 2001 From: jboursier Date: Wed, 7 Dec 2022 13:49:49 +0100 Subject: [PATCH 02/29] Support custom format for repositories team listing Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/cli.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/cli.py b/src/cli.py index 0fa738c..74a937e 100644 --- a/src/cli.py +++ b/src/cli.py @@ -402,6 +402,16 @@ def teams_list(organization: str, token: str) -> None: @teams_cli.command("repositories") @click.option("-o", "--organization", prompt="Organization name", type=str) @click.option("-s", "--team", prompt="Team slug", type=str) +@click.option( + "-f", + "--format", + prompt="Output format", + type=click.Choice( + ["human", "ghas", "json", "list"], + case_sensitive=False, + ), + default="human", +) @click.option( "-t", "--token", @@ -412,13 +422,26 @@ def teams_list(organization: str, token: str) -> None: confirmation_prompt=False, show_envvar=True, ) -def teams_get_repositories(organization: str, team: str, token: str) -> None: +def teams_get_repositories( + organization: str, team: str, token: str, format: str +) -> None: """List repositories for a specific team""" team_repos = teams.get_repositories( team_slug=team, organization=organization, token=token ) - for repo in team_repos: - click.echo(f"{team}: {repo}") + + if "human" == format: + for repo in team_repos: + click.echo(f"{team}: {repo}") + elif "ghas" == format: + for repo in team_repos: + click.echo(repo.to_ghas()) + elif "json" == format: + for repo in team_repos: + click.echo(repo.to_json()) + elif "list" == format: + for repo in team_repos: + click.echo(f"{repo.orga}/{repo.name}") ########## From a403bf52e02f2cf8acb91b6fe7943b472b33645b Mon Sep 17 00:00:00 2001 From: jboursier Date: Fri, 16 Dec 2022 15:44:54 +0100 Subject: [PATCH 03/29] Remove unused import to make CodeQL happy Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/ghas_cli/utils/actions.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ghas_cli/utils/actions.py b/src/ghas_cli/utils/actions.py index f851c7b..af1fe79 100644 --- a/src/ghas_cli/utils/actions.py +++ b/src/ghas_cli/utils/actions.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- #!/usr/bin/env python3 -from typing import List import requests from . import network From b25de06d4487425fd2bfbaddcf626deb313a2043 Mon Sep 17 00:00:00 2001 From: jboursier Date: Tue, 20 Dec 2022 20:07:25 +0100 Subject: [PATCH 04/29] Update CodeQL templates Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- templates/codeql-analysis-default.yml | 1 - templates/codeql-analysis-javascript.yml | 1 - templates/codeql-analysis-python.yml | 1 - templates/codeql-analysis-ruby.yml | 1 - 4 files changed, 4 deletions(-) diff --git a/templates/codeql-analysis-default.yml b/templates/codeql-analysis-default.yml index f01fa84..12d2689 100644 --- a/templates/codeql-analysis-default.yml +++ b/templates/codeql-analysis-default.yml @@ -10,7 +10,6 @@ name: "CodeQL - Default" on: push: - branches: ["main"] pull_request: branches: ["main"] schedule: diff --git a/templates/codeql-analysis-javascript.yml b/templates/codeql-analysis-javascript.yml index e0a41e4..4df01a9 100644 --- a/templates/codeql-analysis-javascript.yml +++ b/templates/codeql-analysis-javascript.yml @@ -10,7 +10,6 @@ name: "CodeQL - Javascript" on: push: - branches: ["main"] pull_request: branches: ["main"] schedule: diff --git a/templates/codeql-analysis-python.yml b/templates/codeql-analysis-python.yml index ae5ae5f..f4281cc 100644 --- a/templates/codeql-analysis-python.yml +++ b/templates/codeql-analysis-python.yml @@ -10,7 +10,6 @@ name: "CodeQL - Python" on: push: - branches: ["main"] pull_request: branches: ["main"] schedule: diff --git a/templates/codeql-analysis-ruby.yml b/templates/codeql-analysis-ruby.yml index fc72a37..0bbb466 100644 --- a/templates/codeql-analysis-ruby.yml +++ b/templates/codeql-analysis-ruby.yml @@ -10,7 +10,6 @@ name: "CodeQL - Ruby" on: push: - branches: ["main"] pull_request: branches: ["main"] schedule: From f72b016a02b150ecee8f9d3510c06ab322c1cc61 Mon Sep 17 00:00:00 2001 From: jboursier Date: Thu, 12 Jan 2023 16:35:14 +0100 Subject: [PATCH 05/29] Ability to export a list of repositories last updated before a specified time Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/cli.py | 86 ++++++++++++++++++++++++++++++ src/ghas_cli/utils/repositories.py | 26 ++++++++- 2 files changed, 111 insertions(+), 1 deletion(-) diff --git a/src/cli.py b/src/cli.py index 74a937e..0bac912 100644 --- a/src/cli.py +++ b/src/cli.py @@ -371,6 +371,92 @@ def repositories_create_dep_enforcement_pr( ) +@repositories_cli.command("archivable") +@click.option( + "-f", + "--format", + prompt="Output format", + type=click.Choice( + ["human", "ghas", "json", "list"], + case_sensitive=False, + ), + default="human", +) +@click.option( + "-u", "--last_updated_before", prompt="Last updated before YYYY-MM-DD", type=str +) +@click.argument("output", type=click.File("w")) +@click.option( + "-t", + "--token", + prompt=False, + type=str, + default=None, + hide_input=True, + confirmation_prompt=False, + show_envvar=True, +) +@click.option("-o", "--organization", prompt="Organization name", type=str) +def repositories_archivable( + last_updated_before: str, + format: str, + output: Any, + organization: str, + token: str, +) -> None: + """Find potentially archivable repositories""" + + try: + threshold_date = datetime.strptime(last_updated_before, "%Y-%m-%d") + except: + click.echo(f"Invalid time: {last_updated_before}") + return False + + # 1. Get list of non-archived repositories + res = repositories.get_org_repositories( + status="public", + organization=organization, + token=token, + language="", + default_branch="", + license="", + archived=False, + disabled=False, + ) + + for repo in res: + print(f"default branch: {repo.default_branch}") + + branch_last_commit_date = repositories.get_default_branch_last_updated( + token=token, + organization=organization, + repository_name=repo.name, + default_branch=repo.default_branch, + ) + if not branch_last_commit_date: + return False + + click.echo(f"{branch_last_commit_date}, {threshold_date}") + + if branch_last_commit_date > threshold_date: + continue + + if "human" == format: + output.write(repo + "\n") + click.echo(repo) + elif "ghas" == format: + output.write( + json.dumps([{"login": organization, "repos": repo.to_ghas()}]) + "\n" + ) + click.echo([{"login": organization, "repos": repo.to_ghas()}]) + elif "json" == format: + output.write(json.dumps(repo.to_json()) + "\n") + click.echo(repo.to_json()) + elif "list" == format: + output.write(repo.name + "\n") + click.echo(repo.name) + + ######### # Teams # ######### diff --git a/src/ghas_cli/utils/repositories.py b/src/ghas_cli/utils/repositories.py index 0d08040..ea32653 100644 --- a/src/ghas_cli/utils/repositories.py +++ b/src/ghas_cli/utils/repositories.py @@ -1,11 +1,12 @@ # -*- coding: utf-8 -*- #!/usr/bin/env python3 -from typing import List +from typing import List, Any import base64 import requests from . import network import time +import datetime class Repository: @@ -216,6 +217,29 @@ def get_org_repositories( return repos_list +def get_default_branch_last_updated( + token: str, organization: str, repository_name: str, default_branch: str +) -> Any: + """ + Return the latest commit date on the default branch + """ + headers = network.get_github_headers(token) + + branch_res = requests.get( + url=f"https://api.github.com/repos/{organization}/{repository_name}/branches/{default_branch}", + headers=headers, + ) + + if branch_res.status_code != 200: + return False + + branch_res = branch_res.json() + + return datetime.datetime.strptime( + branch_res["commit"]["commit"]["author"]["date"].split("T")[0], "%Y-%m-%d" + ) + + def check_dependabot_alerts_enabled( token: str, organization: str, repository_name: str ) -> bool: From f4ce7321bcd76ab77ad13d6ed734484a56948d03 Mon Sep 17 00:00:00 2001 From: jboursier Date: Thu, 12 Jan 2023 16:49:47 +0100 Subject: [PATCH 06/29] Ability to archive a repository Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/cli.py | 26 ++++++++++++++++++++++++++ src/ghas_cli/utils/repositories.py | 17 +++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/src/cli.py b/src/cli.py index 0bac912..aa99a4a 100644 --- a/src/cli.py +++ b/src/cli.py @@ -457,6 +457,32 @@ def repositories_archivable( click.echo(repo.name) +@repositories_cli.command("archive") +@click.option( + "-r", + "--repository", + prompt="Repository name", +) +@click.option( + "-t", + "--token", + prompt=False, + type=str, + default=None, + hide_input=True, + confirmation_prompt=False, + show_envvar=True, +) +@click.option("-o", "--organization", prompt="Organization name", type=str) +def repositories_archive( + repository: str, + organization: str, + token: str, +) -> None: + """Archive a repository""" + click.echo(repositories.archive(organization, token, repository)) + + ######### # Teams # ######### diff --git a/src/ghas_cli/utils/repositories.py b/src/ghas_cli/utils/repositories.py index ea32653..691b5a0 100644 --- a/src/ghas_cli/utils/repositories.py +++ b/src/ghas_cli/utils/repositories.py @@ -240,6 +240,23 @@ def get_default_branch_last_updated( ) +def archive(organization: str, token: str, repository: str) -> bool: + headers = network.get_github_headers(token) + + payload = {"archived": True} + + status = requests.patch( + url=f"https://api.github.com/repos/{organization}/{repository}", + headers=headers, + json=payload, + ) + + if status.status_code != 200: + return False + else: + return True + + def check_dependabot_alerts_enabled( token: str, organization: str, repository_name: str ) -> bool: From 14657ece35c879ff96f5076fd7197716e581cb4b Mon Sep 17 00:00:00 2001 From: jboursier Date: Thu, 12 Jan 2023 16:51:09 +0100 Subject: [PATCH 07/29] Catch Exception only Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.py b/src/cli.py index aa99a4a..0b92be3 100644 --- a/src/cli.py +++ b/src/cli.py @@ -408,7 +408,7 @@ def repositories_archivable( try: threshold_date = datetime.strptime(last_updated_before, "%Y-%m-%d") - except: + except Exception: click.echo(f"Invalid time: {last_updated_before}") return False From 2eeb500480129efcde91f5bd710e53e6c533ef97 Mon Sep 17 00:00:00 2001 From: jboursier Date: Thu, 12 Jan 2023 16:52:09 +0100 Subject: [PATCH 08/29] Return a boolean Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/cli.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cli.py b/src/cli.py index 0b92be3..56b293b 100644 --- a/src/cli.py +++ b/src/cli.py @@ -403,7 +403,7 @@ def repositories_archivable( output: Any, organization: str, token: str, -) -> None: +) -> bool: """Find potentially archivable repositories""" try: @@ -456,6 +456,8 @@ def repositories_archivable( output.write(repo.name + "\n") click.echo(repo.name) + return True + @repositories_cli.command("archive") @click.option( From 12a82cd1fcce2f79a347e2ab92b22e0fdddec1b2 Mon Sep 17 00:00:00 2001 From: jboursier Date: Thu, 12 Jan 2023 16:58:24 +0100 Subject: [PATCH 09/29] Mass archive a list of repositories Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/cli.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/cli.py b/src/cli.py index 56b293b..90f8000 100644 --- a/src/cli.py +++ b/src/cli.py @@ -1019,5 +1019,41 @@ def mass_deploy( ) +@mass_cli.command("archive") +@click.argument("input_repos_list", type=click.File("r")) +@click.option( + "-t", + "--token", + prompt=False, + type=str, + default=None, + hide_input=True, + confirmation_prompt=False, + show_envvar=True, +) +@click.option("-o", "--organization", prompt="Organization name", type=str) +def mass_deploy( + input_repos_list: Any, + organization: str, + token: str, +) -> None: + """Mass archive a list of repositories""" + + repos_list = input_repos_list.readlines() + + for repo in repos_list: + + repo = repo.rstrip("\n") + + click.echo(f"{repo}...", nl=False) + + if repositories.archive( + organization=organization, token=token, repository=repo + ): + click.echo(" Archived.") + else: + click.echo(" Not Archived.", err=True) + + if __name__ == "__main__": main() From 63915c1835ba2412b8337c24a2c6b4eace9ed66f Mon Sep 17 00:00:00 2001 From: jboursier Date: Thu, 12 Jan 2023 17:18:04 +0100 Subject: [PATCH 10/29] Create an issue to inform of the upcoming archive event Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/cli.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/src/cli.py b/src/cli.py index 90f8000..67ee455 100644 --- a/src/cli.py +++ b/src/cli.py @@ -1032,12 +1032,12 @@ def mass_deploy( show_envvar=True, ) @click.option("-o", "--organization", prompt="Organization name", type=str) -def mass_deploy( +def mass_issue_archive( input_repos_list: Any, organization: str, token: str, ) -> None: - """Mass archive a list of repositories""" + """Create an issue to inform that repositories will be archived at a specific date.""" repos_list = input_repos_list.readlines() @@ -1055,5 +1055,54 @@ def mass_deploy( click.echo(" Not Archived.", err=True) +@mass_cli.command("issue_upcoming_archive") +@click.argument("input_repos_list", type=click.File("r")) +@click.option( + "-u", + "--archived_date", + prompt="Target date when the repositories will be archived", + type=str, +) +@click.option( + "-t", + "--token", + prompt=False, + type=str, + default=None, + hide_input=True, + confirmation_prompt=False, + show_envvar=True, +) +@click.option("-o", "--organization", prompt="Organization name", type=str) +def mass_archive( + input_repos_list: Any, + archived_date: str, + organization: str, + token: str, +) -> None: + """Mass archive a list of repositories""" + + repos_list = input_repos_list.readlines() + + for repo in repos_list: + + repo = repo.rstrip("\n") + + issue_creation = issues.create( + title=f"This repository will be archived on {archived_date} :warning: :wastebasket:", + content=f""" +Hello, + +Due to inactivity, this repository will be archived automatically on {archived_date}. + +If you think this is a mistake, please informthe Security team *ASAP* on Slack at `#github-appsec-security.` + +Thanks! :handshake:""", + repository=repo, + organization=organization, + token=token, + ) + + if __name__ == "__main__": main() From bc31f74c7be641ca471793093a132898ba297f9c Mon Sep 17 00:00:00 2001 From: jboursier Date: Thu, 12 Jan 2023 17:23:12 +0100 Subject: [PATCH 11/29] Add a link to GitHub's documentation Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/cli.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cli.py b/src/cli.py index 67ee455..3fd4435 100644 --- a/src/cli.py +++ b/src/cli.py @@ -1095,6 +1095,8 @@ def mass_archive( Due to inactivity, this repository will be archived automatically on {archived_date}. +For more information, see https://docs.github.com/en/repositories/archiving-a-github-repository/archiving-repositories#about-repository-archival + If you think this is a mistake, please informthe Security team *ASAP* on Slack at `#github-appsec-security.` Thanks! :handshake:""", From 8c0e7759c51c61850d170caa39857909c6da25b3 Mon Sep 17 00:00:00 2001 From: jboursier Date: Thu, 12 Jan 2023 17:24:01 +0100 Subject: [PATCH 12/29] Remove unused variable Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.py b/src/cli.py index 3fd4435..e225745 100644 --- a/src/cli.py +++ b/src/cli.py @@ -1088,7 +1088,7 @@ def mass_archive( repo = repo.rstrip("\n") - issue_creation = issues.create( + issues.create( title=f"This repository will be archived on {archived_date} :warning: :wastebasket:", content=f""" Hello, From 6d602ea3e413563b5cca4b7822480f1f14761ee6 Mon Sep 17 00:00:00 2001 From: jboursier Date: Thu, 12 Jan 2023 17:53:56 +0100 Subject: [PATCH 13/29] Check archivable status on all repositories, not just public ones Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.py b/src/cli.py index e225745..7bc90ff 100644 --- a/src/cli.py +++ b/src/cli.py @@ -414,7 +414,7 @@ def repositories_archivable( # 1. Get list of non-archived repositories res = repositories.get_org_repositories( - status="public", + status="all", organization=organization, token=token, language="", From 42b83b7a7eb5206673b9ba3189d29b1a6261a157 Mon Sep 17 00:00:00 2001 From: jboursier Date: Thu, 12 Jan 2023 17:56:22 +0100 Subject: [PATCH 14/29] Remove excessive logging Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/cli.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/cli.py b/src/cli.py index 7bc90ff..6514361 100644 --- a/src/cli.py +++ b/src/cli.py @@ -425,7 +425,6 @@ def repositories_archivable( ) for repo in res: - print(f"default branch: {repo.default_branch}") branch_last_commit_date = repositories.get_default_branch_last_updated( token=token, @@ -436,8 +435,6 @@ def repositories_archivable( if not branch_last_commit_date: return False - click.echo(f"{branch_last_commit_date}, {threshold_date}") - if branch_last_commit_date > threshold_date: continue From 41b4bc85486b7ed3f21835f8d71a0e050b4e8b34 Mon Sep 17 00:00:00 2001 From: jboursier Date: Thu, 12 Jan 2023 18:01:41 +0100 Subject: [PATCH 15/29] Fix typo Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.py b/src/cli.py index 6514361..7bb9c0c 100644 --- a/src/cli.py +++ b/src/cli.py @@ -1094,7 +1094,7 @@ def mass_archive( For more information, see https://docs.github.com/en/repositories/archiving-a-github-repository/archiving-repositories#about-repository-archival -If you think this is a mistake, please informthe Security team *ASAP* on Slack at `#github-appsec-security.` +If you think this is a mistake, please inform the Security team *ASAP* on Slack at `#github-appsec-security.` Thanks! :handshake:""", repository=repo, From 6297c1c8622d4d0349fa9e9a77c235be83fc6d89 Mon Sep 17 00:00:00 2001 From: jboursier Date: Thu, 12 Jan 2023 18:03:34 +0100 Subject: [PATCH 16/29] Improve issue creation output Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/cli.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cli.py b/src/cli.py index 7bb9c0c..467b862 100644 --- a/src/cli.py +++ b/src/cli.py @@ -1085,7 +1085,7 @@ def mass_archive( repo = repo.rstrip("\n") - issues.create( + issue_res = issues.create( title=f"This repository will be archived on {archived_date} :warning: :wastebasket:", content=f""" Hello, @@ -1101,6 +1101,10 @@ def mass_archive( organization=organization, token=token, ) + if issue_res: + click.echo(f"{repo}... {issue_res}") + else: + click.echo(f"{repo}... Failure", err=True) if __name__ == "__main__": From 575e21a96eb6066d09dfdab7252eb5b5dd9c9b72 Mon Sep 17 00:00:00 2001 From: jboursier Date: Fri, 13 Jan 2023 18:15:33 +0100 Subject: [PATCH 17/29] * Add debugging steps * Improve archiving issue body to be more explanatory * Fix rate-limit handling Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/cli.py | 8 ++++++-- src/ghas_cli/utils/network.py | 2 +- src/ghas_cli/utils/repositories.py | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/cli.py b/src/cli.py index 467b862..aff7cde 100644 --- a/src/cli.py +++ b/src/cli.py @@ -414,7 +414,7 @@ def repositories_archivable( # 1. Get list of non-archived repositories res = repositories.get_org_repositories( - status="all", + status="internal", organization=organization, token=token, language="", @@ -424,6 +424,7 @@ def repositories_archivable( disabled=False, ) + print(len(res)) for repo in res: branch_last_commit_date = repositories.get_default_branch_last_updated( @@ -433,7 +434,8 @@ def repositories_archivable( default_branch=repo.default_branch, ) if not branch_last_commit_date: - return False + click.echo(f"No branch last commit date for {repo.name}", err=True) + continue if branch_last_commit_date > threshold_date: continue @@ -1092,6 +1094,8 @@ def mass_archive( Due to inactivity, this repository will be archived automatically on {archived_date}. +This means that it will become read-only: `git clone` will still work, and the repository can be unarchived at anytime if needed. + For more information, see https://docs.github.com/en/repositories/archiving-a-github-repository/archiving-repositories#about-repository-archival If you think this is a mistake, please inform the Security team *ASAP* on Slack at `#github-appsec-security.` diff --git a/src/ghas_cli/utils/network.py b/src/ghas_cli/utils/network.py index b7557d3..81bdb16 100644 --- a/src/ghas_cli/utils/network.py +++ b/src/ghas_cli/utils/network.py @@ -31,7 +31,7 @@ def check_rate_limit(response: Any) -> bool: print( f"Rate limit reached: {response.headers['x-ratelimit-remaining']}/{response.headers['x-ratelimit-limit']} - {reset_time}" ) - time.sleep(reset_time) + time.sleep(int(response.headers["x-ratelimit-remaining"])) return True if response.status_code == 403: diff --git a/src/ghas_cli/utils/repositories.py b/src/ghas_cli/utils/repositories.py index 691b5a0..5b43697 100644 --- a/src/ghas_cli/utils/repositories.py +++ b/src/ghas_cli/utils/repositories.py @@ -231,6 +231,9 @@ def get_default_branch_last_updated( ) if branch_res.status_code != 200: + print(default_branch) + print(branch_res.json()) + print(branch_res.status_code) return False branch_res = branch_res.json() From 3af9b6408c54e58089a5d8752a882daeeca3c44f Mon Sep 17 00:00:00 2001 From: jboursier Date: Mon, 16 Jan 2023 11:42:13 +0100 Subject: [PATCH 18/29] Use a passed repository list instead of having to generate the list everytime Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/cli.py | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/src/cli.py b/src/cli.py index aff7cde..b5bb6a5 100644 --- a/src/cli.py +++ b/src/cli.py @@ -377,14 +377,15 @@ def repositories_create_dep_enforcement_pr( "--format", prompt="Output format", type=click.Choice( - ["human", "ghas", "json", "list"], + ["human", "list"], case_sensitive=False, ), - default="human", + default="list", ) @click.option( "-u", "--last_updated_before", prompt="Last updated before YYYY-MM-DD", type=str ) +@click.argument("input_repos_list", type=click.File("r")) @click.argument("output", type=click.File("w")) @click.option( "-t", @@ -400,6 +401,7 @@ def repositories_create_dep_enforcement_pr( def repositories_archivable( last_updated_before: str, format: str, + input_repos_list: Any, output: Any, organization: str, token: str, @@ -412,48 +414,40 @@ def repositories_archivable( click.echo(f"Invalid time: {last_updated_before}") return False - # 1. Get list of non-archived repositories - res = repositories.get_org_repositories( - status="internal", - organization=organization, - token=token, - language="", - default_branch="", - license="", - archived=False, - disabled=False, - ) + # 1. Get list repositories passed as argument + res = input_repos_list.readlines() print(len(res)) for repo in res: + repo = repo.rstrip("\n") + + # 2. get default branch + default_branch = repositories.get_default_branch( + organization=organization, token=token, repository=repo + ) + + # 3. get default branch last commit date branch_last_commit_date = repositories.get_default_branch_last_updated( token=token, organization=organization, - repository_name=repo.name, - default_branch=repo.default_branch, + repository_name=repo, + default_branch=default_branch, ) if not branch_last_commit_date: - click.echo(f"No branch last commit date for {repo.name}", err=True) + click.echo(f"No branch last commit date for {repo}", err=True) continue + # 4. Compare with the threshold if branch_last_commit_date > threshold_date: continue if "human" == format: output.write(repo + "\n") click.echo(repo) - elif "ghas" == format: - output.write( - json.dumps([{"login": organization, "repos": repo.to_ghas()}]) + "\n" - ) - click.echo([{"login": organization, "repos": repo.to_ghas()}]) - elif "json" == format: - output.write(json.dumps(repo.to_json()) + "\n") - click.echo(repo.to_json()) elif "list" == format: - output.write(repo.name + "\n") - click.echo(repo.name) + output.write(f"{repo}, {branch_last_commit_date.strftime('%Y-%m-%d')}\n") + click.echo(f"{repo}, {branch_last_commit_date.strftime('%Y-%m-%d')}") return True From a801642e89f3e175924e7b10f5aabb3356723671 Mon Sep 17 00:00:00 2001 From: jboursier Date: Mon, 16 Jan 2023 11:48:02 +0100 Subject: [PATCH 19/29] Remove debug lines Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/cli.py | 2 ++ src/ghas_cli/utils/repositories.py | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cli.py b/src/cli.py index b5bb6a5..5b98e45 100644 --- a/src/cli.py +++ b/src/cli.py @@ -426,6 +426,8 @@ def repositories_archivable( default_branch = repositories.get_default_branch( organization=organization, token=token, repository=repo ) + if not default_branch: + continue # 3. get default branch last commit date branch_last_commit_date = repositories.get_default_branch_last_updated( diff --git a/src/ghas_cli/utils/repositories.py b/src/ghas_cli/utils/repositories.py index 5b43697..691b5a0 100644 --- a/src/ghas_cli/utils/repositories.py +++ b/src/ghas_cli/utils/repositories.py @@ -231,9 +231,6 @@ def get_default_branch_last_updated( ) if branch_res.status_code != 200: - print(default_branch) - print(branch_res.json()) - print(branch_res.status_code) return False branch_res = branch_res.json() From 86df5f123dde14424bba6b10d02a2f76e14d220c Mon Sep 17 00:00:00 2001 From: jboursier Date: Mon, 16 Jan 2023 12:03:42 +0100 Subject: [PATCH 20/29] Pass X-GitHub-Api-Version header to use the new calendar versioning Close #58 Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/ghas_cli/utils/network.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ghas_cli/utils/network.py b/src/ghas_cli/utils/network.py index 81bdb16..4bec4f4 100644 --- a/src/ghas_cli/utils/network.py +++ b/src/ghas_cli/utils/network.py @@ -21,6 +21,7 @@ def get_github_headers(token: str) -> Dict: "accept": "application/vnd.github+json", "authorization": f"Bearer {token}", "User-Agent": "malwarebytes/bulk_enable_ghas", + "X-GitHub-Api-Version": "2022-11-28", # https://docs.github.com/en/rest/overview/api-versions#supported-api-versions } From 55888124a4d6a15deeedc9521c1b2bc8d1c4997a Mon Sep 17 00:00:00 2001 From: jboursier Date: Mon, 16 Jan 2023 12:53:11 +0100 Subject: [PATCH 21/29] Bump dependencies Signed-off-by: jboursier Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- Makefile | 2 +- poetry.lock | 121 +++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 103 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index e422527..d5a4bbd 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ shell: ## Generate the shell autocompletion _GHAS_CLI_COMPLETE=source_bash ghas-cli > ghas-cli-complete.sh || true deps: ## Fetch or update dependencies - $(POETRY) update --no-dev + $(POETRY) update --without dev help: @awk -F ':|##' '/^[^\t].+?:.*?##/ { printf "\033[36m%-30s\033[0m %s\n", $$1, $$NF }' $(MAKEFILE_LIST) | sort diff --git a/poetry.lock b/poetry.lock index 1d7a21f..4c75ec0 100644 --- a/poetry.lock +++ b/poetry.lock @@ -8,14 +8,11 @@ python-versions = ">=3.6" [[package]] name = "charset-normalizer" -version = "2.1.1" +version = "3.0.1" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." category = "main" optional = false -python-versions = ">=3.6.0" - -[package.extras] -unicode-backport = ["unicodedata2"] +python-versions = "*" [[package]] name = "click" @@ -59,7 +56,7 @@ python-versions = ">=3.5" [[package]] name = "importlib-metadata" -version = "5.1.0" +version = "6.0.0" description = "Read metadata from Python packages" category = "main" optional = false @@ -70,7 +67,7 @@ typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} zipp = ">=0.5" [package.extras] -docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)"] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] perf = ["ipython"] testing = ["flake8 (<5)", "flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)"] @@ -84,7 +81,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "requests" -version = "2.28.1" +version = "2.28.2" description = "Python HTTP for Humans." category = "main" optional = false @@ -92,13 +89,13 @@ python-versions = ">=3.7, <4" [package.dependencies] certifi = ">=2017.4.17" -charset-normalizer = ">=2,<3" +charset-normalizer = ">=2,<4" idna = ">=2.5,<4" urllib3 = ">=1.21.1,<1.27" [package.extras] socks = ["PySocks (>=1.5.6,!=1.5.7)"] -use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] +use_chardet_on_py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "typing-extensions" @@ -110,7 +107,7 @@ python-versions = ">=3.7" [[package]] name = "urllib3" -version = "1.26.13" +version = "1.26.14" description = "HTTP library with thread-safe connection pooling, file post, and more." category = "main" optional = false @@ -144,8 +141,94 @@ certifi = [ {file = "certifi-2022.12.7.tar.gz", hash = "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3"}, ] charset-normalizer = [ - {file = "charset-normalizer-2.1.1.tar.gz", hash = "sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845"}, - {file = "charset_normalizer-2.1.1-py3-none-any.whl", hash = "sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f"}, + {file = "charset-normalizer-3.0.1.tar.gz", hash = "sha256:ebea339af930f8ca5d7a699b921106c6e29c617fe9606fa7baa043c1cdae326f"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:88600c72ef7587fe1708fd242b385b6ed4b8904976d5da0893e31df8b3480cb6"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c75ffc45f25324e68ab238cb4b5c0a38cd1c3d7f1fb1f72b5541de469e2247db"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:db72b07027db150f468fbada4d85b3b2729a3db39178abf5c543b784c1254539"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:62595ab75873d50d57323a91dd03e6966eb79c41fa834b7a1661ed043b2d404d"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ff6f3db31555657f3163b15a6b7c6938d08df7adbfc9dd13d9d19edad678f1e8"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:772b87914ff1152b92a197ef4ea40efe27a378606c39446ded52c8f80f79702e"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:70990b9c51340e4044cfc394a81f614f3f90d41397104d226f21e66de668730d"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:292d5e8ba896bbfd6334b096e34bffb56161c81408d6d036a7dfa6929cff8783"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:2edb64ee7bf1ed524a1da60cdcd2e1f6e2b4f66ef7c077680739f1641f62f555"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:31a9ddf4718d10ae04d9b18801bd776693487cbb57d74cc3458a7673f6f34639"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:44ba614de5361b3e5278e1241fda3dc1838deed864b50a10d7ce92983797fa76"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:12db3b2c533c23ab812c2b25934f60383361f8a376ae272665f8e48b88e8e1c6"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c512accbd6ff0270939b9ac214b84fb5ada5f0409c44298361b2f5e13f9aed9e"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-win32.whl", hash = "sha256:502218f52498a36d6bf5ea77081844017bf7982cdbe521ad85e64cabee1b608b"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:601f36512f9e28f029d9481bdaf8e89e5148ac5d89cffd3b05cd533eeb423b59"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:0298eafff88c99982a4cf66ba2efa1128e4ddaca0b05eec4c456bbc7db691d8d"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a8d0fc946c784ff7f7c3742310cc8a57c5c6dc31631269876a88b809dbeff3d3"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:87701167f2a5c930b403e9756fab1d31d4d4da52856143b609e30a1ce7160f3c"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:14e76c0f23218b8f46c4d87018ca2e441535aed3632ca134b10239dfb6dadd6b"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0c0a590235ccd933d9892c627dec5bc7511ce6ad6c1011fdf5b11363022746c1"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8c7fe7afa480e3e82eed58e0ca89f751cd14d767638e2550c77a92a9e749c317"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:79909e27e8e4fcc9db4addea88aa63f6423ebb171db091fb4373e3312cb6d603"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8ac7b6a045b814cf0c47f3623d21ebd88b3e8cf216a14790b455ea7ff0135d18"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:72966d1b297c741541ca8cf1223ff262a6febe52481af742036a0b296e35fa5a"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:f9d0c5c045a3ca9bedfc35dca8526798eb91a07aa7a2c0fee134c6c6f321cbd7"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:5995f0164fa7df59db4746112fec3f49c461dd6b31b841873443bdb077c13cfc"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:4a8fcf28c05c1f6d7e177a9a46a1c52798bfe2ad80681d275b10dcf317deaf0b"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:761e8904c07ad053d285670f36dd94e1b6ab7f16ce62b9805c475b7aa1cffde6"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-win32.whl", hash = "sha256:71140351489970dfe5e60fc621ada3e0f41104a5eddaca47a7acb3c1b851d6d3"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:9ab77acb98eba3fd2a85cd160851816bfce6871d944d885febf012713f06659c"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:84c3990934bae40ea69a82034912ffe5a62c60bbf6ec5bc9691419641d7d5c9a"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:74292fc76c905c0ef095fe11e188a32ebd03bc38f3f3e9bcb85e4e6db177b7ea"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c95a03c79bbe30eec3ec2b7f076074f4281526724c8685a42872974ef4d36b72"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f4c39b0e3eac288fedc2b43055cfc2ca7a60362d0e5e87a637beac5d801ef478"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:df2c707231459e8a4028eabcd3cfc827befd635b3ef72eada84ab13b52e1574d"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:93ad6d87ac18e2a90b0fe89df7c65263b9a99a0eb98f0a3d2e079f12a0735837"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:59e5686dd847347e55dffcc191a96622f016bc0ad89105e24c14e0d6305acbc6"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:cd6056167405314a4dc3c173943f11249fa0f1b204f8b51ed4bde1a9cd1834dc"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_ppc64le.whl", hash = "sha256:083c8d17153ecb403e5e1eb76a7ef4babfc2c48d58899c98fcaa04833e7a2f9a"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_s390x.whl", hash = "sha256:f5057856d21e7586765171eac8b9fc3f7d44ef39425f85dbcccb13b3ebea806c"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:7eb33a30d75562222b64f569c642ff3dc6689e09adda43a082208397f016c39a"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-win32.whl", hash = "sha256:95dea361dd73757c6f1c0a1480ac499952c16ac83f7f5f4f84f0658a01b8ef41"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:eaa379fcd227ca235d04152ca6704c7cb55564116f8bc52545ff357628e10602"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:3e45867f1f2ab0711d60c6c71746ac53537f1684baa699f4f668d4c6f6ce8e14"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cadaeaba78750d58d3cc6ac4d1fd867da6fc73c88156b7a3212a3cd4819d679d"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:911d8a40b2bef5b8bbae2e36a0b103f142ac53557ab421dc16ac4aafee6f53dc"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:503e65837c71b875ecdd733877d852adbc465bd82c768a067badd953bf1bc5a3"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a60332922359f920193b1d4826953c507a877b523b2395ad7bc716ddd386d866"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:16a8663d6e281208d78806dbe14ee9903715361cf81f6d4309944e4d1e59ac5b"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:a16418ecf1329f71df119e8a65f3aa68004a3f9383821edcb20f0702934d8087"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:9d9153257a3f70d5f69edf2325357251ed20f772b12e593f3b3377b5f78e7ef8"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:02a51034802cbf38db3f89c66fb5d2ec57e6fe7ef2f4a44d070a593c3688667b"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:2e396d70bc4ef5325b72b593a72c8979999aa52fb8bcf03f701c1b03e1166918"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:11b53acf2411c3b09e6af37e4b9005cba376c872503c8f28218c7243582df45d"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-win32.whl", hash = "sha256:0bf2dae5291758b6f84cf923bfaa285632816007db0330002fa1de38bfcb7154"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:2c03cc56021a4bd59be889c2b9257dae13bf55041a3372d3295416f86b295fb5"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:024e606be3ed92216e2b6952ed859d86b4cfa52cd5bc5f050e7dc28f9b43ec42"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:4b0d02d7102dd0f997580b51edc4cebcf2ab6397a7edf89f1c73b586c614272c"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:358a7c4cb8ba9b46c453b1dd8d9e431452d5249072e4f56cfda3149f6ab1405e"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:81d6741ab457d14fdedc215516665050f3822d3e56508921cc7239f8c8e66a58"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8b8af03d2e37866d023ad0ddea594edefc31e827fee64f8de5611a1dbc373174"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9cf4e8ad252f7c38dd1f676b46514f92dc0ebeb0db5552f5f403509705e24753"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e696f0dd336161fca9adbb846875d40752e6eba585843c768935ba5c9960722b"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c22d3fe05ce11d3671297dc8973267daa0f938b93ec716e12e0f6dee81591dc1"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:109487860ef6a328f3eec66f2bf78b0b72400280d8f8ea05f69c51644ba6521a"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:37f8febc8ec50c14f3ec9637505f28e58d4f66752207ea177c1d67df25da5aed"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:f97e83fa6c25693c7a35de154681fcc257c1c41b38beb0304b9c4d2d9e164479"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:a152f5f33d64a6be73f1d30c9cc82dfc73cec6477ec268e7c6e4c7d23c2d2291"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:39049da0ffb96c8cbb65cbf5c5f3ca3168990adf3551bd1dee10c48fce8ae820"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-win32.whl", hash = "sha256:4457ea6774b5611f4bed5eaa5df55f70abde42364d498c5134b7ef4c6958e20e"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:e62164b50f84e20601c1ff8eb55620d2ad25fb81b59e3cd776a1902527a788af"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:8eade758719add78ec36dc13201483f8e9b5d940329285edcd5f70c0a9edbd7f"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8499ca8f4502af841f68135133d8258f7b32a53a1d594aa98cc52013fff55678"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3fc1c4a2ffd64890aebdb3f97e1278b0cc72579a08ca4de8cd2c04799a3a22be"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:00d3ffdaafe92a5dc603cb9bd5111aaa36dfa187c8285c543be562e61b755f6b"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c2ac1b08635a8cd4e0cbeaf6f5e922085908d48eb05d44c5ae9eabab148512ca"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f6f45710b4459401609ebebdbcfb34515da4fc2aa886f95107f556ac69a9147e"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3ae1de54a77dc0d6d5fcf623290af4266412a7c4be0b1ff7444394f03f5c54e3"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3b590df687e3c5ee0deef9fc8c547d81986d9a1b56073d82de008744452d6541"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:ab5de034a886f616a5668aa5d098af2b5385ed70142090e2a31bcbd0af0fdb3d"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9cb3032517f1627cc012dbc80a8ec976ae76d93ea2b5feaa9d2a5b8882597579"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:608862a7bf6957f2333fc54ab4399e405baad0163dc9f8d99cb236816db169d4"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:0f438ae3532723fb6ead77e7c604be7c8374094ef4ee2c5e03a3a17f1fca256c"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:356541bf4381fa35856dafa6a965916e54bed415ad8a24ee6de6e37deccf2786"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-win32.whl", hash = "sha256:39cf9ed17fe3b1bc81f33c9ceb6ce67683ee7526e65fde1447c772afc54a1bb8"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:0a11e971ed097d24c534c037d298ad32c6ce81a45736d31e0ff0ad37ab437d59"}, + {file = "charset_normalizer-3.0.1-py3-none-any.whl", hash = "sha256:7e189e2e1d3ed2f4aebabd2d5b0f931e883676e51c7624826e0a4e5fe8a0bf24"}, ] click = [ {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, @@ -164,24 +247,24 @@ idna = [ {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, ] importlib-metadata = [ - {file = "importlib_metadata-5.1.0-py3-none-any.whl", hash = "sha256:d84d17e21670ec07990e1044a99efe8d615d860fd176fc29ef5c306068fda313"}, - {file = "importlib_metadata-5.1.0.tar.gz", hash = "sha256:d5059f9f1e8e41f80e9c56c2ee58811450c31984dfa625329ffd7c0dad88a73b"}, + {file = "importlib_metadata-6.0.0-py3-none-any.whl", hash = "sha256:7efb448ec9a5e313a57655d35aa54cd3e01b7e1fbcf72dce1bf06119420f5bad"}, + {file = "importlib_metadata-6.0.0.tar.gz", hash = "sha256:e354bedeb60efa6affdcc8ae121b73544a7aa74156d047311948f6d711cd378d"}, ] python-magic = [ {file = "python-magic-0.4.27.tar.gz", hash = "sha256:c1ba14b08e4a5f5c31a302b7721239695b2f0f058d125bd5ce1ee36b9d9d3c3b"}, {file = "python_magic-0.4.27-py2.py3-none-any.whl", hash = "sha256:c212960ad306f700aa0d01e5d7a325d20548ff97eb9920dcd29513174f0294d3"}, ] requests = [ - {file = "requests-2.28.1-py3-none-any.whl", hash = "sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349"}, - {file = "requests-2.28.1.tar.gz", hash = "sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983"}, + {file = "requests-2.28.2-py3-none-any.whl", hash = "sha256:64299f4909223da747622c030b781c0d7811e359c37124b4bd368fb8c6518baa"}, + {file = "requests-2.28.2.tar.gz", hash = "sha256:98b1b2782e3c6c4904938b84c0eb932721069dfdb9134313beff7c83c2df24bf"}, ] typing-extensions = [ {file = "typing_extensions-4.4.0-py3-none-any.whl", hash = "sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e"}, {file = "typing_extensions-4.4.0.tar.gz", hash = "sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa"}, ] urllib3 = [ - {file = "urllib3-1.26.13-py2.py3-none-any.whl", hash = "sha256:47cc05d99aaa09c9e72ed5809b60e7ba354e64b59c9c173ac3018642d8bb41fc"}, - {file = "urllib3-1.26.13.tar.gz", hash = "sha256:c083dd0dce68dbfbe1129d5271cb90f9447dea7d52097c6e0126120c521ddea8"}, + {file = "urllib3-1.26.14-py2.py3-none-any.whl", hash = "sha256:75edcdc2f7d85b137124a6c3c9fc3933cdeaa12ecb9a6a959f22797a0feca7e1"}, + {file = "urllib3-1.26.14.tar.gz", hash = "sha256:076907bf8fd355cde77728471316625a4d2f7e713c125f51953bb5b3eecf4f72"}, ] zipp = [ {file = "zipp-3.11.0-py3-none-any.whl", hash = "sha256:83a28fcb75844b5c0cdaf5aa4003c2d728c77e05f5aeabe8e95e56727005fbaa"}, From 49762f1a2d892215ab46ecf39552ea27def1cca6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Mar 2023 20:03:36 +0000 Subject: [PATCH 22/29] Bump urllib3 from 1.26.14 to 1.26.15 Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.14 to 1.26.15. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/1.26.14...1.26.15) --- updated-dependencies: - dependency-name: urllib3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- poetry.lock | 278 ++++++++++++++++++++++++++-------------------------- 1 file changed, 139 insertions(+), 139 deletions(-) diff --git a/poetry.lock b/poetry.lock index 4c75ec0..84e8d4c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Poetry and should not be changed by hand. + [[package]] name = "certifi" version = "2022.12.7" @@ -5,6 +7,10 @@ description = "Python package for providing Mozilla's CA Bundle." category = "main" optional = false python-versions = ">=3.6" +files = [ + {file = "certifi-2022.12.7-py3-none-any.whl", hash = "sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18"}, + {file = "certifi-2022.12.7.tar.gz", hash = "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3"}, +] [[package]] name = "charset-normalizer" @@ -13,6 +19,96 @@ description = "The Real First Universal Charset Detector. Open, modern and activ category = "main" optional = false python-versions = "*" +files = [ + {file = "charset-normalizer-3.0.1.tar.gz", hash = "sha256:ebea339af930f8ca5d7a699b921106c6e29c617fe9606fa7baa043c1cdae326f"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:88600c72ef7587fe1708fd242b385b6ed4b8904976d5da0893e31df8b3480cb6"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c75ffc45f25324e68ab238cb4b5c0a38cd1c3d7f1fb1f72b5541de469e2247db"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:db72b07027db150f468fbada4d85b3b2729a3db39178abf5c543b784c1254539"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:62595ab75873d50d57323a91dd03e6966eb79c41fa834b7a1661ed043b2d404d"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ff6f3db31555657f3163b15a6b7c6938d08df7adbfc9dd13d9d19edad678f1e8"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:772b87914ff1152b92a197ef4ea40efe27a378606c39446ded52c8f80f79702e"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:70990b9c51340e4044cfc394a81f614f3f90d41397104d226f21e66de668730d"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:292d5e8ba896bbfd6334b096e34bffb56161c81408d6d036a7dfa6929cff8783"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:2edb64ee7bf1ed524a1da60cdcd2e1f6e2b4f66ef7c077680739f1641f62f555"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:31a9ddf4718d10ae04d9b18801bd776693487cbb57d74cc3458a7673f6f34639"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:44ba614de5361b3e5278e1241fda3dc1838deed864b50a10d7ce92983797fa76"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:12db3b2c533c23ab812c2b25934f60383361f8a376ae272665f8e48b88e8e1c6"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c512accbd6ff0270939b9ac214b84fb5ada5f0409c44298361b2f5e13f9aed9e"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-win32.whl", hash = "sha256:502218f52498a36d6bf5ea77081844017bf7982cdbe521ad85e64cabee1b608b"}, + {file = "charset_normalizer-3.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:601f36512f9e28f029d9481bdaf8e89e5148ac5d89cffd3b05cd533eeb423b59"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:0298eafff88c99982a4cf66ba2efa1128e4ddaca0b05eec4c456bbc7db691d8d"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a8d0fc946c784ff7f7c3742310cc8a57c5c6dc31631269876a88b809dbeff3d3"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:87701167f2a5c930b403e9756fab1d31d4d4da52856143b609e30a1ce7160f3c"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:14e76c0f23218b8f46c4d87018ca2e441535aed3632ca134b10239dfb6dadd6b"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0c0a590235ccd933d9892c627dec5bc7511ce6ad6c1011fdf5b11363022746c1"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8c7fe7afa480e3e82eed58e0ca89f751cd14d767638e2550c77a92a9e749c317"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:79909e27e8e4fcc9db4addea88aa63f6423ebb171db091fb4373e3312cb6d603"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8ac7b6a045b814cf0c47f3623d21ebd88b3e8cf216a14790b455ea7ff0135d18"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:72966d1b297c741541ca8cf1223ff262a6febe52481af742036a0b296e35fa5a"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:f9d0c5c045a3ca9bedfc35dca8526798eb91a07aa7a2c0fee134c6c6f321cbd7"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:5995f0164fa7df59db4746112fec3f49c461dd6b31b841873443bdb077c13cfc"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:4a8fcf28c05c1f6d7e177a9a46a1c52798bfe2ad80681d275b10dcf317deaf0b"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:761e8904c07ad053d285670f36dd94e1b6ab7f16ce62b9805c475b7aa1cffde6"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-win32.whl", hash = "sha256:71140351489970dfe5e60fc621ada3e0f41104a5eddaca47a7acb3c1b851d6d3"}, + {file = "charset_normalizer-3.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:9ab77acb98eba3fd2a85cd160851816bfce6871d944d885febf012713f06659c"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:84c3990934bae40ea69a82034912ffe5a62c60bbf6ec5bc9691419641d7d5c9a"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:74292fc76c905c0ef095fe11e188a32ebd03bc38f3f3e9bcb85e4e6db177b7ea"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c95a03c79bbe30eec3ec2b7f076074f4281526724c8685a42872974ef4d36b72"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f4c39b0e3eac288fedc2b43055cfc2ca7a60362d0e5e87a637beac5d801ef478"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:df2c707231459e8a4028eabcd3cfc827befd635b3ef72eada84ab13b52e1574d"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:93ad6d87ac18e2a90b0fe89df7c65263b9a99a0eb98f0a3d2e079f12a0735837"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:59e5686dd847347e55dffcc191a96622f016bc0ad89105e24c14e0d6305acbc6"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:cd6056167405314a4dc3c173943f11249fa0f1b204f8b51ed4bde1a9cd1834dc"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_ppc64le.whl", hash = "sha256:083c8d17153ecb403e5e1eb76a7ef4babfc2c48d58899c98fcaa04833e7a2f9a"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_s390x.whl", hash = "sha256:f5057856d21e7586765171eac8b9fc3f7d44ef39425f85dbcccb13b3ebea806c"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:7eb33a30d75562222b64f569c642ff3dc6689e09adda43a082208397f016c39a"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-win32.whl", hash = "sha256:95dea361dd73757c6f1c0a1480ac499952c16ac83f7f5f4f84f0658a01b8ef41"}, + {file = "charset_normalizer-3.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:eaa379fcd227ca235d04152ca6704c7cb55564116f8bc52545ff357628e10602"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:3e45867f1f2ab0711d60c6c71746ac53537f1684baa699f4f668d4c6f6ce8e14"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cadaeaba78750d58d3cc6ac4d1fd867da6fc73c88156b7a3212a3cd4819d679d"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:911d8a40b2bef5b8bbae2e36a0b103f142ac53557ab421dc16ac4aafee6f53dc"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:503e65837c71b875ecdd733877d852adbc465bd82c768a067badd953bf1bc5a3"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a60332922359f920193b1d4826953c507a877b523b2395ad7bc716ddd386d866"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:16a8663d6e281208d78806dbe14ee9903715361cf81f6d4309944e4d1e59ac5b"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:a16418ecf1329f71df119e8a65f3aa68004a3f9383821edcb20f0702934d8087"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:9d9153257a3f70d5f69edf2325357251ed20f772b12e593f3b3377b5f78e7ef8"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:02a51034802cbf38db3f89c66fb5d2ec57e6fe7ef2f4a44d070a593c3688667b"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:2e396d70bc4ef5325b72b593a72c8979999aa52fb8bcf03f701c1b03e1166918"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:11b53acf2411c3b09e6af37e4b9005cba376c872503c8f28218c7243582df45d"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-win32.whl", hash = "sha256:0bf2dae5291758b6f84cf923bfaa285632816007db0330002fa1de38bfcb7154"}, + {file = "charset_normalizer-3.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:2c03cc56021a4bd59be889c2b9257dae13bf55041a3372d3295416f86b295fb5"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:024e606be3ed92216e2b6952ed859d86b4cfa52cd5bc5f050e7dc28f9b43ec42"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:4b0d02d7102dd0f997580b51edc4cebcf2ab6397a7edf89f1c73b586c614272c"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:358a7c4cb8ba9b46c453b1dd8d9e431452d5249072e4f56cfda3149f6ab1405e"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:81d6741ab457d14fdedc215516665050f3822d3e56508921cc7239f8c8e66a58"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8b8af03d2e37866d023ad0ddea594edefc31e827fee64f8de5611a1dbc373174"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9cf4e8ad252f7c38dd1f676b46514f92dc0ebeb0db5552f5f403509705e24753"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e696f0dd336161fca9adbb846875d40752e6eba585843c768935ba5c9960722b"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c22d3fe05ce11d3671297dc8973267daa0f938b93ec716e12e0f6dee81591dc1"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:109487860ef6a328f3eec66f2bf78b0b72400280d8f8ea05f69c51644ba6521a"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:37f8febc8ec50c14f3ec9637505f28e58d4f66752207ea177c1d67df25da5aed"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:f97e83fa6c25693c7a35de154681fcc257c1c41b38beb0304b9c4d2d9e164479"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:a152f5f33d64a6be73f1d30c9cc82dfc73cec6477ec268e7c6e4c7d23c2d2291"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:39049da0ffb96c8cbb65cbf5c5f3ca3168990adf3551bd1dee10c48fce8ae820"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-win32.whl", hash = "sha256:4457ea6774b5611f4bed5eaa5df55f70abde42364d498c5134b7ef4c6958e20e"}, + {file = "charset_normalizer-3.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:e62164b50f84e20601c1ff8eb55620d2ad25fb81b59e3cd776a1902527a788af"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:8eade758719add78ec36dc13201483f8e9b5d940329285edcd5f70c0a9edbd7f"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8499ca8f4502af841f68135133d8258f7b32a53a1d594aa98cc52013fff55678"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3fc1c4a2ffd64890aebdb3f97e1278b0cc72579a08ca4de8cd2c04799a3a22be"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:00d3ffdaafe92a5dc603cb9bd5111aaa36dfa187c8285c543be562e61b755f6b"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c2ac1b08635a8cd4e0cbeaf6f5e922085908d48eb05d44c5ae9eabab148512ca"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f6f45710b4459401609ebebdbcfb34515da4fc2aa886f95107f556ac69a9147e"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3ae1de54a77dc0d6d5fcf623290af4266412a7c4be0b1ff7444394f03f5c54e3"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3b590df687e3c5ee0deef9fc8c547d81986d9a1b56073d82de008744452d6541"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:ab5de034a886f616a5668aa5d098af2b5385ed70142090e2a31bcbd0af0fdb3d"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9cb3032517f1627cc012dbc80a8ec976ae76d93ea2b5feaa9d2a5b8882597579"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:608862a7bf6957f2333fc54ab4399e405baad0163dc9f8d99cb236816db169d4"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:0f438ae3532723fb6ead77e7c604be7c8374094ef4ee2c5e03a3a17f1fca256c"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:356541bf4381fa35856dafa6a965916e54bed415ad8a24ee6de6e37deccf2786"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-win32.whl", hash = "sha256:39cf9ed17fe3b1bc81f33c9ceb6ce67683ee7526e65fde1447c772afc54a1bb8"}, + {file = "charset_normalizer-3.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:0a11e971ed097d24c534c037d298ad32c6ce81a45736d31e0ff0ad37ab437d59"}, + {file = "charset_normalizer-3.0.1-py3-none-any.whl", hash = "sha256:7e189e2e1d3ed2f4aebabd2d5b0f931e883676e51c7624826e0a4e5fe8a0bf24"}, +] [[package]] name = "click" @@ -21,6 +117,10 @@ description = "Composable command line interface toolkit" category = "main" optional = false python-versions = ">=3.7" +files = [ + {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, + {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, +] [package.dependencies] colorama = {version = "*", markers = "platform_system == \"Windows\""} @@ -33,6 +133,10 @@ description = "Cross-platform colored terminal text." category = "main" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] [[package]] name = "configparser" @@ -41,6 +145,10 @@ description = "Updated configparser from stdlib for earlier Pythons." category = "main" optional = false python-versions = ">=3.7" +files = [ + {file = "configparser-5.3.0-py3-none-any.whl", hash = "sha256:b065779fd93c6bf4cee42202fa4351b4bb842e96a3fb469440e484517a49b9fa"}, + {file = "configparser-5.3.0.tar.gz", hash = "sha256:8be267824b541c09b08db124917f48ab525a6c3e837011f3130781a224c57090"}, +] [package.extras] docs = ["jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx"] @@ -53,6 +161,10 @@ description = "Internationalized Domain Names in Applications (IDNA)" category = "main" optional = false python-versions = ">=3.5" +files = [ + {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, + {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, +] [[package]] name = "importlib-metadata" @@ -61,6 +173,10 @@ description = "Read metadata from Python packages" category = "main" optional = false python-versions = ">=3.7" +files = [ + {file = "importlib_metadata-6.0.0-py3-none-any.whl", hash = "sha256:7efb448ec9a5e313a57655d35aa54cd3e01b7e1fbcf72dce1bf06119420f5bad"}, + {file = "importlib_metadata-6.0.0.tar.gz", hash = "sha256:e354bedeb60efa6affdcc8ae121b73544a7aa74156d047311948f6d711cd378d"}, +] [package.dependencies] typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} @@ -78,6 +194,10 @@ description = "File type identification using libmagic" category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +files = [ + {file = "python-magic-0.4.27.tar.gz", hash = "sha256:c1ba14b08e4a5f5c31a302b7721239695b2f0f058d125bd5ce1ee36b9d9d3c3b"}, + {file = "python_magic-0.4.27-py2.py3-none-any.whl", hash = "sha256:c212960ad306f700aa0d01e5d7a325d20548ff97eb9920dcd29513174f0294d3"}, +] [[package]] name = "requests" @@ -86,6 +206,10 @@ description = "Python HTTP for Humans." category = "main" optional = false python-versions = ">=3.7, <4" +files = [ + {file = "requests-2.28.2-py3-none-any.whl", hash = "sha256:64299f4909223da747622c030b781c0d7811e359c37124b4bd368fb8c6518baa"}, + {file = "requests-2.28.2.tar.gz", hash = "sha256:98b1b2782e3c6c4904938b84c0eb932721069dfdb9134313beff7c83c2df24bf"}, +] [package.dependencies] certifi = ">=2017.4.17" @@ -95,7 +219,7 @@ urllib3 = ">=1.21.1,<1.27" [package.extras] socks = ["PySocks (>=1.5.6,!=1.5.7)"] -use_chardet_on_py3 = ["chardet (>=3.0.2,<6)"] +use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "typing-extensions" @@ -104,14 +228,22 @@ description = "Backported and Experimental Type Hints for Python 3.7+" category = "main" optional = false python-versions = ">=3.7" +files = [ + {file = "typing_extensions-4.4.0-py3-none-any.whl", hash = "sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e"}, + {file = "typing_extensions-4.4.0.tar.gz", hash = "sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa"}, +] [[package]] name = "urllib3" -version = "1.26.14" +version = "1.26.15" description = "HTTP library with thread-safe connection pooling, file post, and more." category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" +files = [ + {file = "urllib3-1.26.15-py2.py3-none-any.whl", hash = "sha256:aa751d169e23c7479ce47a0cb0da579e3ede798f994f5816a74e4f4500dcea42"}, + {file = "urllib3-1.26.15.tar.gz", hash = "sha256:8a388717b9476f934a21484e8c8e61875ab60644d29b9b39e11e4b9dc1c6b305"}, +] [package.extras] brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"] @@ -125,148 +257,16 @@ description = "Backport of pathlib-compatible object wrapper for zip files" category = "main" optional = false python-versions = ">=3.7" +files = [ + {file = "zipp-3.11.0-py3-none-any.whl", hash = "sha256:83a28fcb75844b5c0cdaf5aa4003c2d728c77e05f5aeabe8e95e56727005fbaa"}, + {file = "zipp-3.11.0.tar.gz", hash = "sha256:a7a22e05929290a67401440b39690ae6563279bced5f314609d9d03798f56766"}, +] [package.extras] docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)"] testing = ["flake8 (<5)", "func-timeout", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"] [metadata] -lock-version = "1.1" +lock-version = "2.0" python-versions = ">=3.7,<4" content-hash = "1c3e8a6f2a50dbe4d9e487d62377b26e82174e64b96cad03d56cdb931e42df2a" - -[metadata.files] -certifi = [ - {file = "certifi-2022.12.7-py3-none-any.whl", hash = "sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18"}, - {file = "certifi-2022.12.7.tar.gz", hash = "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3"}, -] -charset-normalizer = [ - {file = "charset-normalizer-3.0.1.tar.gz", hash = "sha256:ebea339af930f8ca5d7a699b921106c6e29c617fe9606fa7baa043c1cdae326f"}, - {file = "charset_normalizer-3.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:88600c72ef7587fe1708fd242b385b6ed4b8904976d5da0893e31df8b3480cb6"}, - {file = "charset_normalizer-3.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c75ffc45f25324e68ab238cb4b5c0a38cd1c3d7f1fb1f72b5541de469e2247db"}, - {file = "charset_normalizer-3.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:db72b07027db150f468fbada4d85b3b2729a3db39178abf5c543b784c1254539"}, - {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:62595ab75873d50d57323a91dd03e6966eb79c41fa834b7a1661ed043b2d404d"}, - {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ff6f3db31555657f3163b15a6b7c6938d08df7adbfc9dd13d9d19edad678f1e8"}, - {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:772b87914ff1152b92a197ef4ea40efe27a378606c39446ded52c8f80f79702e"}, - {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:70990b9c51340e4044cfc394a81f614f3f90d41397104d226f21e66de668730d"}, - {file = "charset_normalizer-3.0.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:292d5e8ba896bbfd6334b096e34bffb56161c81408d6d036a7dfa6929cff8783"}, - {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:2edb64ee7bf1ed524a1da60cdcd2e1f6e2b4f66ef7c077680739f1641f62f555"}, - {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:31a9ddf4718d10ae04d9b18801bd776693487cbb57d74cc3458a7673f6f34639"}, - {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:44ba614de5361b3e5278e1241fda3dc1838deed864b50a10d7ce92983797fa76"}, - {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:12db3b2c533c23ab812c2b25934f60383361f8a376ae272665f8e48b88e8e1c6"}, - {file = "charset_normalizer-3.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c512accbd6ff0270939b9ac214b84fb5ada5f0409c44298361b2f5e13f9aed9e"}, - {file = "charset_normalizer-3.0.1-cp310-cp310-win32.whl", hash = "sha256:502218f52498a36d6bf5ea77081844017bf7982cdbe521ad85e64cabee1b608b"}, - {file = "charset_normalizer-3.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:601f36512f9e28f029d9481bdaf8e89e5148ac5d89cffd3b05cd533eeb423b59"}, - {file = "charset_normalizer-3.0.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:0298eafff88c99982a4cf66ba2efa1128e4ddaca0b05eec4c456bbc7db691d8d"}, - {file = "charset_normalizer-3.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a8d0fc946c784ff7f7c3742310cc8a57c5c6dc31631269876a88b809dbeff3d3"}, - {file = "charset_normalizer-3.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:87701167f2a5c930b403e9756fab1d31d4d4da52856143b609e30a1ce7160f3c"}, - {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:14e76c0f23218b8f46c4d87018ca2e441535aed3632ca134b10239dfb6dadd6b"}, - {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0c0a590235ccd933d9892c627dec5bc7511ce6ad6c1011fdf5b11363022746c1"}, - {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8c7fe7afa480e3e82eed58e0ca89f751cd14d767638e2550c77a92a9e749c317"}, - {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:79909e27e8e4fcc9db4addea88aa63f6423ebb171db091fb4373e3312cb6d603"}, - {file = "charset_normalizer-3.0.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8ac7b6a045b814cf0c47f3623d21ebd88b3e8cf216a14790b455ea7ff0135d18"}, - {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:72966d1b297c741541ca8cf1223ff262a6febe52481af742036a0b296e35fa5a"}, - {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:f9d0c5c045a3ca9bedfc35dca8526798eb91a07aa7a2c0fee134c6c6f321cbd7"}, - {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:5995f0164fa7df59db4746112fec3f49c461dd6b31b841873443bdb077c13cfc"}, - {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:4a8fcf28c05c1f6d7e177a9a46a1c52798bfe2ad80681d275b10dcf317deaf0b"}, - {file = "charset_normalizer-3.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:761e8904c07ad053d285670f36dd94e1b6ab7f16ce62b9805c475b7aa1cffde6"}, - {file = "charset_normalizer-3.0.1-cp311-cp311-win32.whl", hash = "sha256:71140351489970dfe5e60fc621ada3e0f41104a5eddaca47a7acb3c1b851d6d3"}, - {file = "charset_normalizer-3.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:9ab77acb98eba3fd2a85cd160851816bfce6871d944d885febf012713f06659c"}, - {file = "charset_normalizer-3.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:84c3990934bae40ea69a82034912ffe5a62c60bbf6ec5bc9691419641d7d5c9a"}, - {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:74292fc76c905c0ef095fe11e188a32ebd03bc38f3f3e9bcb85e4e6db177b7ea"}, - {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c95a03c79bbe30eec3ec2b7f076074f4281526724c8685a42872974ef4d36b72"}, - {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f4c39b0e3eac288fedc2b43055cfc2ca7a60362d0e5e87a637beac5d801ef478"}, - {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:df2c707231459e8a4028eabcd3cfc827befd635b3ef72eada84ab13b52e1574d"}, - {file = "charset_normalizer-3.0.1-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:93ad6d87ac18e2a90b0fe89df7c65263b9a99a0eb98f0a3d2e079f12a0735837"}, - {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:59e5686dd847347e55dffcc191a96622f016bc0ad89105e24c14e0d6305acbc6"}, - {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:cd6056167405314a4dc3c173943f11249fa0f1b204f8b51ed4bde1a9cd1834dc"}, - {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_ppc64le.whl", hash = "sha256:083c8d17153ecb403e5e1eb76a7ef4babfc2c48d58899c98fcaa04833e7a2f9a"}, - {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_s390x.whl", hash = "sha256:f5057856d21e7586765171eac8b9fc3f7d44ef39425f85dbcccb13b3ebea806c"}, - {file = "charset_normalizer-3.0.1-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:7eb33a30d75562222b64f569c642ff3dc6689e09adda43a082208397f016c39a"}, - {file = "charset_normalizer-3.0.1-cp36-cp36m-win32.whl", hash = "sha256:95dea361dd73757c6f1c0a1480ac499952c16ac83f7f5f4f84f0658a01b8ef41"}, - {file = "charset_normalizer-3.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:eaa379fcd227ca235d04152ca6704c7cb55564116f8bc52545ff357628e10602"}, - {file = "charset_normalizer-3.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:3e45867f1f2ab0711d60c6c71746ac53537f1684baa699f4f668d4c6f6ce8e14"}, - {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cadaeaba78750d58d3cc6ac4d1fd867da6fc73c88156b7a3212a3cd4819d679d"}, - {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:911d8a40b2bef5b8bbae2e36a0b103f142ac53557ab421dc16ac4aafee6f53dc"}, - {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:503e65837c71b875ecdd733877d852adbc465bd82c768a067badd953bf1bc5a3"}, - {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a60332922359f920193b1d4826953c507a877b523b2395ad7bc716ddd386d866"}, - {file = "charset_normalizer-3.0.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:16a8663d6e281208d78806dbe14ee9903715361cf81f6d4309944e4d1e59ac5b"}, - {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:a16418ecf1329f71df119e8a65f3aa68004a3f9383821edcb20f0702934d8087"}, - {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:9d9153257a3f70d5f69edf2325357251ed20f772b12e593f3b3377b5f78e7ef8"}, - {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:02a51034802cbf38db3f89c66fb5d2ec57e6fe7ef2f4a44d070a593c3688667b"}, - {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:2e396d70bc4ef5325b72b593a72c8979999aa52fb8bcf03f701c1b03e1166918"}, - {file = "charset_normalizer-3.0.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:11b53acf2411c3b09e6af37e4b9005cba376c872503c8f28218c7243582df45d"}, - {file = "charset_normalizer-3.0.1-cp37-cp37m-win32.whl", hash = "sha256:0bf2dae5291758b6f84cf923bfaa285632816007db0330002fa1de38bfcb7154"}, - {file = "charset_normalizer-3.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:2c03cc56021a4bd59be889c2b9257dae13bf55041a3372d3295416f86b295fb5"}, - {file = "charset_normalizer-3.0.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:024e606be3ed92216e2b6952ed859d86b4cfa52cd5bc5f050e7dc28f9b43ec42"}, - {file = "charset_normalizer-3.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:4b0d02d7102dd0f997580b51edc4cebcf2ab6397a7edf89f1c73b586c614272c"}, - {file = "charset_normalizer-3.0.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:358a7c4cb8ba9b46c453b1dd8d9e431452d5249072e4f56cfda3149f6ab1405e"}, - {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:81d6741ab457d14fdedc215516665050f3822d3e56508921cc7239f8c8e66a58"}, - {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8b8af03d2e37866d023ad0ddea594edefc31e827fee64f8de5611a1dbc373174"}, - {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9cf4e8ad252f7c38dd1f676b46514f92dc0ebeb0db5552f5f403509705e24753"}, - {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e696f0dd336161fca9adbb846875d40752e6eba585843c768935ba5c9960722b"}, - {file = "charset_normalizer-3.0.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c22d3fe05ce11d3671297dc8973267daa0f938b93ec716e12e0f6dee81591dc1"}, - {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:109487860ef6a328f3eec66f2bf78b0b72400280d8f8ea05f69c51644ba6521a"}, - {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:37f8febc8ec50c14f3ec9637505f28e58d4f66752207ea177c1d67df25da5aed"}, - {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:f97e83fa6c25693c7a35de154681fcc257c1c41b38beb0304b9c4d2d9e164479"}, - {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:a152f5f33d64a6be73f1d30c9cc82dfc73cec6477ec268e7c6e4c7d23c2d2291"}, - {file = "charset_normalizer-3.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:39049da0ffb96c8cbb65cbf5c5f3ca3168990adf3551bd1dee10c48fce8ae820"}, - {file = "charset_normalizer-3.0.1-cp38-cp38-win32.whl", hash = "sha256:4457ea6774b5611f4bed5eaa5df55f70abde42364d498c5134b7ef4c6958e20e"}, - {file = "charset_normalizer-3.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:e62164b50f84e20601c1ff8eb55620d2ad25fb81b59e3cd776a1902527a788af"}, - {file = "charset_normalizer-3.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:8eade758719add78ec36dc13201483f8e9b5d940329285edcd5f70c0a9edbd7f"}, - {file = "charset_normalizer-3.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8499ca8f4502af841f68135133d8258f7b32a53a1d594aa98cc52013fff55678"}, - {file = "charset_normalizer-3.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3fc1c4a2ffd64890aebdb3f97e1278b0cc72579a08ca4de8cd2c04799a3a22be"}, - {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:00d3ffdaafe92a5dc603cb9bd5111aaa36dfa187c8285c543be562e61b755f6b"}, - {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c2ac1b08635a8cd4e0cbeaf6f5e922085908d48eb05d44c5ae9eabab148512ca"}, - {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f6f45710b4459401609ebebdbcfb34515da4fc2aa886f95107f556ac69a9147e"}, - {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3ae1de54a77dc0d6d5fcf623290af4266412a7c4be0b1ff7444394f03f5c54e3"}, - {file = "charset_normalizer-3.0.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3b590df687e3c5ee0deef9fc8c547d81986d9a1b56073d82de008744452d6541"}, - {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:ab5de034a886f616a5668aa5d098af2b5385ed70142090e2a31bcbd0af0fdb3d"}, - {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9cb3032517f1627cc012dbc80a8ec976ae76d93ea2b5feaa9d2a5b8882597579"}, - {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:608862a7bf6957f2333fc54ab4399e405baad0163dc9f8d99cb236816db169d4"}, - {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:0f438ae3532723fb6ead77e7c604be7c8374094ef4ee2c5e03a3a17f1fca256c"}, - {file = "charset_normalizer-3.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:356541bf4381fa35856dafa6a965916e54bed415ad8a24ee6de6e37deccf2786"}, - {file = "charset_normalizer-3.0.1-cp39-cp39-win32.whl", hash = "sha256:39cf9ed17fe3b1bc81f33c9ceb6ce67683ee7526e65fde1447c772afc54a1bb8"}, - {file = "charset_normalizer-3.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:0a11e971ed097d24c534c037d298ad32c6ce81a45736d31e0ff0ad37ab437d59"}, - {file = "charset_normalizer-3.0.1-py3-none-any.whl", hash = "sha256:7e189e2e1d3ed2f4aebabd2d5b0f931e883676e51c7624826e0a4e5fe8a0bf24"}, -] -click = [ - {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, - {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, -] -colorama = [ - {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, - {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, -] -configparser = [ - {file = "configparser-5.3.0-py3-none-any.whl", hash = "sha256:b065779fd93c6bf4cee42202fa4351b4bb842e96a3fb469440e484517a49b9fa"}, - {file = "configparser-5.3.0.tar.gz", hash = "sha256:8be267824b541c09b08db124917f48ab525a6c3e837011f3130781a224c57090"}, -] -idna = [ - {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, - {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, -] -importlib-metadata = [ - {file = "importlib_metadata-6.0.0-py3-none-any.whl", hash = "sha256:7efb448ec9a5e313a57655d35aa54cd3e01b7e1fbcf72dce1bf06119420f5bad"}, - {file = "importlib_metadata-6.0.0.tar.gz", hash = "sha256:e354bedeb60efa6affdcc8ae121b73544a7aa74156d047311948f6d711cd378d"}, -] -python-magic = [ - {file = "python-magic-0.4.27.tar.gz", hash = "sha256:c1ba14b08e4a5f5c31a302b7721239695b2f0f058d125bd5ce1ee36b9d9d3c3b"}, - {file = "python_magic-0.4.27-py2.py3-none-any.whl", hash = "sha256:c212960ad306f700aa0d01e5d7a325d20548ff97eb9920dcd29513174f0294d3"}, -] -requests = [ - {file = "requests-2.28.2-py3-none-any.whl", hash = "sha256:64299f4909223da747622c030b781c0d7811e359c37124b4bd368fb8c6518baa"}, - {file = "requests-2.28.2.tar.gz", hash = "sha256:98b1b2782e3c6c4904938b84c0eb932721069dfdb9134313beff7c83c2df24bf"}, -] -typing-extensions = [ - {file = "typing_extensions-4.4.0-py3-none-any.whl", hash = "sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e"}, - {file = "typing_extensions-4.4.0.tar.gz", hash = "sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa"}, -] -urllib3 = [ - {file = "urllib3-1.26.14-py2.py3-none-any.whl", hash = "sha256:75edcdc2f7d85b137124a6c3c9fc3933cdeaa12ecb9a6a959f22797a0feca7e1"}, - {file = "urllib3-1.26.14.tar.gz", hash = "sha256:076907bf8fd355cde77728471316625a4d2f7e713c125f51953bb5b3eecf4f72"}, -] -zipp = [ - {file = "zipp-3.11.0-py3-none-any.whl", hash = "sha256:83a28fcb75844b5c0cdaf5aa4003c2d728c77e05f5aeabe8e95e56727005fbaa"}, - {file = "zipp-3.11.0.tar.gz", hash = "sha256:a7a22e05929290a67401440b39690ae6563279bced5f314609d9d03798f56766"}, -] From 4469b9308031a5711cf932faf794926a88b6632d Mon Sep 17 00:00:00 2001 From: Security & Stuff <74931194+SecurityAndStuff@users.noreply.github.com> Date: Fri, 24 Mar 2023 06:55:05 +0000 Subject: [PATCH 23/29] add authorization check Signed-off-by: Security & Stuff <74931194+SecurityAndStuff@users.noreply.github.com> Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/ghas_cli/utils/network.py | 32 ++++++++++++++++++++++- src/ghas_cli/utils/repositories.py | 42 ++++++++++++++---------------- 2 files changed, 51 insertions(+), 23 deletions(-) diff --git a/src/ghas_cli/utils/network.py b/src/ghas_cli/utils/network.py index 4bec4f4..66e12c1 100644 --- a/src/ghas_cli/utils/network.py +++ b/src/ghas_cli/utils/network.py @@ -4,7 +4,7 @@ from typing import Any, Dict from datetime import datetime import time - +import requests # If the rate-limit is reached, sleep X seconds SLEEP_1_MINUTE = 60 @@ -41,3 +41,33 @@ def check_rate_limit(response: Any) -> bool: time.sleep(SLEEP_BETWEEN_REQUESTS) return False + +def check_unauthorized(response: Any): + if response.status_code == 401: + print(response.json()["message"]) + return False + return True + +def check_response(response: any): + check_rate_limit(response) + check_unauthorized(response) + +def get(*args, **kwargs): + response = requests.get(*args, **kwargs) + check_response(response) + return response + +def post(*args, **kwargs): + response = requests.post(*args, **kwargs) + check_response(response) + return response + +def put(*args, **kwargs): + response = requests.put(*args, **kwargs) + check_response(response) + return response + +def patch(*args, **kwargs): + response = requests.patch(*args, **kwargs) + check_response(response) + return response diff --git a/src/ghas_cli/utils/repositories.py b/src/ghas_cli/utils/repositories.py index 691b5a0..68bb47e 100644 --- a/src/ghas_cli/utils/repositories.py +++ b/src/ghas_cli/utils/repositories.py @@ -164,17 +164,15 @@ def get_org_repositories( "per_page": 100, "page": page, } - repos = requests.get( + repos = network.get( url=f"https://api.github.com/orgs/{organization}/repos", params=params, headers=headers, ) - if network.check_rate_limit(repos): - break if repos.status_code != 200: break - + if [] == repos.json(): break @@ -225,7 +223,7 @@ def get_default_branch_last_updated( """ headers = network.get_github_headers(token) - branch_res = requests.get( + branch_res = network.get( url=f"https://api.github.com/repos/{organization}/{repository_name}/branches/{default_branch}", headers=headers, ) @@ -245,7 +243,7 @@ def archive(organization: str, token: str, repository: str) -> bool: payload = {"archived": True} - status = requests.patch( + status = network.patch( url=f"https://api.github.com/repos/{organization}/{repository}", headers=headers, json=payload, @@ -263,7 +261,7 @@ def check_dependabot_alerts_enabled( headers = network.get_github_headers(token) - status = requests.get( + status = network.get( url=f"https://api.github.com/orgs/{organization}/repos/vulnerability-alerts", headers=headers, ) @@ -286,7 +284,7 @@ def enable_secret_scanner(organization: str, token: str, repository: str) -> boo } } - status = requests.patch( + status = network.patch( url=f"https://api.github.com/repos/{organization}/{repository}", headers=headers, json=payload, @@ -313,7 +311,7 @@ def enable_secret_scanner_push_protection( } } - status = requests.patch( + status = network.patch( url=f"https://api.github.com/repos/{organization}/{repository}", headers=headers, json=payload, @@ -328,12 +326,12 @@ def enable_secret_scanner_push_protection( def enable_dependabot(organization: str, token: str, repository: str) -> bool: headers = network.get_github_headers(token) - status_alerts = requests.put( + status_alerts = network.put( url=f"https://api.github.com/repos/{organization}/{repository}/vulnerability-alerts", headers=headers, ) - status_fixes = requests.put( + status_fixes = network.put( url=f"https://api.github.com/repos/{organization}/{repository}/automated-security-fixes", headers=headers, ) @@ -348,7 +346,7 @@ def get_default_branch(organization: str, token: str, repository: str) -> str: """Get the default branch slug for a repository""" headers = network.get_github_headers(token) - repo = requests.get( + repo = network.get( url=f"https://api.github.com/repos/{organization}/{repository}", headers=headers, ) @@ -375,7 +373,7 @@ def get_languages( aliased_interpreted_languages = {"typescript": "javascript"} headers = network.get_github_headers(token) - languages = requests.get( + languages = network.get( url=f"https://api.github.com/repos/{organization}/{repository}/languages", headers=headers, ) @@ -460,7 +458,7 @@ def create_codeql_pr( return False # Create a branch - branch_resp = requests.get( + branch_resp = network.get( url=f"https://api.github.com/repos/{organization}/{repository}/git/refs/heads", headers=headers, ) @@ -481,7 +479,7 @@ def create_codeql_pr( "sha": sha1, } - branch_resp = requests.post( + branch_resp = network.post( url=f"https://api.github.com/repos/{organization}/{repository}/git/refs", headers=headers, json=payload, @@ -505,7 +503,7 @@ def create_codeql_pr( "branch": target_branch, } - commit_resp = requests.put( + commit_resp = network.put( url=f"https://api.github.com/repos/{organization}/{repository}/contents/.github/workflows/codeql-analysis-{lang}.yml", headers=headers, json=payload, @@ -522,7 +520,7 @@ def create_codeql_pr( "branch": target_branch, } - commit_resp = requests.put( + commit_resp = network.put( url=f"https://api.github.com/repos/{organization}/{repository}/contents/.github/codeql/codeql-config-{lang}.yml", headers=headers, json=payload, @@ -541,7 +539,7 @@ def create_codeql_pr( # Retry if rate-limited i = 0 while i < network.RETRIES: - pr_resp = requests.post( + pr_resp = network.post( url=f"https://api.github.com/repos/{organization}/{repository}/pulls", headers=headers, json=payload, @@ -589,7 +587,7 @@ def create_dependency_enforcement_pr( return False # Create a branch - branch_resp = requests.get( + branch_resp = network.get( url=f"https://api.github.com/repos/{organization}/{repository}/git/refs/heads", headers=headers, ) @@ -610,7 +608,7 @@ def create_dependency_enforcement_pr( "sha": sha1, } - branch_resp = requests.post( + branch_resp = network.post( url=f"https://api.github.com/repos/{organization}/{repository}/git/refs", headers=headers, json=payload, @@ -627,7 +625,7 @@ def create_dependency_enforcement_pr( "branch": target_branch, } - commit_resp = requests.put( + commit_resp = network.put( url=f"https://api.github.com/repos/{organization}/{repository}/contents/.github/workflows/dependency_enforcement.yml", headers=headers, json=payload, @@ -646,7 +644,7 @@ def create_dependency_enforcement_pr( # Retry if rate-limited i = 0 while i < network.RETRIES: - pr_resp = requests.post( + pr_resp = network.post( url=f"https://api.github.com/repos/{organization}/{repository}/pulls", headers=headers, json=payload, From b4c109381383f3c2748845809a16493712dd673a Mon Sep 17 00:00:00 2001 From: Security & Stuff <74931194+SecurityAndStuff@users.noreply.github.com> Date: Fri, 24 Mar 2023 12:38:25 +0000 Subject: [PATCH 24/29] lint Signed-off-by: Security & Stuff <74931194+SecurityAndStuff@users.noreply.github.com> Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/ghas_cli/utils/repositories.py | 3 --- src/ghas_cli/utils/teams.py | 2 -- src/ghas_cli/utils/vulns.py | 2 -- 3 files changed, 7 deletions(-) diff --git a/src/ghas_cli/utils/repositories.py b/src/ghas_cli/utils/repositories.py index 68bb47e..4e3e271 100644 --- a/src/ghas_cli/utils/repositories.py +++ b/src/ghas_cli/utils/repositories.py @@ -177,7 +177,6 @@ def get_org_repositories( break for r in repos.json(): - repo = Repository() repo.load_json(r, token=token) # repo.load_json(r, token=None) @@ -258,7 +257,6 @@ def archive(organization: str, token: str, repository: str) -> bool: def check_dependabot_alerts_enabled( token: str, organization: str, repository_name: str ) -> bool: - headers = network.get_github_headers(token) status = network.get( @@ -494,7 +492,6 @@ def create_codeql_pr( ) for language in languages: - # Workflow config lang, template = load_codeql_base64_template(language, default_branch) payload = { diff --git a/src/ghas_cli/utils/teams.py b/src/ghas_cli/utils/teams.py index 85eae91..ac17cd1 100644 --- a/src/ghas_cli/utils/teams.py +++ b/src/ghas_cli/utils/teams.py @@ -15,7 +15,6 @@ def get_repositories(team_slug: str, organization: str, token: str) -> List: page = 1 while True: - params = {"per_page": 100, "page": page} repos = requests.get( url=f"https://api.github.com/orgs/{organization}/teams/{team_slug}/repos", @@ -50,7 +49,6 @@ def list(organization: str, token: str) -> str: page = 1 while True: - params = {"per_page": 100, "page": page} teams_res = requests.get( diff --git a/src/ghas_cli/utils/vulns.py b/src/ghas_cli/utils/vulns.py index 967e74e..b43a168 100644 --- a/src/ghas_cli/utils/vulns.py +++ b/src/ghas_cli/utils/vulns.py @@ -17,12 +17,10 @@ def get_codeql_alerts_repo( repositories_alerts = {} for repo in repos: - alerts_repo = [] page = 1 while True: - params = {"state": "open", "per_page": 100, "page": page} alerts = requests.get( url=f"https://api.github.com/repos/{organization}/{repo.name}/code-scanning/alerts", From f0ab42b0340b1d186ec0c83414b17e770b72ef72 Mon Sep 17 00:00:00 2001 From: Security & Stuff <74931194+SecurityAndStuff@users.noreply.github.com> Date: Wed, 19 Apr 2023 10:35:40 +0100 Subject: [PATCH 25/29] make security-extended a default Signed-off-by: Security & Stuff <74931194+SecurityAndStuff@users.noreply.github.com> Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- templates/codeql-analysis-default.yml | 1 + templates/codeql-analysis-go.yml | 68 ++++++++++++++++++++++++ templates/codeql-analysis-javascript.yml | 1 + templates/codeql-analysis-python.yml | 1 + templates/codeql-analysis-ruby.yml | 1 + templates/codeql-config-go.yml | 0 6 files changed, 72 insertions(+) create mode 100644 templates/codeql-analysis-go.yml create mode 100644 templates/codeql-config-go.yml diff --git a/templates/codeql-analysis-default.yml b/templates/codeql-analysis-default.yml index 12d2689..9eb868a 100644 --- a/templates/codeql-analysis-default.yml +++ b/templates/codeql-analysis-default.yml @@ -41,6 +41,7 @@ jobs: with: config-file: ./.github/codeql/codeql-config-default.yml languages: ${{ matrix.language }} + queries: security-extended # If you wish to specify custom queries, you can do so here or in a config file. # By default, queries listed here will override any specified in a config file. # Prefix the list here with "+" to use these queries and those in the config file. diff --git a/templates/codeql-analysis-go.yml b/templates/codeql-analysis-go.yml new file mode 100644 index 0000000..7be1b5b --- /dev/null +++ b/templates/codeql-analysis-go.yml @@ -0,0 +1,68 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# Reach out on Slack at '#github-appsec-security' to get help. + +name: "CodeQL - Go" + +on: + push: + pull_request: + branches: ["main"] + schedule: + - cron: "36 4 * * 3" + workflow_dispatch: + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: ["go"] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + config-file: ./.github/codeql/codeql-config-javascript.yml + languages: ${{ matrix.language }} + queries: security-extended + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-and-quality + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + #- name: Autobuild + # uses: github/codeql-action/autobuild@v2 + + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/templates/codeql-analysis-javascript.yml b/templates/codeql-analysis-javascript.yml index 4df01a9..aaf17c7 100644 --- a/templates/codeql-analysis-javascript.yml +++ b/templates/codeql-analysis-javascript.yml @@ -41,6 +41,7 @@ jobs: with: config-file: ./.github/codeql/codeql-config-javascript.yml languages: ${{ matrix.language }} + queries: security-extended # If you wish to specify custom queries, you can do so here or in a config file. # By default, queries listed here will override any specified in a config file. # Prefix the list here with "+" to use these queries and those in the config file. diff --git a/templates/codeql-analysis-python.yml b/templates/codeql-analysis-python.yml index f4281cc..0d68e5f 100644 --- a/templates/codeql-analysis-python.yml +++ b/templates/codeql-analysis-python.yml @@ -41,6 +41,7 @@ jobs: with: config-file: ./.github/codeql/codeql-config-python.yml languages: ${{ matrix.language }} + queries: security-extended # If you wish to specify custom queries, you can do so here or in a config file. # By default, queries listed here will override any specified in a config file. # Prefix the list here with "+" to use these queries and those in the config file. diff --git a/templates/codeql-analysis-ruby.yml b/templates/codeql-analysis-ruby.yml index 0bbb466..e8f1219 100644 --- a/templates/codeql-analysis-ruby.yml +++ b/templates/codeql-analysis-ruby.yml @@ -41,6 +41,7 @@ jobs: with: config-file: ./.github/codeql/codeql-config-ruby.yml languages: ${{ matrix.language }} + queries: security-extended # If you wish to specify custom queries, you can do so here or in a config file. # By default, queries listed here will override any specified in a config file. # Prefix the list here with "+" to use these queries and those in the config file. diff --git a/templates/codeql-config-go.yml b/templates/codeql-config-go.yml new file mode 100644 index 0000000..e69de29 From b1ac887fc478ac64d8b3c6978eeeac959dbf697b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 May 2023 20:05:02 +0000 Subject: [PATCH 26/29] Bump requests from 2.28.2 to 2.29.0 Bumps [requests](https://github.com/psf/requests) from 2.28.2 to 2.29.0. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.28.2...v2.29.0) --- updated-dependencies: - dependency-name: requests dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- poetry.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index 84e8d4c..7f97482 100644 --- a/poetry.lock +++ b/poetry.lock @@ -201,14 +201,14 @@ files = [ [[package]] name = "requests" -version = "2.28.2" +version = "2.29.0" description = "Python HTTP for Humans." category = "main" optional = false -python-versions = ">=3.7, <4" +python-versions = ">=3.7" files = [ - {file = "requests-2.28.2-py3-none-any.whl", hash = "sha256:64299f4909223da747622c030b781c0d7811e359c37124b4bd368fb8c6518baa"}, - {file = "requests-2.28.2.tar.gz", hash = "sha256:98b1b2782e3c6c4904938b84c0eb932721069dfdb9134313beff7c83c2df24bf"}, + {file = "requests-2.29.0-py3-none-any.whl", hash = "sha256:e8f3c9be120d3333921d213eef078af392fba3933ab7ed2d1cba3b56f2568c3b"}, + {file = "requests-2.29.0.tar.gz", hash = "sha256:f2e34a75f4749019bb0e3effb66683630e4ffeaf75819fb51bebef1bf5aef059"}, ] [package.dependencies] From 65a8e4cbc2c4b9298bd3580b82f09856476f1d8b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 May 2023 19:59:46 +0000 Subject: [PATCH 27/29] Bump requests from 2.29.0 to 2.30.0 Bumps [requests](https://github.com/psf/requests) from 2.29.0 to 2.30.0. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.29.0...v2.30.0) --- updated-dependencies: - dependency-name: requests dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- poetry.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index 7f97482..e4ef34a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -201,21 +201,21 @@ files = [ [[package]] name = "requests" -version = "2.29.0" +version = "2.30.0" description = "Python HTTP for Humans." category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "requests-2.29.0-py3-none-any.whl", hash = "sha256:e8f3c9be120d3333921d213eef078af392fba3933ab7ed2d1cba3b56f2568c3b"}, - {file = "requests-2.29.0.tar.gz", hash = "sha256:f2e34a75f4749019bb0e3effb66683630e4ffeaf75819fb51bebef1bf5aef059"}, + {file = "requests-2.30.0-py3-none-any.whl", hash = "sha256:10e94cc4f3121ee6da529d358cdaeaff2f1c409cd377dbc72b825852f2f7e294"}, + {file = "requests-2.30.0.tar.gz", hash = "sha256:239d7d4458afcb28a692cdd298d87542235f4ca8d36d03a15bfc128a6559a2f4"}, ] [package.dependencies] certifi = ">=2017.4.17" charset-normalizer = ">=2,<4" idna = ">=2.5,<4" -urllib3 = ">=1.21.1,<1.27" +urllib3 = ">=1.21.1,<3" [package.extras] socks = ["PySocks (>=1.5.6,!=1.5.7)"] From adf82262b24a9e072e1c41d6050888061cab4dcb Mon Sep 17 00:00:00 2001 From: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> Date: Tue, 9 May 2023 16:29:16 +0100 Subject: [PATCH 28/29] appease codeql Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli.py b/src/cli.py index df1bc29..a3b36b9 100644 --- a/src/cli.py +++ b/src/cli.py @@ -1079,8 +1079,8 @@ def mass_deploy( f"Enabling Actions ({actions_enable}), Secret Scanner ({secretscanner}), Push Protection ({pushprotection}), Dependabot ({dependabot}), CodeQL ({codeql}), Dependency Reviewer ({reviewer}) to {len(repos_list)} repositories." ) - for repo in repos_list: - repo = repo.rstrip("\n") + for repo_name in repos_list: + repo = repo_name.rstrip("\n") issue_secretscanner_res = None issue_pushprotection_res = None issue_dependabot_res = None From 4290dc29492bd63d7bab618657c850c76f9d1f4c Mon Sep 17 00:00:00 2001 From: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> Date: Tue, 9 May 2023 16:35:27 +0100 Subject: [PATCH 29/29] fix merge Signed-off-by: Security & Stuff <74931194+SecurityAndStuff@users.noreply.github.com> Signed-off-by: ssousa-mwb <74931194+SecurityAndStuff@users.noreply.github.com> --- src/cli.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/cli.py b/src/cli.py index a3b36b9..ea3981d 100644 --- a/src/cli.py +++ b/src/cli.py @@ -1198,11 +1198,6 @@ def mass_archive( ) -> None: """Create an issue to inform that repositories will be archived at a specific date.""" - repos_list = input_repos_list.readlines() - - for repo in repos_list: - - repos_list = input_repos_list.readlines() for repo in repos_list: