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(metadata): trim responses before parsing #540

Closed
apricote opened this issue Oct 25, 2024 · 0 comments · Fixed by #547 or #546
Closed

fix(metadata): trim responses before parsing #540

apricote opened this issue Oct 25, 2024 · 0 comments · Fixed by #547 or #546

Comments

@apricote
Copy link
Member

TL;DR

Responses from metadata service are not trimmed before parsing. They rely on underspecified behaviour of the metadata service api.

Expected behavior

Before parsing the response, we should at least trim any excessive whitespace

Observed behavior

If the response contains any whitespace (like a newline at the end of it), the parsing of some of the fields fails.

This applies to InstanceID(), PublicIPv4().

In addition, the return values of all other functions would also include the additional whitespace, leading to unexpected results downstream.

Minimal working example

No response

Log output

No response

Additional information

No response

jooola added a commit that referenced this issue Nov 5, 2024
jooola added a commit that referenced this issue Nov 5, 2024
@jooola jooola closed this as completed in 283363f Nov 5, 2024
jooola pushed a commit that referenced this issue Nov 5, 2024
🤖 I have created a release *beep* *boop*
---


##
[2.16.0](v2.15.0...v2.16.0)
(2024-11-05)


### Features

* use custom IDOrName type for schemas
([#545](#545))
([1d97017](1d97017))


### Bug Fixes

* **metadata:** trim responses before parsing
([#547](#547))
([283363f](283363f)),
closes [#540](#540)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
apricote pushed a commit to hetznercloud/fleeting-plugin-hetzner that referenced this issue Nov 5, 2024
…6.0 (hetznercloud/fleeting-plugin-hetzner!158)

This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/hetznercloud/hcloud-go/v2](https://github.com/hetznercloud/hcloud-go) | require | minor | `v2.15.0` -> `v2.16.0` |

---

### Release Notes

<details>
<summary>hetznercloud/hcloud-go (github.com/hetznercloud/hcloud-go/v2)</summary>

### [`v2.16.0`](https://github.com/hetznercloud/hcloud-go/releases/tag/v2.16.0)

[Compare Source](hetznercloud/hcloud-go@v2.15.0...v2.16.0)

##### Features

-   use custom IDOrName type for schemas ([#&#8203;545](hetznercloud/hcloud-go#545)) ([1d97017](hetznercloud/hcloud-go@1d97017))

##### Bug Fixes

-   **metadata:** trim responses before parsing ([#&#8203;547](hetznercloud/hcloud-go#547)) ([283363f](hetznercloud/hcloud-go@283363f)), closes [#&#8203;540](hetznercloud/hcloud-go#540)

</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 MR is behind base branch, or you tick the rebase/retry checkbox.

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

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4xNDIuNyIsInVwZGF0ZWRJblZlciI6IjM4LjE0Mi43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant