Repository navigation
Conversation
`linode-cli obj signurl` passed any expiry straight to generate_presigned_url. A URL signed with Signature Version 4 can be valid for at most 604800 seconds (7 days), so a longer expiry produced a URL that only returns Access Denied, with no hint as to why. Validate the expiry before signing, for both the epoch and +offset forms: exit with an argument error if it is not an integer, not in the future, or more than 7 days away. Validation now happens before the client is created, so an invalid expiry fails without creating Object Storage keys. Document the unit and the limit in the help text, which resolves the TODO next to it. Fixes linode#894
lyelgate
requested review from
psnoch-akamai and
yec-akamai
and removed request for
a team
November 1, 2026 11:20
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
📝 Description
What does this PR do and why is this change necessary?
Fixes #894.
linode-cli obj signurlpassed any expiry straight togenerate_presigned_url. A URL signed with Signature Version 4, the client's default, can be valid for at most 604800 seconds (7 days), so a longer expiry printed a URL that only returnsAccess Denied. That matches the report:+31536000fails while a 24-hour expiry works.This PR validates the expiry before signing, for both forms (epoch time and
+offset), and exits withExitCodes.ARGUMENT_ERRORand a message on stderr when it is:The expiry is 31536000 seconds from now, but a signed URL can be valid for at most 604800 seconds (7 days)+0, or an epoch time in the past):The expiry must be in the future+an-hour):Invalid expiry '+an-hour': expected an epoch time or an offset like +3600, in seconds. Before, this raised aValueErrortraceback.Other changes:
MAX_SIGNED_URL_EXPIRYconstant inobj/config.py, next to the plugin's other constants.get_client(). Creating the client can create Object Storage keys for the user, so an invalid expiry now fails without touching their account.EXPIRYhelp text now gives the unit (seconds) and the 7-day maximum, which resolves theTODOnext to it.✔️ How to Test
What are the steps to reproduce the issue or verify the changes?
How do I run the relevant unit/integration tests?
The new tests in
tests/unit/test_plugin_obj.pymock the S3 client, so no account is needed. They cover a valid offset, the exact 7-day boundary, a valid epoch time, and seven rejected values (over the limit by offset and by epoch time,+0, a past epoch time, and non-numeric input). The rejected cases also check that the client is never created. The rejection cases fail without this change.black,isort,autoflakeandpylintpass.