Skip to content

Commit 00bc43b

Browse files
committed
unique debugger pin in Docker containers
1 parent 2cbdf2b commit 00bc43b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CHANGES.rst

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Unreleased
2020
(:issue:`1510`)
2121
- The debugger detects cycles in chained exceptions and does not time
2222
out in that case. (:issue:`1536`)
23+
- When running the development server in Docker, the debugger security
24+
pin is now unique per container.
2325

2426

2527
Version 0.15.2

src/werkzeug/debug/__init__.py

+13
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,19 @@ def get_machine_id():
6767
return rv
6868

6969
def _generate():
70+
# docker containers share the same machine id, get the
71+
# container id instead
72+
try:
73+
with open("/proc/self/cgroup") as f:
74+
value = f.readline()
75+
except IOError:
76+
pass
77+
else:
78+
value = value.strip().partition("/docker/")[2]
79+
80+
if value:
81+
return value
82+
7083
# Potential sources of secret information on linux. The machine-id
7184
# is stable across boots, the boot id is not
7285
for filename in "/etc/machine-id", "/proc/sys/kernel/random/boot_id":

0 commit comments

Comments
 (0)