Skip to content

Adds Secrets Manager Example#70

Open
DanRunt wants to merge 4 commits intomainfrom
secrets-manager-example
Open

Adds Secrets Manager Example#70
DanRunt wants to merge 4 commits intomainfrom
secrets-manager-example

Conversation

@DanRunt
Copy link
Contributor

@DanRunt DanRunt commented Jul 2, 2025

No description provided.

Copy link
Contributor

@yuvalrhino yuvalrhino left a comment

Choose a reason for hiding this comment

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

Very cool example!
Had a few comments - mainly around exception handling so that if something goes wrong users will get a more informative message

- Access to Rhino FCP platform
- Access to a third party Secrets Manager platform (this example uses AWS Secrests Manager)

## Dependencies
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this section in the README? The requirements may change over time (e.g. due to vulnerabilities found in current versions of these packages) and then we'll likely update the requirements.txt, but may forget to update the README so it will get out of sync.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want the .enc version of this file in the repo? It's encrypted with specific keys, so probably not very helpful to have it here, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense to remove it. The other encryption examples have them too, that's why I kept it.

if 'encrypt_key' not in params:
raise ValueError("encrypt_key not found in secret params")

return RSA.import_key(params['encrypt_key'])
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Perhaps put this in a try/except like you do in decrypt_code.py such that if the encrypt_key is in the wrong format this will show an informative error message?

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the .enc version of this file in the repo?

}

# Create new secret in AWS Secrets Manager
self.client.create_secret(
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be wrapped in a try/except in case there is a connection/permissions/format issue.

ROLE_NAME = '<role_name>'

# Initialize secrets manager
secrets = SecretsManager(
Copy link
Contributor

Choose a reason for hiding this comment

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

There should be a try/except here in case initialization fails (e.g. if they forgot to update the ACCOUNT_ID and ROLE_NAME)

)

# Read input file
with open(input_file, 'rb') as f:
Copy link
Contributor

Choose a reason for hiding this comment

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

There should be a try/except here in case the input_file isn't found or can't be opened/read

# Load private key from JSON
with secret_run_params_file_path.open("r") as secret_run_params_file:
secret_run_params = json.load(secret_run_params_file)
private_key = RSA.import_key(secret_run_params["decrypt_key"])
Copy link
Contributor

Choose a reason for hiding this comment

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

There should be a try/except in case the decrypt_key isn't present in the secret_run_params or isn't in the correct format.

private_key = RSA.import_key(secret_run_params["decrypt_key"])

# Read the encrypted file
with open(model_parameters_path, 'rb') as f:
Copy link
Contributor

Choose a reason for hiding this comment

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

try/except

DanRunt and others added 3 commits July 11, 2025 10:26
Co-authored-by: Yuval Baror <78553214+yuvalrhino@users.noreply.github.com>
@DanRunt DanRunt requested a review from yuvalrhino July 11, 2025 15:21
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.

2 participants