@@ -17,13 +17,13 @@ def get_repo_ss_alerts(api_endpoint, github_pat, repo_name):
1717 Outputs:
1818 - List of _all_ secret scanning alerts on the repository (both default and generic secret types)
1919 """
20- # First call: get default secret types (without any filters)
21- url_default = f"{ api_endpoint } /repos/{ repo_name } /secret-scanning/alerts?per_page=100&page=1 "
20+ # First call: get default secret types (without any filters), use after= to force object based cursor instead of page based
21+ url_default = f"{ api_endpoint } /repos/{ repo_name } /secret-scanning/alerts?per_page=100&after= "
2222 ss_alerts_default = api_helpers .make_api_call (url_default , github_pat )
2323
24- # Second call: get generic secret types with hardcoded list
24+ # Second call: get generic secret types with hardcoded list, use after= to force object based cursor instead of page based
2525 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"
26- url_generic = f"{ api_endpoint } /repos/{ repo_name } /secret-scanning/alerts?per_page=100&page=1 &secret_type={ generic_secret_types } "
26+ url_generic = f"{ api_endpoint } /repos/{ repo_name } /secret-scanning/alerts?per_page=100&after= &secret_type={ generic_secret_types } "
2727 ss_alerts_generic = api_helpers .make_api_call (url_generic , github_pat )
2828
2929 # Combine results and deduplicate
@@ -114,14 +114,14 @@ def get_org_ss_alerts(api_endpoint, github_pat, org_name):
114114 Outputs:
115115 - List of _all_ secret scanning alerts on the organization (both default and generic secret types)
116116 """
117- # First call: get default secret types (without any filters)
118- url_default = f"{ api_endpoint } /orgs/{ org_name } /secret-scanning/alerts?per_page=100&page=1 "
117+ # First call: get default secret types (without any filters), use after= to force object based cursor instead of page based
118+ url_default = f"{ api_endpoint } /orgs/{ org_name } /secret-scanning/alerts?per_page=100&after= "
119119 ss_alerts_default = api_helpers .make_api_call (url_default , github_pat )
120120
121- # Second call: get generic secret types with hardcoded list
121+ # Second call: get generic secret types with hardcoded list, use after= to force object based cursor instead of page based
122122 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"
123123 url_generic = (
124- f"{ api_endpoint } /orgs/{ org_name } /secret-scanning/alerts?per_page=100&page=1 &secret_type={ generic_secret_types } "
124+ f"{ api_endpoint } /orgs/{ org_name } /secret-scanning/alerts?per_page=100&after= &secret_type={ generic_secret_types } "
125125 )
126126 ss_alerts_generic = api_helpers .make_api_call (url_generic , github_pat )
127127
@@ -228,13 +228,13 @@ def get_enterprise_ss_alerts(api_endpoint, github_pat, enterprise_slug):
228228 Outputs:
229229 - List of _all_ secret scanning alerts on the enterprise (both default and generic secret types)
230230 """
231- # First call: get default secret types (without any filters)
232- url_default = f"{ api_endpoint } /enterprises/{ enterprise_slug } /secret-scanning/alerts?per_page=100&page=1 "
231+ # First call: get default secret types (without any filters), use after= to force object based cursor instead of page based
232+ url_default = f"{ api_endpoint } /enterprises/{ enterprise_slug } /secret-scanning/alerts?per_page=100&after= "
233233 ss_alerts_default = api_helpers .make_api_call (url_default , github_pat )
234234
235- # Second call: get generic secret types with hardcoded list
235+ # Second call: get generic secret types with hardcoded list, use after= to force object based cursor instead of page based
236236 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"
237- url_generic = f"{ api_endpoint } /enterprises/{ enterprise_slug } /secret-scanning/alerts?per_page=100&page=1 &secret_type={ generic_secret_types } "
237+ url_generic = f"{ api_endpoint } /enterprises/{ enterprise_slug } /secret-scanning/alerts?per_page=100&after= &secret_type={ generic_secret_types } "
238238 ss_alerts_generic = api_helpers .make_api_call (url_generic , github_pat )
239239
240240 # Combine results and deduplicate
0 commit comments