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

replace readme string concat with json marshal #493

Merged
merged 1 commit into from
May 12, 2022

Conversation

epelc
Copy link
Contributor

@epelc epelc commented May 12, 2022

Just took a look after being a long time user of oliver/elastic-go and noticed a quite jarring promotion of string concatenation in the example for indexing a document.

I don't think a database driver should be promoting usage of string concatenation. Someone is going to copy this into production and end up with an injection vulnerability or request smuggling issue.

https://github.com/elastic/go-elasticsearch#usage

image

Just took a look after being a long time user of oliver/elastic-go and noticed a quite jarring promotion of string concatenation in the example for indexing a document.

I don't think a database driver should be promoting usage of string concatenation. Someone is going to copy this into production and end up with an injection vulnerability or request smuggling issue.


https://github.com/elastic/go-elasticsearch#usage

<img width="398" alt="image" src="https://user-images.githubusercontent.com/5204642/167987969-ff1abe07-9f3b-499c-8a6c-1561a41ff5cf.png">
@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@cla-checker-service
Copy link

cla-checker-service bot commented May 12, 2022

💚 CLA has been signed

@epelc
Copy link
Contributor Author

epelc commented May 12, 2022

signed the cla

@Anaethelion
Copy link
Contributor

Thank you @epelc for pointing that out and for the fix!

I'd also like to highlight for future reader that json marshaling is not sufficient and users should sanitize their data before ingestion.

LGTM!

@epelc
Copy link
Contributor Author

epelc commented May 12, 2022

@Anaethelion Thanks for the quick merge!

Excited to see potential support for request/response structs. Looking to switch over from oliver's driver eventually.

Anaethelion added a commit that referenced this pull request May 12, 2022
Anaethelion added a commit that referenced this pull request May 12, 2022
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.

3 participants