ipfs / ipfs/kubo

Symlinks and Security

Open
#5,161 1 comment 5 reactions 0 assignees View on GitHub
kind/enhancement need/community-input
Dominant language
Go
Stars
17.1k
Forks
3.2k
Avg merge
3d 18h
Merged PRs (30d)
11

Description

Currently, you can add any arbitrary symlink to IPFS. Now, the gateway won't traverse a random symlink into the filesystem but any tool that simply downloads a directory out of IPFS to the local disk might. This could turn into a security foot gun.

Unfortunately, symlinks are kind of important. The naive solution would be to require that symlinks only point to other files on IPFS or other files within the same archive. However, the former won't work without `/ipfs` mounted as a fuse filesystem (unless we resolve them on `ipfs get` which'll remove the symlink) and the latter precludes many valid use-cases for symlinks.

One solution is to add a flag to `ipfs get` that restricts symlinks. Currently, I'm thinking: `--symlinks={all,relative,resolve}`. That is:

* `all` is the default and allows all symlinks
* `relative` only allows symlinks relative to the root of the IPFS directory.
* `resolve` resolves symlinks before extracting the files from IPFS (only allowing them to point to other files in IPFS).

Many tools will actually want to use `--symlinks=resolve`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.