{"id":19748737,"url":"https://github.com/doitintl/galactus","last_synced_at":"2025-08-31T14:46:08.775Z","repository":{"id":46733089,"uuid":"515152395","full_name":"doitintl/galactus","owner":"doitintl","description":"A tool for detecting unused Service Accounts and Service Account Keys on GCP","archived":false,"fork":false,"pushed_at":"2022-11-10T16:11:03.000Z","size":14,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-28T22:01:14.585Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doitintl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-18T11:18:04.000Z","updated_at":"2023-05-22T00:46:14.000Z","dependencies_parsed_at":"2023-01-21T11:30:46.817Z","dependency_job_id":null,"html_url":"https://github.com/doitintl/galactus","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/doitintl/galactus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doitintl%2Fgalactus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doitintl%2Fgalactus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doitintl%2Fgalactus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doitintl%2Fgalactus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doitintl","download_url":"https://codeload.github.com/doitintl/galactus/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doitintl%2Fgalactus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272995210,"owners_count":25027901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T02:23:19.944Z","updated_at":"2025-08-31T14:46:08.724Z","avatar_url":"https://github.com/doitintl.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Galactus - unused GCP Service Account/Key detector\n\nThis script uses GCP's [Policy Analyzer](https://cloud.google.com/policy-intelligence/docs/activity-analyzer-service-account-authentication) feature to detect unused Service Accounts (SA) or Service Account Keys (SAK).\n\n## Prerequisites\n- [gcloud](https://cloud.google.com/sdk/docs/install) installed and in PATH\n- Python 3\n- Enabling the [Policy Analyzer API](https://cloud.google.com/policy-intelligence/docs/activity-analyzer-service-account-authentication#before-you-begin)\n\n## Script arguments\n\n```bash\n$ ./galactus --help\nusage: galactus [-h] -p PROJECT -a ACTIVITY_TYPE [-l LIMIT] -t THRESHOLD [-d]\n\nUnused GCP Service Account and Key detector\n\noptions:\n  -h, --help            show this help message and exit\n  -p PROJECT, --project PROJECT\n                        GCP Project name\n  -a ACTIVITY_TYPE, --activity-type ACTIVITY_TYPE\n                        Activity type (serviceAccountLastAuthentication / serviceAccountKeyLastAuthentication)\n  -l LIMIT, --limit LIMIT\n                        Result limit\n  -t THRESHOLD, --threshold THRESHOLD\n                        Date threshold in format \"%Y-%m-%dT%H:%M:%SZ\"\n  -d, --debug           Enable debug logging\n```\n\n### Using environment variables\n\nThe following environment variable can be used instead of command line arguments (arguments take precedence):\n- GCP_PROJECT - instead of -p/--project\n- ACTIVITY_TYPE - instead of -a/--activity-type\n- THRESHOLD - instead of -t/--threshold\n- DEBUG - instead of -d/--debug\n\n## Examples\n\nFind SA that were not used since before 1.5.2022:\n\n```bash\n$ ./galactus -p test-eyal -t 2022-05-01T00:00:00Z -a serviceAccountLastAuthentication\n2022-07-15 17:35:25,078 - INFO - //iam.googleapis.com/projects/test-eyal/serviceAccounts/crossplane-test@test-eyal.iam.gserviceaccount.com - last used 2022-02-28T08:00:00Z\n```\n\nFind SAK that were not used since before 28.2.2022 at 10AM:\n\n```bash\n$ ./galactus -p test-eyal -t 2022-02-28T10:00:00Z -a serviceAccountKeyLastAuthentication\n2022-07-15 17:36:52,823 - INFO - //iam.googleapis.com/projects/test-eyal/serviceAccounts/crossplane-test@test-eyal.iam.gserviceaccount.com/keys/b2edfc3fc441c9937c0c2e0da2b1345d57a02abb - last used 2022-02-28T08:00:00Z\n\n```\n\n## Deploying to GKE\n\nExample manifests can be found in the [kustomize](./kustomize/) directory. Do the following before applying:\n\n- build and push the image: `docker build -t \u003cMY_REGISTRY\u003e:\u003cMY_TAG\u003e src \u0026\u0026 docker push \u003cMY_REGISTRY\u003e:\u003cMY_TAG\u003e`\n\n- update the registry and tag inside [kustomization.yaml](./kustomize/kustomization.yaml)\n\n- update the GCP project name in [configmap.yaml](./kustomize/configmap.yaml)\n\n- if using [Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity), configure the GSA with the [necessary roles](https://cloud.google.com/policy-intelligence/docs/activity-analyzer-service-account-authentication#required-permissions) and update the GSA email in [serviceaccount.yaml](./kustomize/serviceaccount.yaml)\n\n- if necessary, tweak schedule [cronjob.yaml](./kustomize/cronjob.yaml)\n\n- apply the manifests to the cluster: `kubectl apply -k kustomize`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoitintl%2Fgalactus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoitintl%2Fgalactus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoitintl%2Fgalactus/lists"}