mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-15 16:04:18 +00:00
chore: revision
This commit is contained in:
4 files changed
+26
-27
No files matched your search
+14
-14
@@ -482,6 +482,20 @@ class Check_Report_Kubernetes(Check_Report):
|
||||
self.namespace = ""
|
||||
|
||||
|
||||
@dataclass
|
||||
class Check_Report_Github(Check_Report):
|
||||
# TODO change class name to CheckReportGitHub
|
||||
"""Contains the GitHub Check's finding information."""
|
||||
|
||||
resource_name: str
|
||||
resource_id: str
|
||||
|
||||
def __init__(self, metadata):
|
||||
super().__init__(metadata)
|
||||
self.resource_name = ""
|
||||
self.resource_id = ""
|
||||
|
||||
|
||||
# Testing Pending
|
||||
def load_check_metadata(metadata_file: str) -> CheckMetadata:
|
||||
"""
|
||||
@@ -502,17 +516,3 @@ def load_check_metadata(metadata_file: str) -> CheckMetadata:
|
||||
sys.exit(1)
|
||||
else:
|
||||
return check_metadata
|
||||
|
||||
|
||||
@dataclass
|
||||
class Check_Report_Github(Check_Report):
|
||||
"""Contains the GitHub Check's finding information."""
|
||||
|
||||
account_name: str
|
||||
resource_name: str
|
||||
resource_id: str
|
||||
|
||||
def __init__(self, metadata):
|
||||
super().__init__(metadata)
|
||||
self.resource_name = ""
|
||||
self.resource_id = ""
|
||||
@@ -13,6 +13,8 @@ def stdout_report(finding, color, verbose, status, fix):
|
||||
details = finding.location.lower()
|
||||
if finding.check_metadata.Provider == "kubernetes":
|
||||
details = finding.namespace.lower()
|
||||
if finding.check_metadata.Provider == "github":
|
||||
details = ""
|
||||
|
||||
if (verbose or fix) and (not status or finding.status in status):
|
||||
if finding.muted:
|
||||
|
||||
+10
-10
@@ -9,11 +9,11 @@ from prowler.providers.github.services.repository.repository_client import (
|
||||
class repository_public_has_securitymd_file(Check):
|
||||
"""Check if a public repository has a SECURITY.md file
|
||||
|
||||
This class verifies wheter each public repository has a SECURITY.md file.
|
||||
This class verifies whether each public repository has a SECURITY.md file.
|
||||
"""
|
||||
|
||||
def execute(self) -> List[Check_Report_Github]:
|
||||
"""Execute the Github Repository Public Has Securitymd File check
|
||||
"""Execute the Github Repository Public Has SECURITY.md File check
|
||||
|
||||
Iterates over all public repositories and checks if they have a SECURITY.md file.
|
||||
|
||||
@@ -22,15 +22,15 @@ class repository_public_has_securitymd_file(Check):
|
||||
"""
|
||||
findings = []
|
||||
for repo in repository_client.repositories.values():
|
||||
report = Check_Report_Github(self.metadata())
|
||||
report.resource_id = repo.id
|
||||
report.resource_name = repo.name
|
||||
report.status = "PASS"
|
||||
report.status_extended = (
|
||||
f"Repository {repo.name} does have a SECURITY.md file."
|
||||
)
|
||||
|
||||
if not repo.private:
|
||||
report = Check_Report_Github(self.metadata())
|
||||
report.resource_id = repo.id
|
||||
report.resource_name = repo.name
|
||||
report.status = "PASS"
|
||||
report.status_extended = (
|
||||
f"Repository {repo.name} does have a SECURITY.md file."
|
||||
)
|
||||
|
||||
if not repo.securitymd:
|
||||
report.status = "FAIL"
|
||||
report.status_extended = (
|
||||
|
||||
@@ -32,9 +32,6 @@ class Repository(GithubService):
|
||||
f"{error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}"
|
||||
)
|
||||
|
||||
def get_repositories(self):
|
||||
return self.repositories
|
||||
|
||||
|
||||
class Repo(BaseModel):
|
||||
"""Model for Github Repository"""
|
||||
|
||||
Reference in new issue
Block a user