Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add table gcp_apikeys_key. Closes #428 #440

Merged
merged 6 commits into from
Apr 3, 2023
Merged

Conversation

karanpopat
Copy link
Contributor

Integration test logs

Logs
Add passing integration test logs here

Example query results

Results
> select
  uid,
  display_name,
  create_time,
  case when restrictions is null then 'Unrestricted' else 'Restricted' end as state
from
  gcp_apikeys_key;
+--------------------------------------+----------------------------------------+---------------------------+------------+
| uid                                  | display_name                           | create_time               | state      |
+--------------------------------------+----------------------------------------+---------------------------+------------+
| 41d0591d-720a-43bc-bf58-38fe7fdd52f4 | API key 1                              | 2020-05-26T23:06:29+05:30 | Restricted |
| d388fb70-d6dd-490f-bbec-31ee158debce | iOS key (auto created by Firebase)     | 2020-11-23T12:17:09+05:30 | Restricted |
| ea7a4ee7-71c3-48b8-b93f-a688370fced4 | API key 4                              | 2021-02-22T13:49:00+05:30 | Restricted |
| c45f96e8-9189-4386-9856-90880e6f5731 | Android key (auto created by Firebase) | 2021-01-07T18:14:21+05:30 | Restricted |
+--------------------------------------+----------------------------------------+---------------------------+------------+

> select
  uid,
  display_name,
  create_time,
  case when restrictions is null then 'Unrestricted' else 'Restricted' end as state
from
  gcp_apikeys_key
where
  restrictions is null;
+-----+--------------+-------------+-------+
| uid | display_name | create_time | state |
+-----+--------------+-------------+-------+
+-----+--------------+-------------+-------+

> select
  uid,
  display_name,
  a ->> 'service' as allowed_service
from
  gcp_apikeys_key,
  jsonb_array_elements(restrictions -> 'apiTargets') as a
where
  restrictions is not null;
+--------------------------------------+--------------+---------------------------------+
| uid                                  | display_name | allowed_service                 |
+--------------------------------------+--------------+---------------------------------+
| ea7a4ee7-71c3-48b8-b93f-a688370fced4 | API key 4    | accessapproval.googleapis.com   |
| ea7a4ee7-71c3-48b8-b93f-a688370fced4 | API key 4    | admin                           |
| ea7a4ee7-71c3-48b8-b93f-a688370fced4 | API key 4    | apikeys                         |
| ea7a4ee7-71c3-48b8-b93f-a688370fced4 | API key 4    | appengine                       |
| ea7a4ee7-71c3-48b8-b93f-a688370fced4 | API key 4    | artifactregistry.googleapis.com |
+--------------------------------------+--------------+---------------------------------+

gcp/service.go Outdated Show resolved Hide resolved
karanpopat and others added 2 commits March 17, 2023 10:38
Copy link
Contributor

@cbruno10 cbruno10 left a comment

Choose a reason for hiding this comment

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

Early approval, will let @misraved review and merge when ready though

@misraved misraved merged commit 44ec969 into main Apr 3, 2023
@misraved misraved deleted the 428-add-table-gcp_api_key branch April 3, 2023 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add table gcp_apikeys_key (must include api_restriction and key_rotation information for compliance mods)
3 participants