Skip to content

[Code] stop persist random path in es#47923

Merged
spacedragon merged 1 commit intoelastic:masterfrom
spacedragon:rnd_str
Oct 18, 2019
Merged

[Code] stop persist random path in es#47923
spacedragon merged 1 commit intoelastic:masterfrom
spacedragon:rnd_str

Conversation

@spacedragon
Copy link
Copy Markdown
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
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/code (Team:Code)

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@zfy0701 zfy0701 requested a review from alexbrasetvik October 11, 2019 15:12
Copy link
Copy Markdown
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. :)

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@spacedragon spacedragon merged commit 713993c into elastic:master Oct 18, 2019
@spacedragon spacedragon deleted the rnd_str branch October 18, 2019 03:43
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
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