-
Notifications
You must be signed in to change notification settings - Fork 78
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
fix: a resumable session without a Range header should be interpreted as 0 length #2182
Conversation
… as 0 length According to https://cloud.google.com/storage/docs/performing-resumable-uploads#status-check a 308 response that does not contain a Range header should interpret as GCS having received no data. Include x-goog-gcs-idempotency-token in Json Resumable upload debug context
a525ed7
to
98521f2
Compare
google-cloud-storage/src/main/java/com/google/cloud/storage/JsonResumableSessionQueryTask.java
Outdated
Show resolved
Hide resolved
google-cloud-storage/src/main/java/com/google/cloud/storage/JsonResumableSessionQueryTask.java
Outdated
Show resolved
Hide resolved
@@ -79,6 +78,7 @@ enum JsonResumableSessionFailureScenario { | |||
.or(matches("Content-Type")) | |||
.or(matches("Range")) | |||
.or(startsWith("X-Goog-Stored-")) | |||
.or(matches("X-Goog-GCS-Idempotency-Token")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the code collapsed to startsWith("X-Goog-")
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to reduce the scope to prevent an accidental inclusion of a header that might contain a sensitive value.
If it were relaxed to x-goog-
that could pull in object metadata fields which could have sensitive values.
Since these error messages go into peoples logs, we should only include what we know is safe.
According to https://cloud.google.com/storage/docs/performing-resumable-uploads#status-check a 308 response that does not contain a Range header should interpret as GCS having received no data.
Include x-goog-gcs-idempotency-token in Json Resumable upload debug context