From 892c4e43cf3685e91d7e1d7f2ab8d73c62027b68 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Thu, 7 Mar 2024 12:53:43 -0500 Subject: [PATCH] fix(x/upgrade): Stop treating inline JSON as a URL Fix #19686 --- CHANGELOG.md | 1 + x/upgrade/plan/info.go | 2 +- x/upgrade/plan/info_test.go | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b610eb219f0..f4b7bddbb259 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -94,6 +94,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i * (simulation) [#18196](https://github.com/cosmos/cosmos-sdk/pull/18196) Fix the problem of `validator set is empty after InitGenesis` in simulation test. * (baseapp) [#18551](https://github.com/cosmos/cosmos-sdk/pull/18551) Fix SelectTxForProposal the calculation method of tx bytes size is inconsistent with CometBFT * (server) [#18994](https://github.com/cosmos/cosmos-sdk/pull/18994) Update server context directly rather than a reference to a sub-object +* (x/upgrade) [#19706](https://github.com/cosmos/cosmos-sdk/pull/19706) Stop treating inline JSON as a URL. ### API Breaking Changes diff --git a/x/upgrade/plan/info.go b/x/upgrade/plan/info.go index d05c985b5419..6f132032d96d 100644 --- a/x/upgrade/plan/info.go +++ b/x/upgrade/plan/info.go @@ -54,7 +54,7 @@ func ParseInfo(infoStr string, opts ...ParseOption) (*Info, error) { } // If it's a url, download it and treat the result as the real info. - if _, err := neturl.Parse(infoStr); err == nil { + if _, err := neturl.ParseRequestURI(infoStr); err == nil { if err := ValidateURL(infoStr, parseConfig.EnforceChecksum); err != nil { return nil, err } diff --git a/x/upgrade/plan/info_test.go b/x/upgrade/plan/info_test.go index c74b4e48437e..047cd49defa6 100644 --- a/x/upgrade/plan/info_test.go +++ b/x/upgrade/plan/info_test.go @@ -76,6 +76,12 @@ func (s *InfoTestSuite) TestParseInfo() { expectedInfo: nil, expectedInError: []string{"plan info must not be blank"}, }, + { + name: "empty JSON", + infoStrMaker: makeInfoStrFuncString("{}"), + expectedInfo: &Info{}, + expectedInError: nil, + }, { name: "json binaries is wrong data type", infoStrMaker: makeInfoStrFuncString(binariesWrongJSON),