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

resolve relative symlinks server side on gateway #284

Open
Jorropo opened this issue Jun 3, 2022 · 0 comments
Open

resolve relative symlinks server side on gateway #284

Jorropo opened this issue Jun 3, 2022 · 0 comments
Labels
need/triage Needs initial labeling and prioritization

Comments

@Jorropo
Copy link
Contributor

Jorropo commented Jun 3, 2022

When a unixfs symlink is hit, if the mode is file (not block or car), gateway should emulate nginx and apache, that means resolve the symlink server side and return whatever file is being pointed to.

This proposal only targets relative symlinks (I have no idea what should happen with absolute ones).

To resolve it mean, take the current base path (the path of the folder containing the symlink).
Add the symlink path, do a lexical simplification (remove a/.. and . entries), and repeat the usual gateway process at that point.

Gateway MUST error if the lexical simplification errors (such as by a symlink having more .. than how deep it is in the dag).

Gateway MUST support recursively doing that (symlinks pointing to other symlinks). It MUST support a depth of at least 32, and SHOULD raise an error if number gets too big.

For example take this tree:

CID
+ a
| +- symlink (../b/example)
+ b
  +- example

Loading CID/a/symlink the gateway would need to send the content of CID/b/example.
Because
First it resolve /a/symlink see that it's a symlink applies the content to the base path /a/../b/example
And then do a lexical simplification /b/example and then send this path content.

@Jorropo Jorropo added the need/triage Needs initial labeling and prioritization label Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

1 participant