Skip to content

Commit

Permalink
unique debugger pin in Docker containers
Browse files Browse the repository at this point in the history
  • Loading branch information
davidism committed May 14, 2019
1 parent 2cbdf2b commit 00bc43b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Unreleased
(:issue:`1510`)
- The debugger detects cycles in chained exceptions and does not time
out in that case. (:issue:`1536`)
- When running the development server in Docker, the debugger security
pin is now unique per container.


Version 0.15.2
Expand Down
13 changes: 13 additions & 0 deletions src/werkzeug/debug/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ def get_machine_id():
return rv

def _generate():
# docker containers share the same machine id, get the
# container id instead
try:
with open("/proc/self/cgroup") as f:
value = f.readline()
except IOError:
pass
else:
value = value.strip().partition("/docker/")[2]

if value:
return value

# Potential sources of secret information on linux. The machine-id
# is stable across boots, the boot id is not
for filename in "/etc/machine-id", "/proc/sys/kernel/random/boot_id":
Expand Down

0 comments on commit 00bc43b

Please sign in to comment.