Skip to content
Browse files

don't save HUB_APIKEY to conf (security)

rational: if you launch a cloudtask from a command line or environment, you
may not want the apikey hanging around forever in the session configuration.
  • Loading branch information...
1 parent 0317ba1 commit a8936bb4369f20ebc8add241c9c4df5e96337bfb @lirazsiri lirazsiri committed
Showing with 6 additions and 4 deletions.
  1. +3 −1 cloudtask/session.py
  2. +3 −3 cloudtask/task.py
View
4 cloudtask/session.py
@@ -168,7 +168,9 @@ def taskconf(self, val=UNDEFINED):
if val is UNDEFINED:
return TaskConf.fromdict(eval(file(path).read()))
else:
- print >> file(path, "w"), pprint.pformat(val.dict())
+ d = val.dict()
+ del d['hub_apikey']
+ print >> file(path, "w"), pprint.pformat(d)
taskconf = property(taskconf, taskconf)
@property
View
6 cloudtask/task.py
@@ -208,12 +208,12 @@ def main(cls):
for attr in taskconf.__all__:
taskconf[attr] = getattr(cls, attr.upper())
- if not taskconf.hub_apikey:
- taskconf.hub_apikey = os.environ.get('HUB_APIKEY')
-
if taskconf.overlay and not taskconf.overlay.startswith('/'):
taskconf.overlay = abspath(join(dirname(sys.argv[0]), taskconf.overlay))
+ if not taskconf.hub_apikey:
+ taskconf.hub_apikey = os.environ.get('HUB_APIKEY')
+
for opt, val in opts:
if opt in ('--resume', '--sessions', '--force'):
continue

0 comments on commit a8936bb

Please sign in to comment.
Something went wrong with that request. Please try again.