mirror of
https://github.com/cunnymessiah/keychecker.git
synced 2026-05-10 18:39:04 -07:00
added check for aws keylogging
This commit is contained in:
@@ -27,6 +27,7 @@ class APIKey:
|
||||
self.admin_priv = False
|
||||
self.bedrock_enabled = False
|
||||
self.region = ""
|
||||
self.logged = False
|
||||
|
||||
elif provider == Provider.AZURE:
|
||||
self.endpoint = ""
|
||||
|
||||
@@ -87,6 +87,8 @@ def check_aws(key: APIKey):
|
||||
|
||||
if key.useless:
|
||||
return
|
||||
else:
|
||||
check_logging(session, key)
|
||||
return True
|
||||
|
||||
except botocore.exceptions.ClientError as e:
|
||||
@@ -119,6 +121,16 @@ def test_invoke_perms(bedrock_runtime_client):
|
||||
return
|
||||
|
||||
|
||||
def check_logging(session, key: APIKey):
|
||||
try:
|
||||
bedrock_client = session.client("bedrock", region_name=key.region)
|
||||
logging_config = bedrock_client.get_model_invocation_logging_configuration()
|
||||
key.logged = logging_config['loggingConfig']['textDataDeliveryEnabled']
|
||||
except botocore.exceptions.ClientError as e:
|
||||
key.logged = True
|
||||
return
|
||||
|
||||
|
||||
def pretty_print_aws_keys(keys):
|
||||
print('-' * 90)
|
||||
admin_count = 0
|
||||
@@ -137,7 +149,8 @@ def pretty_print_aws_keys(keys):
|
||||
print(f"Validated {len(ready_to_go_keys)} AWS keys that are working and already have Bedrock setup.")
|
||||
for key in ready_to_go_keys:
|
||||
print(f'{key.api_key}' + (f' | {key.username}' if key.username != "" else "") +
|
||||
(' | admin key' if key.admin_priv else "") + (f' | {key.region}' if key.region != "" else ""))
|
||||
(' | admin key' if key.admin_priv else "") + (f' | {key.region}' if key.region != "" else "") +
|
||||
(' | LOGGED KEY' if key.logged is True else ""))
|
||||
|
||||
if needs_setup_keys:
|
||||
print(f"\nValidated {len(needs_setup_keys)} AWS keys that failed to invoke Claude and need further permissions setup. Keys without a region displayed do not have the models setup and need to do so")
|
||||
|
||||
Reference in New Issue
Block a user