Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

fix: refuse to start if working dir is root dir #381

Merged

Conversation

DominicKramer
Copy link
Contributor

@DominicKramer DominicKramer commented Dec 20, 2017

fixes: #377

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 20, 2017
@ofrobots ofrobots changed the title fix: Refuse to start if working dir is root dir fix: refuse to start if working dir is root dir Dec 20, 2017
Copy link
Contributor

@ofrobots ofrobots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit and PR should include 'Fixes:' metadata.

that.emit(
'initError',
new Error(
`Cannot start the agent when the working directory is a root directory`));

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

// Don't continue if the working directory is a root directory
if (path.join(workingDir, '..') === workingDir) {
that.logger.error(
`Refusing to start with \`workingDirectory\` set to a root directory: '${

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@@ -377,6 +377,32 @@ describe('Debuglet', () => {
assert.deepEqual(mergedConfig, compareConfig);
});

it('should not start when workingDirectory is the a directory', (done) => {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@@ -377,6 +377,32 @@ describe('Debuglet', () => {
assert.deepEqual(mergedConfig, compareConfig);
});

it('should not start when workingDirectory is the a directory', (done) => {
const debug = new Debug({}, packageInfo);
const config = extend({}, defaultConfig, {workingDirectory: path.sep});

This comment was marked as spam.

This comment was marked as spam.

};

debuglet.on('initError', (err: Error) => {
assert.ok(err);

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

if (!that.config.allowRootAsWorkingDirectory &&
path.join(workingDir, '..') === workingDir) {
const message =
`Refusing to start the cloud debugger with \`workingDirectory\` set to a root ` +

This comment was marked as spam.

Copy link
Contributor

@ofrobots ofrobots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM w/ nit if the CI is happy.

@DominicKramer DominicKramer merged commit 3b97598 into googleapis:master Dec 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GKE: Error scanning the filesystem
4 participants