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

SFR-2430: Set flags based on limited access permissions #494

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Apophenia
Copy link
Contributor

@Apophenia Apophenia commented Dec 30, 2024

Building the "limited" bucket names: This is pretty ugly. I wish that I had proposed the convention "drb-files-qa-limited" or "drb-files-production-limited" instead of "drb-files-limited-qa" etc. I think it would be much clearer to just build the bucket name by concatenating "limited" to the end, and this function assumes a particular naming convention anyway (an environment preceded by a hyphen on the end of the bucket name). I wonder if it's worth renaming the new buckets so that the convention is clearer and consistent; if we named them with "-limited" on the end it's something we could stick with even if we moved to a different storage provider.

@@ -26,9 +26,10 @@ def __init__(self):
self.s3_manager.createS3Client()
self.title_prefix = 'titles/publisher_backlist'
self.file_bucket = os.environ['FILE_BUCKET']

self.limited_file_bucket = self.build_limited_bucket(self.file_bucket)
Copy link
Contributor

Choose a reason for hiding this comment

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

what are your thoughts on just using the environment config variable?

f"drb-files-limited-${os.environment.get('ENVIRONMENT', 'qa')}"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that works fine, but I was (I guess arbitrarily) trying to avoid it because it felt like hard-coding the variable - like, why have os.environ['FILE_BUCKET'] if the limited bucket is just going to be concatenated from a string - but maybe it's not worth worrying about.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It also looks like Amazon has changed their pricing structure such that revealing bucket names is no longer a DDOS vector via 400-level errors, so I am less concerned about the bucket names being publicly discoverable: https://docs.aws.amazon.com/AmazonS3/latest/userguide/ErrorCodeBilling.html

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