My favorites | Sign in
Google
                
New issue | Search
for
| Advanced search | Search tips
Issue 616: Dev Appserver: request for Hardened Modules override
91 people starred this issue and may be notified of changes. Back to list
Status:  Acknowledged
Owner:  ----
Type-Feature
Priority-Medium
Component-SDK


Sign in to add a comment
 
Reported by aralbalkan, Aug 06, 2008
It would be simpler to override the monkeypatching for hardened modules if
FixModule didn't delete the original methods but kept them on as old_x,
old_y, etc. 

Use case:

I want to be able to override the hardening to carry out logic that will
only ever be run locally and I need local file access (mkdir, file with 'w'
etc.) 

I want to be able to monkeypatch the restrictions away and then reinstate
them when my method is done.

Thanks!
Comment 1 by aralbalkan, Aug 06, 2008
PS. What I'm asking for can be achieved with patching dev_appserver.py with:

Line 1119:
-          del module.__dict__[symbol]
+          module.__dict__['old_'+symbol] = module.__dict__[symbol]
+          del module.__dict__[symbol]

I'm using this to re-enable mkdir as I need it locally (to create the folder for the
downloaded datastore backups to be placed into.) 
Comment 2 by ma...@google.com, Sep 30, 2008
(No comment was entered for this change.)
Status: Acknowledged
Labels: -Type-Defect Type-Feature
Comment 3 by a.s@google.com, Oct 07, 2008
(No comment was entered for this change.)
Labels: Component-SDK
Comment 4 by davidgameswolfe, Jun 03, 2009
Leaving hooks for the development environment is wise.
Comment 5 by remarkability, Jun 15, 2009
My version of dev_appserver.py in
/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/dev_appserver.py
only has 70 lines. 

Or am I missing something?
Comment 6 by nic...@gmail.com, Jun 15, 2009
I also have a dev_appserver.py in the directory  (Windows)

C:\Program Files\Google\google_appengine

which has only ~70 lines but in the directory
 
C:\Program Files\Google\google_appengine\google\appengine\tools 

there's another one (the correct one).
Comment 7 by Seth.Kriticos, Sep 30, 2009
There are 2 dev_appserver.py files. One in the top level directory of the google
appengine package, and one in the ./google/appengine/tools/dev_appserver.py path. 

The location of the section seems to have changed in the 1.2.5 version of appenige,
here is a patch for this version:

--- dev_appserver.py.orig	2009-09-30 12:40:01.866023145 +0200
+++ dev_appserver.py	2009-09-30 12:44:18.826022219 +0200
@@ -1508,6 +1508,7 @@
       allowed_symbols = self._WHITE_LIST_PARTIAL_MODULES[module.__name__]
       for symbol in set(module.__dict__) - set(allowed_symbols):
         if not (symbol.startswith('__') and symbol.endswith('__')):
+          module.__dict__['old_'+symbol] = module.__dict__[symbol]
           del module.__dict__[symbol]
 
     if module.__name__ in self._MODULE_OVERRIDES:
Sign in to add a comment