New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fs-secure

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-secure

Runs fs commands as the specified user, so files are owned by the correct user.

  • 0.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14
decreased by-30%
Maintainers
1
Weekly downloads
 
Created
Source

FS-Secure

This is a drop in replacement for the fs or fs-extra module that implements execution based on the userid and groupid.

The API is completely backwards compatible so it can just be used in any project.

Only methods that return JSON primitives are implemented, so fs.readFile for example will not run under a selected user, as this returns a Buffer. Sync methods are not supported either.

For a comprehensive list check the excludes array in lib/index.js.

Usage

When calling a filesystem method you can add an object containing the uid and gid of the user you want to execute the method with.

As an example, here it writes a file to the filesystem under the uid and gid of 1000:

fs.writeFile("file.txt", "contents", {uid: 1000, gid: 1000}, callback);

Obviously the user needs write access to the selected folder in this case.

License

Copyright (c) 2014, Jamy Timmermans me@jamy.be

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Keywords

FAQs

Package last updated on 07 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc