代码拉取完成,页面将自动刷新
From c980a87bf52063df334e490aaafa6f6368cdd41d Mon Sep 17 00:00:00 2001
From: liff <lifeifei@kylinos.cn>
Date: Fri, 2 Aug 2024 15:09:37 +0800
Subject: [PATCH] backport-akamai-fix-base64-decoding
---
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 245f32d..85a4a77 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -14,6 +14,7 @@ nav_order: 9
### Bug fixes
+- Fix Akamai Ignition base64 decoding on padded payloads
## Ignition 2.19.0 (2024-06-05)
diff --git a/internal/providers/akamai/akamai.go b/internal/providers/akamai/akamai.go
index c7debf3..648be3b 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
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。