Skip to content

block-deletes#94

Closed
TylerPachal wants to merge 2 commits intoabutaha:masterfrom
TylerPachal:block-deletes
Closed

block-deletes#94
TylerPachal wants to merge 2 commits intoabutaha:masterfrom
TylerPachal:block-deletes

Conversation

@TylerPachal
Copy link
Copy Markdown

@TylerPachal TylerPachal commented Jul 13, 2021

The Problem

I just accidentally deleted a lot of documents from a remote cluster because I forgot this tunnel was opened 🤦.

The Solution

Add a -block-deletes flag which will block delete requests from being proxied through to the cluster. I am very rarely wanting to connect to a remote cluster to do delete operations, so from now on I will use this library like so:

aws-es-proxy -block-deletes -endpoint http://foobar

The default is still to allow requests unless you opt-out using the new flag.

Risks

  1. I am not a heavy ES user so I don't think I've covered all of the possible ways to delete things. From what I saw in the documentation disallowing DELETE requests is a good starting point. I burned myself with the _delete_by_query functionality so I also added that one. It won't do anything to block deletes that are in a _bulk query.

  2. I know this isn't strictly related to proxying but I think this would be a nice option to have.

Other

  • I tested this locally using go run aws-es-proxy.go -block-deletes -endpoint <my_endpoint> and sent through some DELETE requests and some _delete_by_query requests, all of which were blocked with a log indicating what happened:
$ go run aws-es-proxy.go -block-deletes -endpoint https://myendpoint.amazonaws.com     
INFO[2021-13-07 14:48:29] Listening on 127.0.0.1:9200...               
WARN[2021-13-07 14:48:41] Blocked Delete Request   

Comment thread README.md
Comment on lines +127 to +128
-assume string
Optionally specify role to assume
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Annotation: I re-ran the proxy with -h and I guess this option had not been documented yet either.

@abutaha
Copy link
Copy Markdown
Owner

abutaha commented Jul 26, 2021

Thanks for submitting this. It's a cool a feature. Let me review it and get it merged the soonest.

@TylerPachal TylerPachal closed this by deleting the head repository Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants