4 Star 0 Fork 13

src-openEuler/ignition

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-backport-akamai-fix-base64-decoding.patch 1.51 KB
一键复制 编辑 原始数据 按行查看 历史
liff 提交于 2024-08-02 15:18 . backport-akamai-fix-base64-decoding
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/ignition.git
git@gitee.com:src-openeuler/ignition.git
src-openeuler
ignition
ignition
master

搜索帮助