Skip to content

Symlink Resolution #225

Answered by trs
nfacha asked this question in Q&A
Dec 15, 2020 · 11 comments
Discussion options

You must be logged in to vote

This library enables creating a custom filesystem, you can use this to enable checking symlinks.

You could overwrite the _resolvePath and perform a check there. Here's a quick example, not tested and probably doesn't work, but it gives you the idea.

// symlinkCheckingFileSystem.js
const {FileSystem} = require('ftp-srv');
const isPathInside = require('is-path-inside'); // https://github.com/sindresorhus/is-path-inside
const {realPathSync} = require('fs');

module.exports.SymlinkCheckingFileSystem = class SymlinkCheckingFileSystem extends FileSystem {
  constructor() {
    super(...arguments);
  }

  _resolvePath(path) {
    // Let base resolver do it's thing
    const {clientPath, fsPath} = 

Replies: 11 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by matt-forster
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #225 on December 28, 2020 20:23.