Skip to content

ipfs swarm limit all: returns empty "" Service and Protocol name #9577

@lidel

Description

@lidel

This is a potential source of bugs due to val != "" checks returning invalid result.

To reproduce, run node for a while, then inspect the output of ipfs swarm limit all.
At some point, you will see protocol and service named "" (empty string).

I think I've seen error about empty PeerID suring --reset at some point too, but was not able to reproduce.

Could be a bug, or could be a malicious service that uses zero-length protocol to stay hidden.
Either way, we should not use "" and have "(empty)" or something, because "" leads to bugs.

"Protocols": {
        "": {
            "Conns": 1000000000,
            "ConnsInbound": 1000000000,
            "ConnsOutbound": 1000000000,
            "FD": 1000000000,
            "Memory": 1000000000,
            "Streams": 1000000000,
            "StreamsInbound": 1000000000,
            "StreamsOutbound": 1000000000
        },
        "/ipfs/bitswap/1.2.0": {
            "Conns": 1000000000,
            "ConnsInbound": 1000000000,
            "ConnsOutbound": 1000000000,
            "FD": 1000000000,
            "Memory": 1000000000,
            "Streams": 1000000000,
            "StreamsInbound": 1000000000,
            "StreamsOutbound": 1000000000
        },
...
"Services": {
        "": {
            "Conns": 1000000000,
            "ConnsInbound": 1000000000,
            "ConnsOutbound": 1000000000,
            "FD": 1000000000,
            "Memory": 1000000000,
            "Streams": 1000000000,
            "StreamsInbound": 1000000000,
            "StreamsOutbound": 1000000000
        },
        "libp2p.autonat": {
            "Conns": 0,
            "ConnsInbound": 0,
            "ConnsOutbound": 0,
            "FD": 0,
            "Memory": 20404224,
            "Streams": 94,
            "StreamsInbound": 94,
            "StreamsOutbound": 94
        },
...

cc #9417 (but not a hard blocker, we can fix this in 0.19)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High: Likely tackled by core team if no one steps upkind/bugA bug in existing code (including security flaws)topic/resource-managerIssues related to Swarm.ResourceMgr (resource manager)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions