Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/code_scanning.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def list_repo_cs_alerts(api_endpoint, github_pat, repo_name):
Outputs:
- List of _all_ code scanning alerts on the repository
"""
url = f"{api_endpoint}/repos/{repo_name}/code-scanning/alerts?per_page=100&page=1"
url = f"{api_endpoint}/repos/{repo_name}/code-scanning/alerts?per_page=100&after="
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty after= parameter may not be valid for GitHub's API. Consider either omitting the after parameter entirely for the first request or using a valid cursor value.

Copilot uses AI. Check for mistakes.
code_scanning_alerts = api_helpers.make_api_call(url, github_pat)
print(f"Found {len(code_scanning_alerts)} code scanning alerts in {repo_name}")
return code_scanning_alerts
Expand Down Expand Up @@ -104,7 +104,7 @@ def list_org_cs_alerts(api_endpoint, github_pat, org_name):
- List of _all_ code scanning alerts on the organization
"""

url = f"{api_endpoint}/orgs/{org_name}/code-scanning/alerts?per_page=100&page=1"
url = f"{api_endpoint}/orgs/{org_name}/code-scanning/alerts?per_page=100&after="
code_scanning_alerts = api_helpers.make_api_call(url, github_pat)
print(f"Found {len(code_scanning_alerts)} code scanning alerts in {org_name}")
return code_scanning_alerts
Expand Down Expand Up @@ -306,7 +306,7 @@ def list_enterprise_cloud_cs_alerts(api_endpoint, github_pat, enterprise_slug):
- List of _all_ code scanning alerts in enterprise that PAT user can access
"""

url = f"{api_endpoint}/enterprises/{enterprise_slug}/code-scanning/alerts?per_page=100&page=1"
url = f"{api_endpoint}/enterprises/{enterprise_slug}/code-scanning/alerts?per_page=100&after="
code_scanning_alerts = api_helpers.make_api_call(url, github_pat)
print(f"Found {len(code_scanning_alerts)} code scanning alerts in {enterprise_slug}")
return code_scanning_alerts
Expand Down
6 changes: 3 additions & 3 deletions src/dependabot.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def list_repo_dependabot_alerts(api_endpoint, github_pat, repo_name):
Outputs:
- List of _all_ dependency alerts on the repository
"""
url = f"{api_endpoint}/repos/{repo_name}/dependabot/alerts?per_page=100&page=1"
url = f"{api_endpoint}/repos/{repo_name}/dependabot/alerts?per_page=100&after="
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty after= parameter may not be valid for GitHub's API. Consider either omitting the after parameter entirely for the first request or using a valid cursor value.

Copilot uses AI. Check for mistakes.
dependabot_alerts = api_helpers.make_api_call(url, github_pat)
print(f"Found {len(dependabot_alerts)} dependabot alerts in {repo_name}")
return dependabot_alerts
Expand Down Expand Up @@ -90,7 +90,7 @@ def list_org_dependabot_alerts(api_endpoint, github_pat, org_name):
Outputs:
- List of _all_ dependency alerts on the organization
"""
url = f"{api_endpoint}/orgs/{org_name}/dependabot/alerts?per_page=100&page=1"
url = f"{api_endpoint}/orgs/{org_name}/dependabot/alerts?per_page=100&after="
dependabot_alerts = api_helpers.make_api_call(url, github_pat)
print(f"Found {len(dependabot_alerts)} dependabot alerts in {org_name}")
return dependabot_alerts
Expand All @@ -109,7 +109,7 @@ def list_enterprise_dependabot_alerts(api_endpoint, github_pat, enterprise_slug)
Outputs:
- List of _all_ dependency alerts on the enterprise
"""
url = f"{api_endpoint}/enterprises/{enterprise_slug}/dependabot/alerts?per_page=100&page=1"
url = f"{api_endpoint}/enterprises/{enterprise_slug}/dependabot/alerts?per_page=100&after="
dependabot_alerts = api_helpers.make_api_call(url, github_pat)
print(f"Found {len(dependabot_alerts)} dependabot alerts in {enterprise_slug}")
return dependabot_alerts
Expand Down
24 changes: 12 additions & 12 deletions src/secret_scanning.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ def get_repo_ss_alerts(api_endpoint, github_pat, repo_name):
Outputs:
- List of _all_ secret scanning alerts on the repository (both default and generic secret types)
"""
# First call: get default secret types (without any filters)
url_default = f"{api_endpoint}/repos/{repo_name}/secret-scanning/alerts?per_page=100&page=1"
# First call: get default secret types (without any filters), use after= to force object based cursor instead of page based
url_default = f"{api_endpoint}/repos/{repo_name}/secret-scanning/alerts?per_page=100&after="
ss_alerts_default = api_helpers.make_api_call(url_default, github_pat)

# Second call: get generic secret types with hardcoded list
# Second call: get generic secret types with hardcoded list, use after= to force object based cursor instead of page based
generic_secret_types = "password,http_basic_authentication_header,http_bearer_authentication_header,mongodb_connection_string,mysql_connection_string,openssh_private_key,pgp_private_key,postgres_connection_string,rsa_private_key"
url_generic = f"{api_endpoint}/repos/{repo_name}/secret-scanning/alerts?per_page=100&page=1&secret_type={generic_secret_types}"
url_generic = f"{api_endpoint}/repos/{repo_name}/secret-scanning/alerts?per_page=100&after=&secret_type={generic_secret_types}"
ss_alerts_generic = api_helpers.make_api_call(url_generic, github_pat)

# Combine results and deduplicate
Expand Down Expand Up @@ -114,14 +114,14 @@ def get_org_ss_alerts(api_endpoint, github_pat, org_name):
Outputs:
- List of _all_ secret scanning alerts on the organization (both default and generic secret types)
"""
# First call: get default secret types (without any filters)
url_default = f"{api_endpoint}/orgs/{org_name}/secret-scanning/alerts?per_page=100&page=1"
# First call: get default secret types (without any filters), use after= to force object based cursor instead of page based
url_default = f"{api_endpoint}/orgs/{org_name}/secret-scanning/alerts?per_page=100&after="
ss_alerts_default = api_helpers.make_api_call(url_default, github_pat)

# Second call: get generic secret types with hardcoded list
# Second call: get generic secret types with hardcoded list, use after= to force object based cursor instead of page based
generic_secret_types = "password,http_basic_authentication_header,http_bearer_authentication_header,mongodb_connection_string,mysql_connection_string,openssh_private_key,pgp_private_key,postgres_connection_string,rsa_private_key"
url_generic = (
f"{api_endpoint}/orgs/{org_name}/secret-scanning/alerts?per_page=100&page=1&secret_type={generic_secret_types}"
f"{api_endpoint}/orgs/{org_name}/secret-scanning/alerts?per_page=100&after=&secret_type={generic_secret_types}"
)
ss_alerts_generic = api_helpers.make_api_call(url_generic, github_pat)

Expand Down Expand Up @@ -228,13 +228,13 @@ def get_enterprise_ss_alerts(api_endpoint, github_pat, enterprise_slug):
Outputs:
- List of _all_ secret scanning alerts on the enterprise (both default and generic secret types)
"""
# First call: get default secret types (without any filters)
url_default = f"{api_endpoint}/enterprises/{enterprise_slug}/secret-scanning/alerts?per_page=100&page=1"
# First call: get default secret types (without any filters), use after= to force object based cursor instead of page based
url_default = f"{api_endpoint}/enterprises/{enterprise_slug}/secret-scanning/alerts?per_page=100&after="
ss_alerts_default = api_helpers.make_api_call(url_default, github_pat)

# Second call: get generic secret types with hardcoded list
# Second call: get generic secret types with hardcoded list, use after= to force object based cursor instead of page based
generic_secret_types = "password,http_basic_authentication_header,http_bearer_authentication_header,mongodb_connection_string,mysql_connection_string,openssh_private_key,pgp_private_key,postgres_connection_string,rsa_private_key"
url_generic = f"{api_endpoint}/enterprises/{enterprise_slug}/secret-scanning/alerts?per_page=100&page=1&secret_type={generic_secret_types}"
url_generic = f"{api_endpoint}/enterprises/{enterprise_slug}/secret-scanning/alerts?per_page=100&after=&secret_type={generic_secret_types}"
ss_alerts_generic = api_helpers.make_api_call(url_generic, github_pat)

# Combine results and deduplicate
Expand Down
Loading