Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Jun 28, 2021

All entries will be dropped when there is at least one invalid one in banlist.json. Fix this by only dropping invalid ones.

Also suggested in #20966 (comment)

@fanquake fanquake added the P2P label Jun 28, 2021
@maflcko maflcko marked this pull request as draft June 28, 2021 14:43
@practicalswift
Copy link
Contributor

Concept ACK

@DrahtBot
Copy link
Contributor

DrahtBot commented Jun 30, 2021

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

Conflicts

No conflicts as of last run.

@maflcko maflcko changed the title Drop (only) invalid entries when reading banlist Drop only invalid entries when reading banlist.json Aug 2, 2021
@maflcko maflcko force-pushed the 2106-addrdb branch 3 times, most recently from 0075737 to 77335ff Compare August 7, 2021 18:53
@naumenkogs
Copy link
Member

naumenkogs commented Sep 22, 2021

Concept ACK.
I don't think this can be exploited, because the checks are static, so the only way to use it is to persuade people in banning an invalid address.

Still, a mistake in one entry of user input should not prevent the whole ban thing from working.

@maflcko maflcko marked this pull request as ready for review September 22, 2021 07:29

BOOST_AUTO_TEST_CASE(file)
{
SetMockTime(777s);
Copy link
Member

Choose a reason for hiding this comment

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

Dropping this seems to break the test, but I don't understand why. Perhaps a comment?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ban entries from the past (banned_until=778) will be dropped, unless the time is less than that.

@naumenkogs
Copy link
Member

ACK fa7f08d

@maflcko
Copy link
Member Author

maflcko commented Nov 16, 2021

Rebased to fix silent and explicit merge conflict. Should be trivial to re-ACK

@naumenkogs
Copy link
Member

ACK eeee738

CSubNet subnet;
const auto& subnet_str = ban_entry_json[BANMAN_JSON_ADDR_KEY].get_str();
if (!LookupSubNet(subnet_str, subnet)) {
throw std::runtime_error(
strprintf("Cannot parse banned address or subnet: %s", subnet_str));
LogPrintf("Dropping entry with unparseable address or subnet: %s\n", subnet_str);
Copy link
Member

Choose a reason for hiding this comment

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

I think this error message needs to include the context (maybe "ban list entry" instead of "entry").

@laanwj
Copy link
Member

laanwj commented Dec 14, 2021

Code review ACK eeee738
Small nit about error message.

Currently all entries in the file are dropped. Fix that by only dropping the invalid ones
@maflcko
Copy link
Member Author

maflcko commented Dec 14, 2021

Thanks, should be trivial to re-review with:

git range-diff bitcoin-core/master eeee738d1c faa6c3d44c --word-diff-regex=.

@laanwj
Copy link
Member

laanwj commented Dec 15, 2021

Re-ACK faa6c3d

@laanwj laanwj merged commit 2d0bdb2 into bitcoin:master Dec 15, 2021
@maflcko maflcko deleted the 2106-addrdb branch December 15, 2021 12:11
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 15, 2021
faa6c3d net: Drop only invalid entries when reading banlist.json (MarcoFalke)

Pull request description:

  All entries will be dropped when there is at least one invalid one in `banlist.json`. Fix this by only dropping invalid ones.

  Also suggested in bitcoin#20966 (comment)

ACKs for top commit:
  laanwj:
    Re-ACK faa6c3d

Tree-SHA512: 5a58e7f1dcabf78d0c65d8c6d5d997063af1efeaa50ca7730fc00056fda7e0061b6f7a38907ea045fe667c9f61d392e01e556b425a95e6b126e3c41cd33deb83
@bitcoin bitcoin locked and limited conversation to collaborators Dec 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants