mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-03 23:37:53 +01:00
fix: a SESSION_ID without urandom falls back to the start's pid, so two same-second runs keep separate lease entries (GST-1205 review round 2)
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
8fee35a6ad
commit
7444f6a4ce
1 file changed
+3
-2
@@ -234,9 +234,10 @@ _TEL_PROMPTED=$([ -f "$_GH/.telemetry-prompted" ] && echo "yes" || echo "no")
|
||||
_TEL_START=$(date +%s)
|
||||
# PID+epoch alone is guessable; a random suffix makes the block-binding token
|
||||
# unforgeable by content reflected into the same tool result. Falls back to
|
||||
# the plain form when urandom is unavailable.
|
||||
# this process's pid when urandom is unavailable, so two same-second starts
|
||||
# never share a SESSION_ID (it also keys their lease runs, GST-1205).
|
||||
_SID_RAND=$(od -An -N4 -tx4 /dev/urandom 2>/dev/null | tr -d ' \n' || true)
|
||||
_SESSION_ID="$PARENT_PID-$_TEL_START${_SID_RAND:+-$_SID_RAND}"
|
||||
_SESSION_ID="$PARENT_PID-$_TEL_START-${_SID_RAND:-$$}"
|
||||
# The install-scoped twin (bin/gstack-lease): what bin/gstack-upgrade reads
|
||||
# before moving a checkout other sessions share. This run holds it until
|
||||
# gstack-skill-end releases its SESSION_ID (GST-1205). Fail-open, but a lease
|
||||
|
||||
Reference in new issue
Block a user