{"id":13582979,"url":"https://github.com/nfischer/shelljs-exec-proxy","last_synced_at":"2025-04-13T14:53:40.748Z","repository":{"id":44945484,"uuid":"62109017","full_name":"nfischer/shelljs-exec-proxy","owner":"nfischer","description":"Unlimited shelljs commands with ES6 proxies","archived":false,"fork":false,"pushed_at":"2025-03-17T01:53:26.000Z","size":154,"stargazers_count":41,"open_issues_count":7,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-27T05:51:12.428Z","etag":null,"topics":["es6-proxies","shelljs","shelljs-plugin"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nfischer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-28T04:03:22.000Z","updated_at":"2025-03-17T01:50:09.000Z","dependencies_parsed_at":"2024-04-08T15:51:52.353Z","dependency_job_id":"6e95b603-345a-4224-a4bc-ac9e31d7fd00","html_url":"https://github.com/nfischer/shelljs-exec-proxy","commit_stats":{"total_commits":48,"total_committers":4,"mean_commits":12.0,"dds":0.5,"last_synced_commit":"3d9e557c75b2213ba3b07ec28d4b07ba1cc4b2c0"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfischer%2Fshelljs-exec-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfischer%2Fshelljs-exec-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfischer%2Fshelljs-exec-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfischer%2Fshelljs-exec-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nfischer","download_url":"https://codeload.github.com/nfischer/shelljs-exec-proxy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248732512,"owners_count":21152851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["es6-proxies","shelljs","shelljs-plugin"],"created_at":"2024-08-01T15:03:10.267Z","updated_at":"2025-04-13T14:53:40.741Z","avatar_url":"https://github.com/nfischer.png","language":"JavaScript","readme":"# ShellJS Exec Proxy\n\n[![GitHub Actions](https://img.shields.io/github/actions/workflow/status/nfischer/shelljs-exec-proxy/main.yml?style=flat-square\u0026logo=github)](https://github.com/nfischer/shelljs-exec-proxy/actions/workflows/main.yml)\n[![Codecov](https://img.shields.io/codecov/c/github/nfischer/shelljs-exec-proxy.svg?style=flat-square)](https://codecov.io/gh/nfischer/shelljs-exec-proxy)\n[![npm](https://img.shields.io/npm/v/shelljs-exec-proxy.svg?style=flat-square)](https://www.npmjs.com/package/shelljs-exec-proxy)\n[![npm downloads](https://img.shields.io/npm/dm/shelljs-exec-proxy.svg?style=flat-square)](https://www.npmjs.com/package/shelljs-exec-proxy)\n\nUnleash the power of unlimited ShellJS commands... *with ES6 Proxies!*\n\nDo you like [ShellJS](https://github.com/shelljs/shelljs), but wish it had your\nfavorite commands? Skip the weird `exec()` calls by using `shelljs-exec-proxy`:\n\n```javascript\n// Our goal: make a commit: `$ git commit -am \"I'm updating the \\\"foo\\\" module to be more secure\"`\n// Standard ShellJS requires the exec function, with confusing string escaping:\nshell.exec('git commit -am \"I\\'m updating the \\\\\"foo\\\\\" module to be more secure\"');\n// Skip the extra string escaping with shelljs-exec-proxy!\nshell.git.commit('-am', `I'm updating the \"foo\" module to be more secure`);\n```\n\n## Installation\n\n```\n$ npm install --save shelljs-exec-proxy\n```\n\n## Get that JavaScript feeling back in your code\n\n```javascript\nconst shell = require('shelljs-exec-proxy');\nshell.git.status();\nshell.git.add('.');\nshell.git.commit('-am', 'Fixed issue #1');\nshell.git.push('origin', 'main');\n```\n\n## Security improvements\n\nCurrent versions of ShellJS export the `.exec()` method, which if not used\ncarefully, could introduce command injection Vulnerabilities to your module.\nHere's an insecure code snippet:\n\n```javascript\nshell.ls('dir/*.txt').forEach(file =\u003e {\n  shell.exec('git add ' + file);\n}\n```\n\nThis leaves you vulnerable to files like:\n\n| Example file name | Unintended behavior |\n|------------------ | ------------- |\n| `File 1.txt` | This tries to add both `File` and `1.txt`, instead of `File 1.txt` |\n| `foo;rm -rf *` | This executes both `git add foo` and `rm -rf *`, unexpectedly deleting your files! |\n| `ThisHas\"quotes'.txt` | This tries running `git add ThisHas\"quotes'.txt`, producing a Bash syntax error |\n\n`shelljs-exec-proxy` solves all these problems:\n\n```javascript\nshell.ls('dir/*.txt').forEach(file =\u003e {\n  shell.git.add(file);\n}\n```\n\n| Example file name | Behavior |\n|------------------ | ------------ |\n| `File 1.txt` | Arguments are automatically quoted, so spaces aren't an issue |\n| `foo;rm -rf *` | Only one command runs at a time (semicolons are treated literally) and wildcards aren't expanded |\n| `ThisHas\"quotes'.txt` | Quote characters are automatically escaped for you, so there are never any issues |\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfischer%2Fshelljs-exec-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnfischer%2Fshelljs-exec-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfischer%2Fshelljs-exec-proxy/lists"}