This is an automated email from the ASF dual-hosted git repository.

joshfischer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git


The following commit(s) were added to refs/heads/master by this push:
     new 6edbee7  Allow localhost graceful shutdown (#3650)
6edbee7 is described below

commit 6edbee7c52e133467d4ba3277c3726b33188ef5b
Author: choi se <[email protected]>
AuthorDate: Tue Jan 12 07:14:25 2021 +0900

    Allow localhost graceful shutdown (#3650)
    
    * Allow localhost graceful shutdown
    
    * Update heron/shell/src/python/handlers/killexecutorhandler.py
    
    Co-authored-by: Oliver Bristow <[email protected]>
    
    Co-authored-by: Oliver Bristow <[email protected]>
---
 heron/shell/src/python/handlers/killexecutorhandler.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/heron/shell/src/python/handlers/killexecutorhandler.py 
b/heron/shell/src/python/handlers/killexecutorhandler.py
index 372770e..4dbed59 100644
--- a/heron/shell/src/python/handlers/killexecutorhandler.py
+++ b/heron/shell/src/python/handlers/killexecutorhandler.py
@@ -44,13 +44,16 @@ class KillExecutorHandler(tornado.web.RequestHandler):
       logger.info("Killing parent executor")
       os.killpg(os.getppid(), signal.SIGTERM)
 
+    def is_local():
+      return self.request.remote_ip in ('localhost', '127.0.0.1', '::1')
+
     logger = logging.getLogger(__file__)
     logger.info("Received 'Killing process' request")
     data = dict(parse_qsl(self.request.body))
 
     # check shared secret
     sharedSecret = data.get('secret')
-    if sharedSecret != options.secret:
+    if not is_local() and sharedSecret != options.secret:
       status_finish(403)
       return
 

Reply via email to