feat: Add download files signature check #472
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request makes the following changes:
GetAddressFromHeaders
toCheckSignature
This pull request adds a signature check to the download files route to ensure requests comes from the job creator that requested the job.
Task/Issue reference
Closes: #473
Test plan
Start the stack. Run a job. Run the integration tests. Everything should work as expected.
We have also included a temporary commit to test an incorrect signature:
lilypad/pkg/http/utils.go
Lines 323 to 324 in 08a1625
Comment line 323 and uncomment 324 to force a mismatch between the reported address and the one derived from the signature. Note that this test mechanism works because we do not check signatures on any other GET route (for now).
Note that error returned to the job creator when the signature fails does not correctly report an error message because we have yet to address: #424
We will remove the temporary commit before merging this PR.
Details
This pull request should be considered a minimal first step towards job output retrieval auth. In the future, we may want to implement decentralized auth to enable other actors to download job outputs.