Skip to content

Commit c2bc4e8

Browse files
butler54claude
andcommitted
fix: hash actual token file contents instead of hardcoded defaults
The previous code always hashed the literal strings 'usertoken' and 'admintoken' regardless of whether the user had changed the token files. Now reads the actual file content for hashing. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent fb5336f commit c2bc4e8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

scripts/gen-secrets.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ if [ ! -f "${PCCS_USER_TOKEN_FILE}" ]; then
4646
echo "Creating PCCS user token"
4747
echo "usertoken" > "${PCCS_USER_TOKEN_FILE}"
4848
fi
49-
echo -n "usertoken" | sha512sum | tr -d '[:space:]-' > "${COCO_SECRETS_DIR}/pccs_user_token_hash"
49+
tr -d '\n' < "${PCCS_USER_TOKEN_FILE}" | sha512sum | tr -d '[:space:]-' > "${COCO_SECRETS_DIR}/pccs_user_token_hash"
5050

5151
if [ ! -f "${PCCS_ADMIN_TOKEN_FILE}" ]; then
5252
echo "Creating PCCS admin token"
5353
echo "admintoken" > "${PCCS_ADMIN_TOKEN_FILE}"
5454
fi
55-
echo -n "admintoken" | sha512sum | tr -d '[:space:]-' > "${COCO_SECRETS_DIR}/pccs_admin_token_hash"
55+
tr -d '\n' < "${PCCS_ADMIN_TOKEN_FILE}" | sha512sum | tr -d '[:space:]-' > "${COCO_SECRETS_DIR}/pccs_admin_token_hash"
5656

5757
## Copy a sample values file if this stuff doesn't exist
5858

0 commit comments

Comments
 (0)