Repository navigation
fix(clp-package): Temporarily remove support for implicit AWS credentials. #682
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
Changes from all commits
c01b29d
86600d1
ee3839c
8ab90df
2b4bb6a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -943,15 +943,14 @@ def start_log_viewer_webui( | |||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| access_key_id, secret_access_key = s3_config.get_credentials() | ||||||||||||||||||||||||||||||||||||||
| if access_key_id is not None and secret_access_key is not None: | ||||||||||||||||||||||||||||||||||||||
| container_cmd_extra_opts.extend( | ||||||||||||||||||||||||||||||||||||||
| [ | ||||||||||||||||||||||||||||||||||||||
| "-e", | ||||||||||||||||||||||||||||||||||||||
| f"AWS_ACCESS_KEY_ID={access_key_id}", | ||||||||||||||||||||||||||||||||||||||
| "-e", | ||||||||||||||||||||||||||||||||||||||
| f"AWS_SECRET_ACCESS_KEY={secret_access_key}", | ||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||
| container_cmd_extra_opts.extend( | ||||||||||||||||||||||||||||||||||||||
| ( | ||||||||||||||||||||||||||||||||||||||
| "-e", | ||||||||||||||||||||||||||||||||||||||
| f"AWS_ACCESS_KEY_ID={access_key_id}", | ||||||||||||||||||||||||||||||||||||||
| "-e", | ||||||||||||||||||||||||||||||||||||||
| f"AWS_SECRET_ACCESS_KEY={secret_access_key}", | ||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+946
to
+953
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add validation for AWS credentials. The unconditional addition of AWS credentials to container environment variables could lead to issues if the credentials are None. This should be validated first. Add validation before extending container options: access_key_id, secret_access_key = s3_config.get_credentials()
+ if not access_key_id or not secret_access_key:
+ raise ValueError("Both AWS access key ID and secret access key must be provided for S3 storage")
container_cmd_extra_opts.extend(
(
"-e",
f"AWS_ACCESS_KEY_ID={access_key_id}",
"-e",
f"AWS_SECRET_ACCESS_KEY={secret_access_key}",
)
)📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| settings_json = read_and_update_settings_json(settings_json_path, settings_json_updates) | ||||||||||||||||||||||||||||||||||||||
| with open(settings_json_path, "w") as settings_json_file: | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,8 +77,8 @@ def s3_get_object_metadata(s3_input_config: S3InputConfig) -> List[FileMetadata] | |
| s3_client = boto3.client( | ||
| "s3", | ||
| region_name=s3_input_config.region_code, | ||
| aws_access_key_id=s3_input_config.aws_access_key_id, | ||
| aws_secret_access_key=s3_input_config.aws_secret_access_key, | ||
| aws_access_key_id=s3_input_config.credentials.access_key_id, | ||
| aws_secret_access_key=s3_input_config.credentials.secret_access_key, | ||
|
Comment on lines
+80
to
+81
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add error handling for missing credentials. While the code now uses the structured credentials format, it should handle the case where credentials might be None. Add validation before accessing credentials: + if not s3_input_config.credentials:
+ raise ValueError("AWS credentials are required")
s3_client = boto3.client(
"s3",
region_name=s3_input_config.region_code,
aws_access_key_id=s3_input_config.credentials.access_key_id,
aws_secret_access_key=s3_input_config.credentials.secret_access_key,
)
|
||
| ) | ||
|
|
||
| file_metadata_list: List[FileMetadata] = list() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Enhance error handling for AWS credentials.
While the code now enforces explicit credentials, it should validate that both credentials are provided before creating the S3Credentials object.
Add validation before creating S3Credentials:
📝 Committable suggestion