Skip to content

Index: Support custom options via environment variable #112

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Index: Support custom options via environment variable #112

wants to merge 1 commit into from

Conversation

Krinkle
Copy link

@Krinkle Krinkle commented Aug 8, 2020

When working with a Node-based project in a secure isolated environment, it is imho best practice to only expose the working directory of that one project, and to disallow write access to .git as this would allow remote shell execution outside the environment when the developer runs git commands later (as opposed to npm commands).

Currently, when a project uses commitplease in its default configuration, this means the 'npm ci' or 'npm install' command fails as it can't write to .git/hooks.

Make it easy for these developers to individually disable 'commitplease' (and run the tests manually) by setting an env variable in their container.

For example, as part of their base environment via:

export npm_config_commitplease_nohook=1

Or ad-hoc, via npm_config_commitplease_nohook=1 npm ci.

Fixes #111

When working with a Node-based project in a secure isolated
environment, it is imho best practice to only expose the working
directory of that one project, and to disallow write access to
`.git` as this would allow remote shell execution outside the
environment when the developer runs git commands later (as opposed
to npm commands).

Currently, when a project uses commitplease in its default
configuration, this means the 'npm ci' or 'npm install' command
fails as it can't write to .git/hooks.

Make it easy for these developers to individually disable
'commitplease' (and run the tests manually) by setting an env
variable in their container.

For example, as part of their base environment via:

```
export npm_config_commitplease_nohook=1
```

Or ad-hoc, via `npm_config_commitplease_nohook=1 npm ci`.

Fixes #111
@Krinkle
Copy link
Author

Krinkle commented Sep 10, 2020

To test this, run the following in the commitplease directory:

npm_config_commitplease_nohook=1 node index.js

Then:

var cp = require('./index.js');
cp.getOptions()
//> {
//>     …,
//>     nohook: '1'
//> }

/cc @jzaefferer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow skipping of hook at install time
1 participant