1- ID : inactive_and_expired_keys
1+ ID : inactive_expired_keys
22Title : Inactive and Expired API Keys
3- Description : List of all inactive and expired API Keys from AWS and Azure platforms.
3+ Description : List of all inactive and expired API Keys from AWS, Azure, and Cloudflare platforms.
44Query :
55 Engine : CloudQL-v0.0.1
66 QueryToExecute : |
77 WITH
8- -- CTE for expired AWS keys
9- expired_aws_keys AS (
8+ -- CTE for inactive AWS keys
9+ inactive_aws_keys AS (
1010 SELECT
1111 access_key_id AS key_id,
1212 user_name,
@@ -19,6 +19,10 @@ Query:
1919 status = 'Inactive'
2020 ),
2121
22+ -- CTE for expired AWS keys (if any additional criteria are needed)
23+ -- Currently, assuming only 'Inactive' status indicates expired
24+ -- If there's a separate expiration logic, it can be added here
25+
2226 -- CTE for expired Azure key_credentials
2327 expired_azure_key_credentials AS (
2428 SELECT
@@ -68,17 +72,36 @@ Query:
6872 epc.integration_id AS Integration
6973 FROM
7074 expired_azure_password_credentials epc
75+ ),
76+
77+ -- CTE for expired or inactive Cloudflare API tokens
78+ expired_cloudflare_tokens AS (
79+ SELECT
80+ cft.id AS key_id,
81+ cft.name AS user_name,
82+ CASE
83+ WHEN cft.status != 'active' THEN 'Inactive'
84+ WHEN cft.expires_on < NOW() THEN 'Expired'
85+ ELSE cft.status
86+ END AS status,
87+ 'Cloudflare' AS Platform,
88+ cft.id AS Integration
89+ FROM
90+ cloudflare_api_token cft
91+ WHERE
92+ cft.status != 'active'
93+ OR cft.expires_on < NOW()
7194 )
7295
73- -- Final UNION ALL of AWS and Azure expired keys
96+ -- Final UNION ALL of AWS, Azure, and Cloudflare expired/inactive keys
7497 SELECT
7598 key_id,
7699 user_name,
77100 status,
78101 Platform,
79102 Integration
80103 FROM
81- expired_aws_keys
104+ inactive_aws_keys
82105
83106 UNION ALL
84107
@@ -90,6 +113,17 @@ Query:
90113 Integration
91114 FROM
92115 expired_azure_keys
116+
117+ UNION ALL
118+
119+ SELECT
120+ key_id,
121+ user_name,
122+ status,
123+ Platform,
124+ Integration
125+ FROM
126+ expired_cloudflare_tokens
93127Tags :
94128 category :
95129 - Security
0 commit comments