[Code] stop persist random path in es#47923
Merged
spacedragon merged 1 commit intoelastic:masterfrom Oct 18, 2019
Merged
Conversation
Contributor
💔 Build Failed
|
Contributor
|
Pinging @elastic/code (Team:Code) |
Contributor
💚 Build Succeeded
|
Contributor
alexbrasetvik
left a comment
There was a problem hiding this comment.
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. :)
Contributor
There was a problem hiding this comment.
Unlikely to be a problem in the context, but this is not a secure random source. Might as well use one.
Contributor
There was a problem hiding this comment.
were you suggesting using lib like this?
https://www.npmjs.com/package/secure-random
Contributor
There was a problem hiding this comment.
You can use https://nodejs.org/dist/latest-v12.x/docs/api/crypto.html#crypto_crypto_randombytes_size_callback to generate random bytes
Contributor
Author
|
@elasticmachine merge upstream |
Contributor
💚 Build Succeeded
|
Contributor
💚 Build Succeeded |
zfy0701
approved these changes
Oct 18, 2019
spacedragon
pushed a commit
to spacedragon/kibana
that referenced
this pull request
Oct 18, 2019
spacedragon
pushed a commit
to spacedragon/kibana
that referenced
this pull request
Oct 18, 2019
spacedragon
pushed a commit
that referenced
this pull request
Oct 18, 2019
spacedragon
pushed a commit
that referenced
this pull request
Oct 18, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
strikethroughsto 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 accessibilityFor 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