Skip to content
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

chore: add warning logs for errors not thrown #31009

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

stevemilk
Copy link
Contributor

Found two errors useful for debugging snapsync should be printed out.

@@ -277,10 +277,12 @@ func ServiceGetAccountRangeQuery(chain *core.BlockChain, req *GetAccountRangePac
// Retrieve the requested state and bail out if non existent
tr, err := trie.New(trie.StateTrieID(req.Root), chain.TrieDB())
if err != nil {
log.Warn("Failed to open account trie", "root", req.Root, "err", err)
Copy link
Member

Choose a reason for hiding this comment

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

I don’t think adding this warning log makes sense. It could potentially open an attack vector where an attacker sends arbitrary account range query requests with unknown state roots, leading to an overwhelming number of warning logs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, how about I change the warning log to debug log?

Also, I notice warning logs from rpc calls:

WARN [01-09|09:18:14.746] Served eth_call                          conn=127.0.0.1:42494 reqid=3 duration="92.539µs" err="missing trie node 5eb6e371a698b8d68f665192350ffcecbbbf322916f4b51bd79bb6887da3f494 (path ) layer stale"
WARN [01-09|09:18:29.763] Served eth_call                          conn=127.0.0.1:36890 reqid=3 duration="105.81µs" err="missing trie node 5eb6e371a698b8d68f665192350ffcecbbbf322916f4b51bd79bb6887da3f494 (path ) layer stale"

From:

h.log.Warn("Served "+msg.Method, logctx...)

This warning is not frequent, but i think it could also open an attack vector. Does it make sense to change it to debug log as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

The assumptions for RPC endpoint is different: it is not assumed to be freely accessible from the internet. So crafting RPC spam calls to cause large numbers of logs is not really something that's considered from security PoV.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jwasinger Got it, thank you for explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants