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

ipfs get: tar has invalid root when a filename contains double dot .. #8293

Closed
3 tasks done
karmanyaahm opened this issue Jul 22, 2021 · 8 comments
Closed
3 tasks done
Assignees
Labels
effort/hours Estimated to take one or several hours exp/intermediate Prior experience is likely helpful kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization
Milestone

Comments

@karmanyaahm
Copy link

Checklist

Installation method

ipfs-update or dist.ipfs.io

Version

go-ipfs version: 0.9.1
Repo version: 11
System version: amd64/linux
Golang version: go1.16.6

Config

{
  "API": {
    "HTTPHeaders": {}
  },
  "Addresses": {
    "API": "/ip4/127.0.0.1/tcp/5001",
    "Announce": [],
    "Gateway": "/ip4/127.0.0.1/tcp/4002",
    "NoAnnounce": [],
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001",
      "/ip4/0.0.0.0/udp/4001/quic",
      "/ip6/::/udp/4001/quic"
    ]
  },
  "AutoNAT": {},
  "Bootstrap": [
    "/dns6/karmanyaah.malhotra.cc/tcp/4001/p2p/12D3KooWAaaAAPjJMAdXtv6i4FR6wn1N51f1wA1iej3XeJkwcRth",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
    "/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
    "/ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
    "/dns6/unifiedpush.org/tcp/4001/p2p/12D3KooWQP2mXMcTRPUqgNdubydN6ucAghYHDCRni8XZosNjTx3q"
  ],
  "Datastore": {
    "BloomFilterSize": 0,
    "GCPeriod": "1h",
    "HashOnRead": false,
    "Spec": {
      "mounts": [
        {
          "child": {
            "path": "blocks",
            "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
            "sync": true,
            "type": "flatfs"
          },
          "mountpoint": "/blocks",
          "prefix": "flatfs.datastore",
          "type": "measure"
        },
        {
          "child": {
            "compression": "none",
            "path": "datastore",
            "type": "levelds"
          },
          "mountpoint": "/",
          "prefix": "leveldb.datastore",
          "type": "measure"
        }
      ],
      "type": "mount"
    },
    "StorageGCWatermark": 90,
    "StorageMax": "10GB"
  },
  "Discovery": {
    "MDNS": {
      "Enabled": true,
      "Interval": 10
    }
  },
  "Experimental": {
    "FilestoreEnabled": false,
    "GraphsyncEnabled": false,
    "Libp2pStreamMounting": false,
    "P2pHttpProxy": false,
    "ShardingEnabled": false,
    "StrategicProviding": false,
    "UrlstoreEnabled": false
  },
  "Gateway": {
    "APICommands": [],
    "HTTPHeaders": {
      "Access-Control-Allow-Headers": [
        "X-Requested-With",
        "Range",
        "User-Agent"
      ],
      "Access-Control-Allow-Methods": [
        "GET"
      ],
      "Access-Control-Allow-Origin": [
        "*"
      ]
    },
    "NoDNSLink": false,
    "NoFetch": false,
    "PathPrefixes": [],
    "PublicGateways": {
      "karmanyaah.malhotra.cc": {
        "NoDNSLink": false,
        "Paths": [
          "/ipns"
        ],
        "UseSubdomains": false
      }
    },
    "RootRedirect": "",
    "Writable": false
  },
  "Identity": {
    "PeerID": "12D3KooWGZtnCxVUqC4qhjRMhzvN2pEm1sh3Vy1Z8L5uKVnVW6ap"
  },
  "Ipns": {
    "RecordLifetime": "2400h",
    "RepublishPeriod": "",
    "ResolveCacheSize": 128
  },
  "Mounts": {
    "FuseAllowOther": false,
    "IPFS": "/ipfs",
    "IPNS": "/ipns"
  },
  "Peering": {
    "Peers": null
  },
  "Pinning": {},
  "Plugins": {
    "Plugins": null
  },
  "Provider": {
    "Strategy": ""
  },
  "Pubsub": {
    "DisableSigning": false,
    "Router": ""
  },
  "Reprovider": {
    "Interval": "12h",
    "Strategy": "all"
  },
  "Routing": {
    "Type": "dht"
  },
  "Swarm": {
    "AddrFilters": null,
    "ConnMgr": {
      "GracePeriod": "20s",
      "HighWater": 900,
      "LowWater": 600,
      "Type": "basic"
    },
    "DisableBandwidthMetrics": false,
    "DisableNatPortMap": false,
    "EnableAutoRelay": false,
    "EnableRelayHop": false,
    "Transports": {
      "Multiplexers": {},
      "Network": {},
      "Security": {}
    }
  }
}

Description

$ echo abc > 'S.M.A.R.T..html'
$ ipfs add --pin=false 'S.M.A.R.T..html' --wrap-with-directory
added Qme4u9HfFqYUhH4i34ZFBKi1ZsW7z4MYHtLxScQGndhgKE S.M.A.R.T..html
added QmZnd7vpUVX9Shr1nYazH6CFFq8DpzEwaHgvoXvADMtG9a 
 4 B / 4 B [========] 100.00%

$ ipfs get QmZnd7vpUVX9Shr1nYazH6CFFq8DpzEwaHgvoXvADMtG9a
Saving file(s) to QmZnd7vpUVX9Shr1nYazH6CFFq8DpzEwaHgvoXvADMtG9a
 73 B / 73 B [========] 100.00% 0s
Error: contains more than one root or the root directory is not the first entry : tar has invalid root

Using v0.8.0 works fine.
I'm running into this bug because the Arch Wiki has a page called S.M.A.R.T..html and I run an IPFS mirror at /ipns/archwiki.karmanyaah.malhotra.cc.

@karmanyaahm karmanyaahm added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Jul 22, 2021
@welcome
Copy link

welcome bot commented Jul 22, 2021

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment.
Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

Finally, remember to use https://discuss.ipfs.io if you just need general support.

@karmanyaahm
Copy link
Author

This seems to happen post c47fca7

@aschmahmann
Copy link
Contributor

Thanks for the report, we'll take a look. In the meanwhile you can use ipfs get -a myarchive.tar and then just untar the result.

@aschmahmann aschmahmann added effort/hours Estimated to take one or several hours exp/intermediate Prior experience is likely helpful labels Jul 22, 2021
@BigLep BigLep added this to the go-ipfs 0.10 milestone Jul 22, 2021
@BigLep BigLep assigned aschmahmann and petar and unassigned aschmahmann Aug 3, 2021
@petar
Copy link
Contributor

petar commented Aug 6, 2021

Resolved by ipfs/tar-utils#5

@petar petar closed this as completed Aug 6, 2021
@wmitsuda
Copy link

This is still happening on ipfs 0.10.0, try to get the content /ipns/k51qzi5uqu5dll0ocge71eudqnrgnogmbr37gsgl12uubsinphjoknl6bbi41p (warning ~5 GB directory tree).

@aschmahmann
Copy link
Contributor

@wmitsuda sorry about that. It looks like it got fixed in the dependency, but we didn't update the dependency in time. It'll be taken care of for the next release and this issue will get closed once it's in master.

@Winterhuman
Copy link
Contributor

@aschmahmann Has the dependency been merged in v0.11/v0.12?

@aschmahmann
Copy link
Contributor

Yep, it was merged in #8571. Post back if you have any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/hours Estimated to take one or several hours exp/intermediate Prior experience is likely helpful kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization
Projects
No open projects
Archived in project
Development

No branches or pull requests

6 participants