-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2055 from flatcar/tormath1/akamai
sys-apps/ignition: pull akamai patch
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
.../third_party/coreos-overlay/sys-apps/ignition/files/0022-akamai-fix-base64-decoding.patch
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
From c39e78052f563bbbf6ed47c4ddab597562effe87 Mon Sep 17 00:00:00 2001 | ||
From: Mathieu Tortuyaux <mtortuyaux@microsoft.com> | ||
Date: Mon, 24 Jun 2024 16:38:09 +0200 | ||
Subject: [PATCH] akamai: fix base64 decoding | ||
|
||
trailing \x00 character was making Ignition to fail parsing the config. | ||
It is not always the case, that is why we did not catch it earlier: when | ||
there is no padding in the base64 payload, everything was working. | ||
|
||
https://pkg.go.dev/encoding/base64#Encoding.Decode | ||
|
||
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com> | ||
--- | ||
docs/release-notes.md | 1 + | ||
internal/providers/akamai/akamai.go | 5 +++-- | ||
2 files changed, 4 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/docs/release-notes.md b/docs/release-notes.md | ||
index a73ea2a7c..c2a35dca9 100644 | ||
--- a/docs/release-notes.md | ||
+++ b/docs/release-notes.md | ||
@@ -14,6 +14,7 @@ nav_order: 9 | ||
|
||
### Bug fixes | ||
|
||
+- Fixed Akamai Ignition base64 decoding | ||
|
||
## Ignition 2.19.0 (2024-06-05) | ||
|
||
diff --git a/internal/providers/akamai/akamai.go b/internal/providers/akamai/akamai.go | ||
index c7debf3b1..648be3bee 100644 | ||
--- a/internal/providers/akamai/akamai.go | ||
+++ b/internal/providers/akamai/akamai.go | ||
@@ -86,11 +86,12 @@ func fetchConfig(f *resource.Fetcher) (types.Config, report.Report, error) { | ||
// The Linode Metadata Service requires userdata to be base64-encoded | ||
// when it is uploaded, so we will have to decode the response. | ||
data := make([]byte, base64.StdEncoding.DecodedLen(len(encoded))) | ||
- if _, err := base64.StdEncoding.Decode(data, encoded); err != nil { | ||
+ n, err := base64.StdEncoding.Decode(data, encoded) | ||
+ if err != nil { | ||
return types.Config{}, report.Report{}, fmt.Errorf("decode base64: %w", err) | ||
} | ||
|
||
- return util.ParseConfig(f.Logger, data) | ||
+ return util.ParseConfig(f.Logger, data[:n]) | ||
} | ||
|
||
// defaultTokenTTL is the time-to-live (TTL; in seconds) for an authorization |
File renamed without changes.
This file contains 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