Skip to content
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

[Code] stop persist random path in es #47923

Merged
merged 1 commit into from
Oct 18, 2019
Merged

Conversation

spacedragon
Copy link
Contributor

Summary

Resolve https://github.com/elastic/code/issues/1649

Prior to this PR, we generated a random string for each repo after cloning and stored it in the ES. Later, we use this random string as part of the workspace checkout path. Using this method, we can somehow improve the difficulty of a bad user using an RCE vulnerability to exploit Code to inject code. But this method won't help for those who have access to ES data.

Now we no longer save the random string in the ES, but use the internal storage of git. Note that this mechanism itself does not guarantee that the Code is not used as an exploit in the case of any other RCE is found, just to improve the difficulty a little.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

~- [ ] This was checked for cross-browser compatibility, including a check against IE11~~
- [ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
- [ ] Documentation was added for features that require explanation or tutorials
- [ ] Unit or functional tests were updated or added to match the most common scenarios
- [ ] This was checked for keyboard-only and screenreader accessibility

For maintainers

- [ ] This was checked for breaking API changes and was labeled appropriately
- [ ] This includes a feature addition or change that requires a release note and was labeled appropriately

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

Pinging @elastic/code (Team:Code)

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@alexbrasetvik alexbrasetvik left a comment

Choose a reason for hiding this comment

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

Seems to get rid of the random string in ES. Unclear whether this causes it to re-initiate the workspace all the time. Doesn't look like it, but don't have the cycles to verify. :)

@@ -110,6 +110,12 @@ export class WorkspaceHandler {
};
}

private randomPath() {
return Math.random()
Copy link
Contributor

Choose a reason for hiding this comment

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

Unlikely to be a problem in the context, but this is not a secure random source. Might as well use one.

Copy link
Contributor

Choose a reason for hiding this comment

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

were you suggesting using lib like this?
https://www.npmjs.com/package/secure-random

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alexbrasetvik Any suggestions ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, thanks.

@spacedragon
Copy link
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

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

Successfully merging this pull request may close these issues.

5 participants