Skip to content

Commit 57bec82

Browse files
Feature: Enhance permissions for AquaSec scans and improve logging in GitHub project queries (#15)
* Feature: Enhance permissions for AquaSec scans and improve logging in GitHub project queries * Fixed black.
1 parent 793b64b commit 57bec82

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

.github/workflows/aquasec-scan.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ permissions:
7272
actions: read
7373
issues: write
7474
security-events: write
75+
repository-projects: read
7576

7677
jobs:
7778
aquasec-scan:

docs/security/example_workflows/aquasec-night-scan.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ permissions:
3535
actions: read
3636
issues: write
3737
security-events: write
38+
repository-projects: read
3839

3940
jobs:
4041
scan:

src/shared/github_projects.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,19 @@ def gh_project_get_priority_field(
9696
}
9797
}
9898
"""
99+
logging.debug(f"Querying ProjectV2 #{project_number} in org '{org}'")
99100
data = _run_graphql(query, {"org": org, "num": project_number})
100101
if data is None:
102+
logging.warning(f"GraphQL query for project #{project_number} in org '{org}' failed.")
101103
_project_priority_cache[cache_key] = None
102104
return None
103105

104106
project = (data.get("data") or {}).get("organization", {}).get("projectV2")
105107
if project is None:
106-
logging.warning(f"Project #{project_number} not found in org {org}")
108+
logging.warning(
109+
f"Project #{project_number} not found in org '{org}'. "
110+
"Verify the project exists, is a V2 project (not classic)."
111+
)
107112
_project_priority_cache[cache_key] = None
108113
return None
109114

0 commit comments

Comments
 (0)