yeet
This commit is contained in:
143
node_modules/sudo-prompt/CHANGELOG.md
generated
vendored
Normal file
143
node_modules/sudo-prompt/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,143 @@
|
||||
## [9.2.0] 2020-04-29
|
||||
|
||||
### Fixed
|
||||
|
||||
- Update TypeScript types to accommodate recent changes, see
|
||||
[#117](https://github.com/jorangreef/sudo-prompt/issues/117).
|
||||
|
||||
## [9.1.0] 2019-11-13
|
||||
|
||||
### Added
|
||||
|
||||
- Add TypeScript types.
|
||||
|
||||
## [9.0.0] 2019-06-03
|
||||
|
||||
### Changed
|
||||
|
||||
- Make cross-platform `stdout`, `stderr` behavior consistent, see
|
||||
[#89](https://github.com/jorangreef/sudo-prompt/issues/89).
|
||||
|
||||
- Preserve current working directory on all platforms.
|
||||
|
||||
- Improve kdesudo dialog appearance.
|
||||
|
||||
### Added
|
||||
|
||||
- Add `options.env` to set environment variables on all platforms, see
|
||||
[#91](https://github.com/jorangreef/sudo-prompt/issues/91).
|
||||
|
||||
### Fixed
|
||||
|
||||
- Always return PERMISSION_DENIED as an Error object.
|
||||
|
||||
- Support multiple commands separated by semicolons on Linux, see
|
||||
[#39](https://github.com/jorangreef/sudo-prompt/issues/39).
|
||||
|
||||
- Distinguish between elevation errors and command errors on Linux, see
|
||||
[#88](https://github.com/jorangreef/sudo-prompt/issues/88).
|
||||
|
||||
- Fix Windows to return `PERMISSION_DENIED` Error even when Windows' error
|
||||
messages are internationalized, see
|
||||
[#96](https://github.com/jorangreef/sudo-prompt/issues/96).
|
||||
|
||||
## [8.2.5] 2018-12-12
|
||||
|
||||
### Fixed
|
||||
|
||||
- Whitelist package.json files.
|
||||
|
||||
## [8.2.4] 2018-12-12
|
||||
|
||||
### Added
|
||||
|
||||
- A CHANGELOG.md file, see
|
||||
[#78](https://github.com/jorangreef/sudo-prompt/issues/78).
|
||||
|
||||
## [8.2.3] 2018-09-11
|
||||
|
||||
### Fixed
|
||||
|
||||
- README: Link to concurrency discussion.
|
||||
|
||||
## [8.2.2] 2018-09-11
|
||||
|
||||
### Fixed
|
||||
|
||||
- README: Details on concurrency.
|
||||
|
||||
## [8.2.1] 2018-09-11
|
||||
|
||||
### Fixed
|
||||
|
||||
- A rare idempotency edge case where a command might have been run more than
|
||||
once, given a very specific OS environment setup.
|
||||
|
||||
## [8.2.0] 2018-03-22
|
||||
|
||||
### Added
|
||||
|
||||
- Windows: Fix `cd` when `cwd` is on another drive, see
|
||||
[#70](https://github.com/jorangreef/sudo-prompt/issues/70).
|
||||
|
||||
## [8.1.0] 2018-01-10
|
||||
|
||||
### Added
|
||||
|
||||
- Linux: Increase `maxBuffer` limit to 128 MiB, see
|
||||
[#66](https://github.com/jorangreef/sudo-prompt/issues/66).
|
||||
|
||||
## [8.0.0] 2018-11-02
|
||||
|
||||
### Changed
|
||||
|
||||
- Windows: Set code page of command batch script to UTF-8.
|
||||
|
||||
## [7.1.1] 2017-07-18
|
||||
|
||||
### Fixed
|
||||
|
||||
- README: Explicitly mention that no child process is returned.
|
||||
|
||||
## [7.0.0] 2017-03-15
|
||||
|
||||
### Changed
|
||||
|
||||
- Add status code to errors on Windows and macOS.
|
||||
|
||||
## [6.2.1] 2016-12-16
|
||||
|
||||
### Fixed
|
||||
|
||||
- README: Syntax highlighting.
|
||||
|
||||
## [6.2.0] 2016-08-17
|
||||
|
||||
### Fixed
|
||||
|
||||
- README: Rename OS X to macOS.
|
||||
|
||||
## [6.1.0] 2016-08-02
|
||||
|
||||
### Added
|
||||
|
||||
- Yield an error if no polkit authentication agent is found, see
|
||||
[#29](https://github.com/jorangreef/sudo-prompt/issues/29).
|
||||
|
||||
## [6.0.2] 2016-07-21
|
||||
|
||||
### Fixed
|
||||
|
||||
- README: Update explanation of Linux behavior.
|
||||
|
||||
## [6.0.1] 2016-07-15
|
||||
|
||||
### Fixed
|
||||
|
||||
- Update keywords in package.json.
|
||||
|
||||
## [6.0.0] 2016-07-15
|
||||
|
||||
### Changed
|
||||
|
||||
- Add support for Windows.
|
22
node_modules/sudo-prompt/LICENSE
generated
vendored
Normal file
22
node_modules/sudo-prompt/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Joran Dirk Greef
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
62
node_modules/sudo-prompt/README.md
generated
vendored
Normal file
62
node_modules/sudo-prompt/README.md
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
# sudo-prompt
|
||||
|
||||
Run a non-graphical terminal command using `sudo`, prompting the user with a graphical OS dialog if necessary. Useful for background Node.js applications or native Electron apps that need `sudo`.
|
||||
|
||||
## Cross-Platform
|
||||
`sudo-prompt` provides a native OS dialog prompt on **macOS**, **Linux** and **Windows**.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## Installation
|
||||
`sudo-prompt` has no external dependencies and does not require any native bindings.
|
||||
```
|
||||
npm install sudo-prompt
|
||||
```
|
||||
|
||||
## Usage
|
||||
Note: Your command should not start with the `sudo` prefix.
|
||||
```javascript
|
||||
var sudo = require('sudo-prompt');
|
||||
var options = {
|
||||
name: 'Electron',
|
||||
icns: '/Applications/Electron.app/Contents/Resources/Electron.icns', // (optional)
|
||||
};
|
||||
sudo.exec('echo hello', options,
|
||||
function(error, stdout, stderr) {
|
||||
if (error) throw error;
|
||||
console.log('stdout: ' + stdout);
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
`sudo-prompt` will use `process.title` as `options.name` if `options.name` is not provided. `options.name` must be alphanumeric only (spaces are supported) and at most 70 characters.
|
||||
|
||||
`sudo-prompt` will preserve the current working directory on all platforms. Environment variables can be set explicitly using `options.env`.
|
||||
|
||||
**`sudo-prompt.exec()` is different to `child-process.exec()` in that no child process is returned (due to platform and permissions constraints).**
|
||||
|
||||
## Behavior
|
||||
On macOS, `sudo-prompt` should behave just like the `sudo` command in the shell. If your command does not work with the `sudo` command in the shell (perhaps because it uses `>` redirection to a restricted file), then it may not work with `sudo-prompt`. However, it is still possible to use sudo-prompt to get a privileged shell, [see this closed issue for more information](https://github.com/jorangreef/sudo-prompt/issues/1).
|
||||
|
||||
On Linux, `sudo-prompt` will use either `pkexec` or `kdesudo` to show the password prompt and run your command. Where possible, `sudo-prompt` will try and get these to mimic `sudo`. Depending on which binary is used, and due to the limitations of some binaries, the name of your program or the command itself may be displayed to your user. `sudo-prompt` will not use `gksudo` since `gksudo` does not support concurrent prompts. Passing `options.icns` is currently not supported by `sudo-prompt` on Linux. Patches are welcome to add support for icons based on `polkit`.
|
||||
|
||||
On Windows, `sudo-prompt` will elevate your command using User Account Control (UAC). Passing `options.name` or `options.icns` is currently not supported by `sudo-prompt` on Windows.
|
||||
|
||||
## Non-graphical terminal commands only
|
||||
Just as you should never use `sudo` to launch any graphical applications, you should never use `sudo-prompt` to launch any graphical applications. Doing so could cause files in your home directory to become owned by root. `sudo-prompt` is explicitly designed to launch non-graphical terminal commands. For more information, [read this post](http://www.psychocats.net/ubuntu/graphicalsudo).
|
||||
|
||||
## Concurrency
|
||||
On systems where the user has opted to have `tty-tickets` enabled (most systems), each call to `exec()` will result in a separate password prompt. Where `tty-tickets` are disabled, subsequent calls to `exec()` will still require a password prompt, even where the user's `sudo` timestamp file remains valid, due to edge cases with `sudo` itself, [see this discussion for more information](https://github.com/jorangreef/sudo-prompt/pull/76).
|
||||
|
||||
You should never rely on `sudo-prompt` to execute your calls in order. If you need to enforce ordering of calls, then you should explicitly order your calls in your application. Where your commands are short-lived, you should always queue your calls to `exec()` to make sure your user is not overloaded with password prompts.
|
||||
|
||||
## Invalidating the timestamp
|
||||
On macOS and Linux, you can invalidate the user's `sudo` timestamp file to force the prompt to appear by running the following command in your terminal:
|
||||
|
||||
```sh
|
||||
$ sudo -k
|
||||
```
|
4
node_modules/sudo-prompt/index.d.ts
generated
vendored
Normal file
4
node_modules/sudo-prompt/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
export function exec(cmd: string,
|
||||
options?: ((error?: Error, stdout?: string | Buffer, stderr?: string | Buffer) => void)
|
||||
| { name?: string, icns?: string, env?: { [key: string]: string } },
|
||||
callback?: (error?: Error, stdout?: string | Buffer, stderr?: string | Buffer) => void): void;
|
674
node_modules/sudo-prompt/index.js
generated
vendored
Normal file
674
node_modules/sudo-prompt/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
41
node_modules/sudo-prompt/package.json
generated
vendored
Normal file
41
node_modules/sudo-prompt/package.json
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "sudo-prompt",
|
||||
"version": "9.2.1",
|
||||
"description": "Run a command using sudo, prompting the user with an OS dialog if necessary",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"index.d.ts",
|
||||
"index.js",
|
||||
"package.json",
|
||||
"test.js",
|
||||
"test-concurrent.js"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jorangreef/sudo-prompt.git"
|
||||
},
|
||||
"keywords": [
|
||||
"sudo",
|
||||
"os",
|
||||
"dialog",
|
||||
"prompt",
|
||||
"command",
|
||||
"exec",
|
||||
"user access control",
|
||||
"UAC",
|
||||
"privileges",
|
||||
"administrative",
|
||||
"elevate",
|
||||
"run as administrator"
|
||||
],
|
||||
"author": "Joran Dirk Greef",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jorangreef/sudo-prompt/issues"
|
||||
},
|
||||
"homepage": "https://github.com/jorangreef/sudo-prompt#readme",
|
||||
"scripts": {}
|
||||
}
|
29
node_modules/sudo-prompt/test-concurrent.js
generated
vendored
Normal file
29
node_modules/sudo-prompt/test-concurrent.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
var sudo = require('./');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
function kill(end) {
|
||||
if (process.platform === 'win32') return end();
|
||||
exec('sudo -k', end);
|
||||
}
|
||||
kill(
|
||||
function() {
|
||||
var options = {
|
||||
name: 'Sudo Prompt'
|
||||
};
|
||||
if (process.platform === 'win32') {
|
||||
var sleep = 'timeout /t 10\r\necho world';
|
||||
} else {
|
||||
var sleep = 'sleep 10 && echo world';
|
||||
}
|
||||
sudo.exec(sleep, options,
|
||||
function(error, stdout, stderr) {
|
||||
console.log(error, stdout, stderr);
|
||||
}
|
||||
);
|
||||
sudo.exec('echo hello', options,
|
||||
function(error, stdout, stderr) {
|
||||
console.log(error, stdout, stderr);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
65
node_modules/sudo-prompt/test.js
generated
vendored
Normal file
65
node_modules/sudo-prompt/test.js
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
var assert = require('assert');
|
||||
var fs = require('fs');
|
||||
var sudo = require('./');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
function kill(end) {
|
||||
if (process.platform === 'win32') return end();
|
||||
exec('sudo -k', end);
|
||||
}
|
||||
|
||||
function icns() {
|
||||
if (process.platform !== 'darwin') return undefined;
|
||||
var path = '/Applications/Electron.app/Contents/Resources/Electron.icns';
|
||||
try {
|
||||
fs.statSync(path);
|
||||
return path;
|
||||
} catch (error) {}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
kill(
|
||||
function() {
|
||||
var options = {
|
||||
env: { 'SUDO_PROMPT_TEST_ENV': 'hello world' },
|
||||
icns: icns(),
|
||||
name: 'Electron'
|
||||
};
|
||||
if (process.platform === 'win32') {
|
||||
var command = 'echo %SUDO_PROMPT_TEST_ENV%';
|
||||
var expected = 'hello world\r\n';
|
||||
} else {
|
||||
// We use double quotes to tell echo to preserve internal space:
|
||||
var command = 'echo "$SUDO_PROMPT_TEST_ENV"';
|
||||
var expected = 'hello world\n';
|
||||
}
|
||||
console.log(
|
||||
'sudo.exec(' +
|
||||
JSON.stringify(command) + ', ' +
|
||||
JSON.stringify(options) +
|
||||
')'
|
||||
);
|
||||
sudo.exec(command, options,
|
||||
function(error, stdout, stderr) {
|
||||
console.log('error:', error);
|
||||
console.log('stdout: ' + JSON.stringify(stdout));
|
||||
console.log('stderr: ' + JSON.stringify(stderr));
|
||||
assert(error === undefined || typeof error === 'object');
|
||||
assert(stdout === undefined || typeof stdout === 'string');
|
||||
assert(stderr === undefined || typeof stderr === 'string');
|
||||
kill(
|
||||
function() {
|
||||
if (error) throw error;
|
||||
if (stdout !== expected) {
|
||||
throw new Error('stdout != ' + JSON.stringify(expected));
|
||||
}
|
||||
if (stderr !== '') {
|
||||
throw new Error('stderr != ""');
|
||||
}
|
||||
console.log('OK');
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
Reference in New Issue
Block a user