Error if rpcpassword contains hash in conf sections#15087
Error if rpcpassword contains hash in conf sections#15087laanwj merged 1 commit intobitcoin:masterfrom meshcollider:201901_pass_hash_fix
Conversation
|
utACK |
|
Tested ACK 170523f.
diff --git a/src/util/system.cpp b/src/util/system.cpp
index ffe4d21ee..8da476289 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -863,12 +863,13 @@ static bool GetConfigOptions(std::istream& stream, std::string& error, std::vect
error = strprintf("parse error on line %i: %s, options in configuration file must be specified without leading -", linenr, str);
return false;
} else if ((pos = str.find('=')) != std::string::npos) {
- std::string name = prefix + TrimString(str.substr(0, pos), pattern);
- std::string value = TrimString(str.substr(pos + 1), pattern);
- if (used_hash && name.find("rpcpassword") != std::string::npos) {
+ std::string name = TrimString(str.substr(0, pos), pattern);
+ if (used_hash && name == "rpcpassword") {
error = strprintf("parse error on line %i, using # in rpcpassword can be ambiguous and should be avoided", linenr);
return false;
}
+ name = prefix + name;
+ std::string value = TrimString(str.substr(pos + 1), pattern);
options.emplace_back(name, value);
if ((pos = name.rfind('.')) != std::string::npos) {
sections.insert(name.substr(0, pos));
The above suggestion wouldn't catch lines like |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, 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. |
|
Edit after IRC discussion: wrong, this would mean |
|
re-utACK 8cff831 |
|
tested ACK 8cff831 |
|
post merge ACK 8cff831. |
|
Sorry for my late commet. |
Summary: 8cff83124bcac936ecc6add6dca72b125a79a08f Error if rpcpassword contains hash in conf sections (MeshCollider) Pull request description: Fixes #15075 Tree-SHA512: 08ba2a2e9a7ea228fc0e0ff9aa76da1fecbe079e3b388304a28b6399e338a4b3a38b03ab03aca880e75f14a8d2ba75ceb31a385d7989cd66db5193a79f32c4e5 --- Depends on D5756 This is a backport of Core [[bitcoin/bitcoin#15087 | PR15087]] Test Plan: ninja test_runner.py feature_config_args.py Reviewers: deadalnix, #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D5757
Summary: 8cff83124bcac936ecc6add6dca72b125a79a08f Error if rpcpassword contains hash in conf sections (MeshCollider) Pull request description: Fixes #15075 Tree-SHA512: 08ba2a2e9a7ea228fc0e0ff9aa76da1fecbe079e3b388304a28b6399e338a4b3a38b03ab03aca880e75f14a8d2ba75ceb31a385d7989cd66db5193a79f32c4e5 --- Depends on D5756 This is a backport of Core [[bitcoin/bitcoin#15087 | PR15087]] Test Plan: ninja test_runner.py feature_config_args.py Reviewers: deadalnix, #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D5757
8cff831 Error if rpcpassword contains hash in conf sections (MeshCollider) Pull request description: Fixes bitcoin#15075 Tree-SHA512: 08ba2a2e9a7ea228fc0e0ff9aa76da1fecbe079e3b388304a28b6399e338a4b3a38b03ab03aca880e75f14a8d2ba75ceb31a385d7989cd66db5193a79f32c4e5
Fixes #15075