-
Notifications
You must be signed in to change notification settings - Fork 149
go: Bump github.com/spf13/viper to v1.21.0 #6346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
martintomazic
wants to merge
1
commit into
master
Choose a base branch
from
martin/internal/bump-viper
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| go: Bump github.com/spf13/viper to v1.21.0 |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quickly looking at the
castPR mentioned this was fixed upstream.Not sure about bound flags error (pending a check)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cast: The minimal working example now works, so it looks that it was fixed.viper: Unit tests with v18.0 pass, so this problem is not captured with our tests. @kostko any idea what was wrong and if this has been fixed?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still an issue in the newer versions. E.g. running
e2e/runtime/runtime-dynamicscenario previouslyMaxInRuntimeMessageswas set to128but after this change is set to0, thus this check fails.rt.Executor.MaxMessagesandparams.MaxRuntimeMessageswere set to0and128respectively, but after this change this value is swapped, thus this check fails.Happy to work on that but I assume this will not be a trivial fix, else it would have been done at that time already?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems this is only relevant for e2e tests, where we do all the config gymnastics... Maybe is not even that hard to fix... update: or not captured via unit as you say.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was more relevant in the past where flags were used for everything. Now most things are passed via the YAML config file. So it shouldn't be that hard to work around?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still do this for the genesis command which seems to be the reason why
e2e/runtime/runtime-dynamic scenariois failing. Moreover, searching forviper.BindPFlags, it seems there are quite many places that rely on this pattern.I tried debugging example above, to see why the default value is no longer used after this upgrade:
initwe store the default value intoinitGenesisFlags.initGenesisFlagsto viper.initGenesisFlagstoinitGenesisCmdflags.CfgRoothashMaxRuntimeMessagesduring genesis init command execution.I see two possible reasons why this upgrade broke things:
Related to above, (ideally) we should try to avoid global state (config) and
initfunctions as they makes code hard to reason and test. Furthermore, as from the documentationviperglobal instance may get deprecated .Given my limited knowledge of
pflags,viperandcobrathis seems far from trivial task, taking the above anti-patterns into consideration. (That does not mean I am not willing to spent time fixing it).Since this is blocking
master, my suggestion would be to temporary addCVE-2025-11065to.nancy-ignore, unless we find a simple solution for it tmr.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we use the config file for most things now, why use viper at all? Just use the flags directly. It shouldn't be too hard to change that, at least in the affected locations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added CVE-2025-11065 to .nancy-ignore until 2025-12-01 as the vulnerability seems quite irrelevant so we can do this bump in peace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the last commit in this PR should also undo commit de3cc372d902ceec8f04c8e40b74676e580d345d from #6348.