From 6e3e827069ac0c31080aaa3b82f0b37c8a00dff6 Mon Sep 17 00:00:00 2001 From: HugoPBrito Date: Wed, 18 Dec 2024 18:09:47 +0000 Subject: [PATCH] fix: oauth auth env var --- prowler/providers/github/github_provider.py | 2 +- .../services/repository/repository_service.py | 26 ++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/prowler/providers/github/github_provider.py b/prowler/providers/github/github_provider.py index cc43565e01..aa51a6279c 100644 --- a/prowler/providers/github/github_provider.py +++ b/prowler/providers/github/github_provider.py @@ -246,7 +246,7 @@ class GithubProvider(Provider): if not session_token: # OAUTH logger.info( - "Looking for GITHUB_OAUTH_TOKEN environment variable as user has not provided any token...." + "Looking for GITHUB_OAUTH_APP_TOKEN environment variable as user has not provided any token...." ) session_token = environ.get("GITHUB_OAUTH_APP_TOKEN", "") if session_token: diff --git a/prowler/providers/github/services/repository/repository_service.py b/prowler/providers/github/services/repository/repository_service.py index 6786c64c84..f77f48b4db 100644 --- a/prowler/providers/github/services/repository/repository_service.py +++ b/prowler/providers/github/services/repository/repository_service.py @@ -50,15 +50,29 @@ class Repository(GithubService): if require_pr else 0 ) + + linear_history = protection.required_linear_history + allow_force_push = protection.allow_force_pushes + allow_branch_deletion = protection.allow_deletions + enforce_status_checks = ( + protection.required_status_checks.strict + if protection.required_status_checks + else False + ) + enforce_admins = protection.enforce_admins + conversation_resolution = ( + protection.required_conversation_resolution + ) + branch_protection = Protection( require_pull_request=require_pr, approval_count=approval_cnt, - linear_history=protection.required_linear_history, - allow_force_push=protection.allow_force_pushes, - allow_branch_deletion=protection.allow_deletions, - enforce_status_checks=protection.required_status_checks.strict, - enforce_admins=protection.enforce_admins, - conversation_resolution=protection.required_conversation_resolution, + linear_history=linear_history, + allow_force_push=allow_force_push, + allow_branch_deletion=allow_branch_deletion, + enforce_status_checks=enforce_status_checks, + enforce_admins=enforce_admins, + conversation_resolution=conversation_resolution, ) except Exception as e: