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

Use AWS signature v4 for presigned POST URLs #109

Merged
merged 17 commits into from
Mar 25, 2022

Conversation

jonathansick
Copy link
Member

@jonathansick jonathansick commented Mar 20, 2022

The v4 signature algorithm is required for new AWS regions, and v2 is being deprecated actively from older regions.

Additional changes:

  • New Organization columns: aws_region and bucket_public_read. The former is needed for enabling the v4 algorithm and the latter provider control over whether objects in the S3 bucket should be public (LTD Proxy users should set this to False).

  • Prevent databases being stamped with new database version until the migration actually happens

  • Fix compatibility with setuptools 61 package discovery

  • Fix compatibility with mypy 0.942

@jonathansick jonathansick force-pushed the u/jsickcodes/s3-presigned-post-v4 branch 4 times, most recently from 45a8894 to 52448a1 Compare March 24, 2022 19:32
This allows orgs to set whether objects should be public-readable from
their bucket.

Right now this change is hard-coded via a property on the Organization
model, but will ultimately become a database column.
The v4 signature algorithm is required for new AWS regions, and v2 is
being deprecated actively from older regions.
Also refactor code for getting the AWS session to embed the region
into the authentication, while also configuring the S3 client to use v4
signature verification.
An error with PATCH /v1/orgs/:org/projects/:project/builds was being
handled to roll-back the database, but this resulted in a success (202)
being returned to the client rather than an error message.
This was a holdover from Keeper v1 to maintain consistency in logging,
but overall its not safe to do this because the v1 APIs may not be
enabled for a given deployment.
These appeared with mypy 0.942.
This will eventually be fixed by moving to a src-based package layout.
These columns for Organization replace the stand-in properties used for
development. They are initially set as nullable to support migrations,
with getter methods to support the migration for type checking.
This ensures that DB stamping only happens when

a. the DB is initially created
b. when a migration is run
@jonathansick jonathansick force-pushed the u/jsickcodes/s3-presigned-post-v4 branch from 3b070fa to 05426ab Compare March 25, 2022 18:59
@jonathansick jonathansick merged commit 6c80010 into main Mar 25, 2022
@jonathansick jonathansick deleted the u/jsickcodes/s3-presigned-post-v4 branch March 25, 2022 19:43
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.

1 participant