Skip to content

Commit

Permalink
Merge pull request #1893 from tormath1/tormath1/akamai
Browse files Browse the repository at this point in the history
akamai: fix base64 decoding
  • Loading branch information
prestist committed Jun 26, 2024
2 parents b2ea352 + 4840056 commit 7387789
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ nav_order: 9

### Bug fixes

- Fix Akamai Ignition base64 decoding on padded payloads

## Ignition 2.19.0 (2024-06-05)

Expand Down
5 changes: 3 additions & 2 deletions internal/providers/akamai/akamai.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7387789

Please sign in to comment.