Skip to content

Conversation

@promag
Copy link
Contributor

@promag promag commented Nov 23, 2020

Invalid -rpcauth arguments are currently silently ignored. This make server initialization fail if any -rpcauth is invalid.

@laanwj
Copy link
Member

laanwj commented Nov 23, 2020

Concept ACK

As it is a end-user affecting change it needs a brief (1 line) mention in the release notes.

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK 9860537473b160dfabb033f598848d8a60a339dc. Nice to get this better error handling and test coverage!

@maflcko maflcko changed the title qa: Validate -rpcauth arguments rpc: Validate -rpcauth arguments Nov 23, 2020
@maflcko
Copy link
Member

maflcko commented Nov 23, 2020

cr ACK 9860537473b160dfabb033f598848d8a60a339dc

@jonatack
Copy link
Member

Concept ACK

@promag
Copy link
Contributor Author

promag commented Nov 23, 2020

As it is a end-user affecting change it needs a brief (1 line) mention in the release notes.

done

@maflcko
Copy link
Member

maflcko commented Nov 23, 2020

cr ACK 35838a191f0e7a91aeeb5cf3e95b2fac022fcb04

@jonatack
Copy link
Member

jonatack commented Nov 23, 2020

ci (unrelated, I suppose, but noting it before it's restarted)

163/195 - p2p_fingerprint.py failed, Duration: 2 s
stdout:
2020-11-23T19:08:44.357000Z TestFramework (INFO): Initializing test directory /tmp/cirrus-ci-build/ci/scratch/test_runner/test_runner_₿_🏃_20201123_184330/p2p_fingerprint_29
2020-11-23T19:08:45.474000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 126, in main
    self.run_test()
  File "/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/p2p_fingerprint.py", line 110, in run_test
    assert "block" not in node0.last_message
AssertionError

@maflcko
Copy link
Member

maflcko commented Nov 23, 2020

Please don't restart a build without filing a bug. Either leave the failure, so that it can be found when scraping the logs with automated tools/manually, or file a bug if this is an intermittent failure. See also

If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log. ( https://cirrus-ci.com/task/5542990686978048?command=ci#L6034 )

Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach ACK 35838a191f0e7a91aeeb5cf3e95b2fac022fcb04

@promag promag force-pushed the 2020-11-validate-rpcauth branch from 35838a1 to 053b4fb Compare November 23, 2020 21:03
@promag
Copy link
Contributor Author

promag commented Nov 23, 2020

Addressed @jonatack review.

@DrahtBot
Copy link
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 053b4fb


Changes to Wallet or GUI related settings can be found in the GUI or Wallet section below.

- Passing an invalid `-rpcauth` argument now cause bitcoind to fail to start. (#20461)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"now cause" should be either "now causes" or "will now cause"

Copy link
Member

@luke-jr luke-jr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept NACK. Additional fields is not necessarily an error.

A debug log line sounds fine.

@maflcko
Copy link
Member

maflcko commented Nov 25, 2020

review ACK 053b4fb

@promag
Copy link
Contributor Author

promag commented Nov 25, 2020

Additional fields is not necessarily an error.

@luke-jr what do you suggest? Ignore the whole argument? Just use the the first 3 fields? Not sure about the debug log since it's a sensitive value.

@practicalswift
Copy link
Contributor

Concept ACK: failing swiftly and loudly is better than failing silently

@luke-jr
Copy link
Member

luke-jr commented Nov 25, 2020

what do you suggest? Ignore the whole argument?

Yes, at this startup stage. It will still fail loudly when the user attempts to authenticate later. (Maybe it would make sense to have a special error message returned for users with unrecognised configurations?)

Just use the the first 3 fields?

No, this would potentially grant permissions not intended.

Not sure about the debug log since it's a sensitive value.

The username isn't (maybe the line number if it's a rpcauthfile).

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK 053b4fb. Only changes since last review are moving a variable declaration and adding a comment, release notes, and a const.

I think this PR looks good in it's current form. It seems to me the changes Luke is asking for would make this PR slightly worse. They'd make code more complicated and configuration problems harder to detect because errors would happen at authorization time instead of startup time. They also wouldn't seem to enable useful behavior because unrecognized options would still be rejected, just at a later time. Maybe Luke you could give an example of when the behavior you're suggesting might be useful?

I think if it comes down to a choice between Luke's more limited error reporting or no error reporting at all Luke's approach would be better. But current PR seems best, as far as I can tell

@promag
Copy link
Contributor Author

promag commented Dec 2, 2020

I think Luke case is to support same conf between knots and core?

@ryanofsky
Copy link
Contributor

I think Luke case is to support same conf between knots and core?

I don't understand how. What's the example situation where you would want to use the same configuration for knots and core, but have knots authorize RPC requests which core rejects? What would the requests be? Who would the users be? I can't think of a situation connected to reality where this would be useful. Just an opinion, but I think it would be good to think about specific situations where this feature could be useful before implementing it.

@maflcko maflcko merged commit 283f22c into bitcoin:master Dec 2, 2020
@promag promag deleted the 2020-11-validate-rpcauth branch December 2, 2020 09:24
@promag
Copy link
Contributor Author

promag commented Dec 2, 2020

@ryanofsky right, I'm just guessing.

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 2, 2020
053b4fb doc: Release note regarding -rpcauth validation (João Barbosa)
4600132 rpc: Validate -rpcauth arguments (João Barbosa)
d37c813 rpc: Refactor to process -rpcauth once (João Barbosa)

Pull request description:

  Invalid `-rpcauth` arguments are currently silently ignored. This make server initialization fail if any `-rpcauth` is invalid.

ACKs for top commit:
  MarcoFalke:
    review ACK 053b4fb
  jonatack:
    ACK 053b4fb
  ryanofsky:
    Code review ACK 053b4fb. Only changes since last review are moving a variable declaration and adding a comment, release notes, and a `const`.

Tree-SHA512: c99923d4a121f0c9f882b07f5402ea53e9b2d9455ad34468a094ffab1d64df26c82e1279734c0d42bc2e113eae7b581fbc3be52f3ed4a2d7450d11793afcf406
@luke-jr
Copy link
Member

luke-jr commented Dec 2, 2020

So users don't need to swap out their rpcauth config to downgrade. This basically means people using advanced rpcauth features couldn't run Core on their system anymore without annoying additional steps...

@ryanofsky
Copy link
Contributor

So users don't need to swap out their rpcauth config to downgrade. This basically means people using advanced rpcauth features couldn't run Core on their system anymore without annoying additional steps...

Ok IIUC there is no specific situation which causes a problem, just general idea to avoid overly strict validation of config options for more flexibility. I don't disagree with that and do think this could be a warning instead of an error. This all just seemed like an unlikely point of friction, so I was confused if there was more to explain the change requests and concept nack. Any followup that keeps an early error or warning seems good to me!

@promag
Copy link
Contributor Author

promag commented Dec 2, 2020

Might make sense to have a -strict option for those that wish to have and keep clean configurations.

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants