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

storage: content-type condition does not appear in generated V4 post policy #2767

Closed
pierreis opened this issue Aug 24, 2020 · 2 comments · Fixed by #2769
Closed

storage: content-type condition does not appear in generated V4 post policy #2767

pierreis opened this issue Aug 24, 2020 · 2 comments · Fixed by #2769
Assignees
Labels
api: storage Issues related to the Cloud Storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@pierreis
Copy link
Contributor

pierreis commented Aug 24, 2020

Client

Storage

Code

e.g.

opts := &storage.PostPolicyV4Options{
  GoogleAccessID: email,
  PrivateKey:     privateKey,
  Expires:        time.Now().Add(10*time.Minute),
  Fields: &storage.PolicyV4Fields{
    ContentType: "text/plain",
  },
}
googlePolicy, err := storage.GenerateSignedPostPolicyV4(c.config.GoogleUploadBucket, objectKey, opts)

Expected behavior

The provided Content-Type should be included as a condition in the signed policy, per https://cloud.google.com/storage/docs/xml-api/post-object.

Actual behavior

The provided Content-Type is not included in the signed policy. Example resulting policy:

{
  "URL": "https://storage.googleapis.com/mybucket/",
  "Fields": {
    "key": "myobject",
    "policy": "eyJjb25kaXRpb25zIjpbeyJidWNrZXQiOiJteWJ1Y2tldCJ9LHsia2V5IjoibXlvYmplY3QifSx7IngtZ29vZy1kYXRlIjoiMjAyMDA4MjRUMTAyMjIwWiJ9LHsieC1nb29nLWNyZWRlbnRpYWwiOiJ0ZXN0QGR1bW15LmlhbS5nc2VydmljZWFjY291bnQuY29tLzIwMjAwODI0L2F1dG8vc3RvcmFnZS9nb29nNF9yZXF1ZXN0In0seyJ4LWdvb2ctYWxnb3JpdGhtIjoiR09PRzQtUlNBLVNIQTI1NiJ9XSwiZXhwaXJhdGlvbiI6IjIwMjAtMDgtMjRUMTA6MzI6MjBaIn0=",
    "x-goog-algorithm": "GOOG4-RSA-SHA256",
    "x-goog-credential": "test@dummy.iam.gserviceaccount.com/20200824/auto/storage/goog4_request",
    "x-goog-date": "20200824T102220Z",
    "x-goog-signature": "[redacted]"
  }
}
@pierreis pierreis added the triage me I really want to be triaged. label Aug 24, 2020
@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Aug 24, 2020
@pierreis pierreis changed the title storage: storage: content-type condition does not appear in generated V4 post policy Aug 24, 2020
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Aug 29, 2020
@tritone tritone added status: investigating The issue is under investigation, which is determined to be non-trivial. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed 🚨 This issue needs some love. triage me I really want to be triaged. status: investigating The issue is under investigation, which is determined to be non-trivial. labels Sep 2, 2020
tritone added a commit to tritone/google-cloud-go that referenced this issue Sep 15, 2020
This was recently added to conformance-tests to catch the case
that was noticed in googleapis#2767. We can remove the skip in the open
PR meant to fix that issue (googleapis#2769).
tritone added a commit that referenced this issue Sep 15, 2020
This was recently added to conformance-tests to catch the case
that was noticed in #2767. We can remove the skip in the open
PR meant to fix that issue (#2769).
gcf-merge-on-green bot pushed a commit that referenced this issue Sep 17, 2020
…e post policy (#2769)

This merge request adds content type, disposition and encoding in storage post policy. These conditions were present in the `PolicyV4Fields`, but ignored.

Fixes #2767.
@tritone
Copy link
Contributor

tritone commented Sep 17, 2020

A fix for this is now merged; thanks @pierreis for your contribution. Planning on cutting a library release next week that will include this.

@pierreis
Copy link
Contributor Author

Awesome. Thank you for your involvement!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
3 participants