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

Fix generation of signed urls for blobs containing spaces and other special chars #1277

Merged
merged 4 commits into from
Sep 22, 2016

Conversation

ostronom
Copy link

As it is stated here https://cloud.google.com/storage/docs/access-control/signed-urls#about-canonical-resources:

Be sure to copy the HTTP request path literally: that is, you should include all URL encoding (percent signs) in the string that you create

Because there was no encoding of spaces, all blobs with spaces were provided with invalid signatures. This pull request fixes this.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 22, 2016
@coveralls
Copy link

Coverage Status

Coverage remained the same at 84.603% when pulling a4d75e9 on ostronom:master into 05a2a32 on GoogleCloudPlatform:master.

@mziccard
Copy link
Contributor

@ostronom thanks for doing this! Incredibly, we seem to have missed this for a very long time.

What about adding a test for a blob name that needs encoding? I can do it myself if don't have time :)

@coveralls
Copy link

Coverage Status

Coverage remained the same at 84.603% when pulling cd7e858 on ostronom:master into 05a2a32 on GoogleCloudPlatform:master.

@ostronom
Copy link
Author

I've added test for this. Fortunately, it is passing :)

@@ -1300,6 +1302,39 @@ public void testSignUrlWithOptions() throws NoSuchAlgorithmException, InvalidKey
}

@Test
public void testSignUrlForBlobWithSpecialChars() throws NoSuchAlgorithmException, InvalidKeyException,

This comment was marked as spam.

@mziccard
Copy link
Contributor

@ostronom Great job! Just a minor annoying comment about formatting :)

// List of chars under test were taken from https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters
char[] specialChars = new char[]{'!','#','$','&','\'','(',')','*','+',',',':',';','=','?','@','[',']'};
public void testSignUrlForBlobWithSpecialChars() throws NoSuchAlgorithmException,
InvalidKeyException, SignatureException, UnsupportedEncodingException {

This comment was marked as spam.

This comment was marked as spam.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 84.603% when pulling 66b83a0 on ostronom:master into 05a2a32 on GoogleCloudPlatform:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 84.603% when pulling 66b83a0 on ostronom:master into 05a2a32 on GoogleCloudPlatform:master.

@mziccard mziccard merged commit ac786de into googleapis:master Sep 22, 2016
github-actions bot pushed a commit that referenced this pull request Aug 9, 2022
…cies to v3 (#1277)

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:google-cloud-shared-dependencies](https://togithub.com/googleapis/java-shared-dependencies) | `2.13.0` -> `3.0.1` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/3.0.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/3.0.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/3.0.1/compatibility-slim/2.13.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/3.0.1/confidence-slim/2.13.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/java-shared-dependencies</summary>

### [`v3.0.1`](https://togithub.com/googleapis/java-shared-dependencies/blob/HEAD/CHANGELOG.md#&#8203;301-httpsgithubcomgoogleapisjava-shared-dependenciescomparev300v301-2022-08-02)

[Compare Source](https://togithub.com/googleapis/java-shared-dependencies/compare/v3.0.0...v3.0.1)

##### Dependencies

-   update dependency com.google.code.gson:gson to v2.9.1 ([#&#8203;766](https://togithub.com/googleapis/java-shared-dependencies/issues/766)) ([f7b2b06](https://togithub.com/googleapis/java-shared-dependencies/commit/f7b2b06b80e3e95ff8ab9b1d6a2638ef3069298a))
-   update gax.version to v2.18.7 ([#&#8203;767](https://togithub.com/googleapis/java-shared-dependencies/issues/767)) ([9650368](https://togithub.com/googleapis/java-shared-dependencies/commit/96503682e98cdf348ea2c1365a03a60f4322c712))
-   update google.core.version to v2.8.6 ([#&#8203;770](https://togithub.com/googleapis/java-shared-dependencies/issues/770)) ([cfd4377](https://togithub.com/googleapis/java-shared-dependencies/commit/cfd4377dc178cebb4724065d55d185ce03988d55))

### [`v3.0.0`](https://togithub.com/googleapis/java-shared-dependencies/blob/HEAD/CHANGELOG.md#&#8203;300-httpsgithubcomgoogleapisjava-shared-dependenciescomparev2130v300-2022-07-29)

[Compare Source](https://togithub.com/googleapis/java-shared-dependencies/compare/v2.13.0...v3.0.0)

##### Bug Fixes

-   enable longpaths support for windows test ([#&#8203;1485](https://togithub.com/googleapis/java-shared-dependencies/issues/1485)) ([#&#8203;738](https://togithub.com/googleapis/java-shared-dependencies/issues/738)) ([11bc8f8](https://togithub.com/googleapis/java-shared-dependencies/commit/11bc8f81f28be88a97fdeafca21724e33638770c))

##### Dependencies

-   update dependency com.google.api-client:google-api-client-bom to v1.35.2 ([#&#8203;729](https://togithub.com/googleapis/java-shared-dependencies/issues/729)) ([1fa59af](https://togithub.com/googleapis/java-shared-dependencies/commit/1fa59af80abb9f278f57658c10158567e825fec6))
-   update dependency com.google.api-client:google-api-client-bom to v2 ([#&#8203;746](https://togithub.com/googleapis/java-shared-dependencies/issues/746)) ([2dcb2e0](https://togithub.com/googleapis/java-shared-dependencies/commit/2dcb2e071e0ba0eea21bb575bd13cd559d4a1ca6))
-   update dependency com.google.api.grpc:grpc-google-common-protos to v2.9.2 ([#&#8203;741](https://togithub.com/googleapis/java-shared-dependencies/issues/741)) ([3352d6c](https://togithub.com/googleapis/java-shared-dependencies/commit/3352d6c36111c04e3f6f3e6360470fa3efb10d8f))
-   update dependency com.google.auth:google-auth-library-bom to v1.8.0 ([#&#8203;726](https://togithub.com/googleapis/java-shared-dependencies/issues/726)) ([2c5d64c](https://togithub.com/googleapis/java-shared-dependencies/commit/2c5d64c127db8384e49113acfeac6928716a2d7f))
-   update dependency com.google.auth:google-auth-library-bom to v1.8.1 ([#&#8203;742](https://togithub.com/googleapis/java-shared-dependencies/issues/742)) ([4f53527](https://togithub.com/googleapis/java-shared-dependencies/commit/4f53527bda7f40896711b7c1d1c02453321ffbc8))
-   update dependency com.google.cloud:first-party-dependencies to v2 ([#&#8203;747](https://togithub.com/googleapis/java-shared-dependencies/issues/747)) ([e970ac0](https://togithub.com/googleapis/java-shared-dependencies/commit/e970ac0599941c825dc2516146a7c6673e68a9b9))
-   update dependency com.google.cloud:grpc-gcp to v1.2.1 ([#&#8203;751](https://togithub.com/googleapis/java-shared-dependencies/issues/751)) ([b3284b6](https://togithub.com/googleapis/java-shared-dependencies/commit/b3284b6ee52a96a6ea8696a05a94443df9ee5b9f))
-   update dependency com.google.cloud:third-party-dependencies to v2 ([#&#8203;748](https://togithub.com/googleapis/java-shared-dependencies/issues/748)) ([573b41a](https://togithub.com/googleapis/java-shared-dependencies/commit/573b41a69504372741cbeb01dd200e7c71967186))
-   update dependency com.google.http-client:google-http-client-bom to v1.42.1 ([#&#8203;730](https://togithub.com/googleapis/java-shared-dependencies/issues/730)) ([6b47126](https://togithub.com/googleapis/java-shared-dependencies/commit/6b47126686b603a5d112e097ce6aa3a1880daf6f))
-   update dependency com.google.http-client:google-http-client-bom to v1.42.2 ([#&#8203;749](https://togithub.com/googleapis/java-shared-dependencies/issues/749)) ([299d7b0](https://togithub.com/googleapis/java-shared-dependencies/commit/299d7b0d4920644e2c3070d12dd1d97da17a5e88))
-   update dependency com.google.protobuf:protobuf-bom to v3.21.2 ([#&#8203;722](https://togithub.com/googleapis/java-shared-dependencies/issues/722)) ([7a96b12](https://togithub.com/googleapis/java-shared-dependencies/commit/7a96b1259a526b63e9376fd6cc18b27cddeb5f0f))
-   update dependency com.google.protobuf:protobuf-bom to v3.21.3 ([#&#8203;756](https://togithub.com/googleapis/java-shared-dependencies/issues/756)) ([3d0bac2](https://togithub.com/googleapis/java-shared-dependencies/commit/3d0bac23487aebb94267c0708f41ff6c02a028a4))
-   update dependency com.google.protobuf:protobuf-bom to v3.21.4 ([#&#8203;759](https://togithub.com/googleapis/java-shared-dependencies/issues/759)) ([5a54ef1](https://togithub.com/googleapis/java-shared-dependencies/commit/5a54ef1a2d56244166d4fcc46041d62c0dc4b411))
-   update dependency io.grpc:grpc-bom to v1.48.0 ([#&#8203;752](https://togithub.com/googleapis/java-shared-dependencies/issues/752)) ([20ac908](https://togithub.com/googleapis/java-shared-dependencies/commit/20ac908932a5e7c8e581bdfcd68579d7e1cedd5f))
-   update dependency org.checkerframework:checker-qual to v3.23.0 ([#&#8203;736](https://togithub.com/googleapis/java-shared-dependencies/issues/736)) ([fc01d8f](https://togithub.com/googleapis/java-shared-dependencies/commit/fc01d8f93f391f12fdb800d5006f0b4505832eeb))
-   update gax.version to v2.18.3 ([#&#8203;731](https://togithub.com/googleapis/java-shared-dependencies/issues/731)) ([e8ee554](https://togithub.com/googleapis/java-shared-dependencies/commit/e8ee554707acb2f71c739d08e2ff02fbe43ffa52))
-   update gax.version to v2.18.4 ([#&#8203;735](https://togithub.com/googleapis/java-shared-dependencies/issues/735)) ([11c7415](https://togithub.com/googleapis/java-shared-dependencies/commit/11c74152a84697924de3a0e838b05f606c3098f7))
-   update gax.version to v2.18.5 ([#&#8203;758](https://togithub.com/googleapis/java-shared-dependencies/issues/758)) ([7469fc1](https://togithub.com/googleapis/java-shared-dependencies/commit/7469fc1cc5095b39a5738e60156711a268f6e052))
-   update gax.version to v2.18.6 ([#&#8203;763](https://togithub.com/googleapis/java-shared-dependencies/issues/763)) ([b5ca2f7](https://togithub.com/googleapis/java-shared-dependencies/commit/b5ca2f7b4d81c705823253f4f03363a32d2be48b))
-   update google.common-protos.version to v2.9.1 ([#&#8203;724](https://togithub.com/googleapis/java-shared-dependencies/issues/724)) ([5213dbb](https://togithub.com/googleapis/java-shared-dependencies/commit/5213dbbfa9c9b73d2420ec2be7782f16c9c4955f))
-   update google.core.version to v2.8.1 ([#&#8203;725](https://togithub.com/googleapis/java-shared-dependencies/issues/725)) ([575858a](https://togithub.com/googleapis/java-shared-dependencies/commit/575858a60f76e46bbc2a2435c2b6c01c8f4ab681))
-   update google.core.version to v2.8.3 ([#&#8203;760](https://togithub.com/googleapis/java-shared-dependencies/issues/760)) ([cb10ae4](https://togithub.com/googleapis/java-shared-dependencies/commit/cb10ae4b76939215ea465af74163b3d4ad65a548))
-   update google.core.version to v2.8.4 ([#&#8203;762](https://togithub.com/googleapis/java-shared-dependencies/issues/762)) ([821daaf](https://togithub.com/googleapis/java-shared-dependencies/commit/821daafefdbcfdfe6e363e580747538096a562ef))
-   update google.core.version to v2.8.5 ([#&#8203;764](https://togithub.com/googleapis/java-shared-dependencies/issues/764)) ([a1f8f50](https://togithub.com/googleapis/java-shared-dependencies/commit/a1f8f501b54143a2cec8e72efd4ceb3ce47f13ae))
-   update iam.version to v1.5.0 ([#&#8203;732](https://togithub.com/googleapis/java-shared-dependencies/issues/732)) ([9dce0e5](https://togithub.com/googleapis/java-shared-dependencies/commit/9dce0e5199c1e425119adc804304958f58003a27))
-   update iam.version to v1.5.1 ([#&#8203;737](https://togithub.com/googleapis/java-shared-dependencies/issues/737)) ([df39168](https://togithub.com/googleapis/java-shared-dependencies/commit/df391685d42fcb1b04f03ab1380a594893bdce37))
-   update iam.version to v1.5.2 ([#&#8203;743](https://togithub.com/googleapis/java-shared-dependencies/issues/743)) ([cdde697](https://togithub.com/googleapis/java-shared-dependencies/commit/cdde697f25a89fc8c2ec7eae6b7c54f69977bb1c))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-asset).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xMjcuNCIsInVwZGF0ZWRJblZlciI6IjMyLjE0My4xIn0=-->
github-actions bot pushed a commit that referenced this pull request Aug 9, 2022
🤖 I have created a release *beep* *boop*
---


## [3.5.0](googleapis/java-asset@v3.4.2...v3.5.0) (2022-08-09)


### Features

* Remove v1p4beta1 API protos. v1p4beta1 has been deprecated and announced through MSA. This is the cleanup ([ebab5c6](googleapis/java-asset@ebab5c6))


### Dependencies

* update dependency com.google.api.grpc:proto-google-cloud-orgpolicy-v1 to v2.3.0 ([#1257](googleapis/java-asset#1257)) ([c61c0e8](googleapis/java-asset@c61c0e8))
* update dependency com.google.api.grpc:proto-google-cloud-os-config-v1 to v2.5.1 ([#1279](googleapis/java-asset#1279)) ([5995764](googleapis/java-asset@5995764))
* update dependency com.google.api.grpc:proto-google-cloud-pubsub-v1 to v1.102.10 ([#1292](googleapis/java-asset#1292)) ([76f886e](googleapis/java-asset@76f886e))
* update dependency com.google.api.grpc:proto-google-cloud-pubsub-v1 to v1.102.9 ([#1280](googleapis/java-asset#1280)) ([a35d490](googleapis/java-asset@a35d490))
* update dependency com.google.cloud:google-cloud-bigquery to v2.14.0 ([#1272](googleapis/java-asset#1272)) ([60763d4](googleapis/java-asset@60763d4))
* update dependency com.google.cloud:google-cloud-bigquery to v2.14.1 ([#1274](googleapis/java-asset#1274)) ([8b4efa5](googleapis/java-asset@8b4efa5))
* update dependency com.google.cloud:google-cloud-bigquery to v2.14.2 ([#1294](googleapis/java-asset#1294)) ([ff76d3a](googleapis/java-asset@ff76d3a))
* update dependency com.google.cloud:google-cloud-bigquery to v2.14.3 ([#1296](googleapis/java-asset#1296)) ([4c2a6ec](googleapis/java-asset@4c2a6ec))
* update dependency com.google.cloud:google-cloud-core to v2.8.3 ([#1273](googleapis/java-asset#1273)) ([1ad7821](googleapis/java-asset@1ad7821))
* update dependency com.google.cloud:google-cloud-core to v2.8.4 ([#1275](googleapis/java-asset#1275)) ([a45d90c](googleapis/java-asset@a45d90c))
* update dependency com.google.cloud:google-cloud-core to v2.8.5 ([#1276](googleapis/java-asset#1276)) ([985d6e6](googleapis/java-asset@985d6e6))
* update dependency com.google.cloud:google-cloud-core to v2.8.6 ([#1283](googleapis/java-asset#1283)) ([26f527c](googleapis/java-asset@26f527c))
* update dependency com.google.cloud:google-cloud-core to v2.8.7 ([#1285](googleapis/java-asset#1285)) ([fe40190](googleapis/java-asset@fe40190))
* update dependency com.google.cloud:google-cloud-core to v2.8.8 ([#1288](googleapis/java-asset#1288)) ([566e032](googleapis/java-asset@566e032))
* update dependency com.google.cloud:google-cloud-pubsub to v1.120.1 ([#1229](googleapis/java-asset#1229)) ([dcc463c](googleapis/java-asset@dcc463c))
* update dependency com.google.cloud:google-cloud-pubsub to v1.120.10 ([#1293](googleapis/java-asset#1293)) ([d6188ca](googleapis/java-asset@d6188ca))
* update dependency com.google.cloud:google-cloud-pubsub to v1.120.9 ([#1281](googleapis/java-asset#1281)) ([79d5a3c](googleapis/java-asset@79d5a3c))
* update dependency com.google.cloud:google-cloud-resourcemanager to v1.5.0 ([#1261](googleapis/java-asset#1261)) ([1cca78c](googleapis/java-asset@1cca78c))
* update dependency com.google.cloud:google-cloud-resourcemanager to v1.5.2 ([#1287](googleapis/java-asset#1287)) ([a399744](googleapis/java-asset@a399744))
* update dependency com.google.cloud:google-cloud-shared-dependencies to v3 ([#1277](googleapis/java-asset#1277)) ([7a27f49](googleapis/java-asset@7a27f49))
* update dependency com.google.cloud:google-cloud-storage to v2.10.0 ([#1282](googleapis/java-asset#1282)) ([66ba2ad](googleapis/java-asset@66ba2ad))
* update dependency com.google.cloud:google-cloud-storage to v2.11.0 ([#1286](googleapis/java-asset#1286)) ([4df8988](googleapis/java-asset@4df8988))
* update dependency com.google.cloud:google-cloud-storage to v2.11.1 ([#1291](googleapis/java-asset#1291)) ([3af9102](googleapis/java-asset@3af9102))
* update dependency com.google.cloud:google-cloud-storage to v2.11.2 ([#1295](googleapis/java-asset#1295)) ([693d42b](googleapis/java-asset@693d42b))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
github-actions bot pushed a commit to yoshi-code-bot/google-cloud-java that referenced this pull request Oct 6, 2022
…googleapis#1277)

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:google-cloud-core](https://togithub.com/googleapis/java-core) | `2.8.19` -> `2.8.20` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core/2.8.20/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core/2.8.20/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core/2.8.20/compatibility-slim/2.8.19)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core/2.8.20/confidence-slim/2.8.19)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/java-core</summary>

### [`v2.8.20`](https://togithub.com/googleapis/java-core/blob/HEAD/CHANGELOG.md#&#8203;2820-httpsgithubcomgoogleapisjava-corecomparev2819v2820-2022-10-02)

[Compare Source](https://togithub.com/googleapis/java-core/compare/v2.8.19...v2.8.20)

##### Dependencies

-   Update dependency com.google.api:gax-bom to v2.19.2 ([#&googleapis#8203;969](https://togithub.com/googleapis/java-core/issues/969)) ([1151449](https://togithub.com/googleapis/java-core/commit/1151449c061ab51c45982444db5f9da9d2ce4fb7))
-   Update dependency com.google.api.grpc:proto-google-common-protos to v2.9.6 ([#&googleapis#8203;967](https://togithub.com/googleapis/java-core/issues/967)) ([4a7b524](https://togithub.com/googleapis/java-core/commit/4a7b524fa366484825bedbc0a4f86d4551a6a0e8))
-   Update dependency io.grpc:grpc-bom to v1.49.2 ([#&googleapis#8203;966](https://togithub.com/googleapis/java-core/issues/966)) ([b7738aa](https://togithub.com/googleapis/java-core/commit/b7738aa71fb9cf0994e4ad1dae4bae433754cda0))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-automl).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4yMTMuMCIsInVwZGF0ZWRJblZlciI6IjMyLjIxMy4wIn0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants