diff --git a/.githooks/commit-msg b/.githooks/commit-msg index 2fcfefb..fc281d2 100755 --- a/.githooks/commit-msg +++ b/.githooks/commit-msg @@ -15,8 +15,12 @@ COMMIT_MSG_FILE="$1" COMMIT_MSG=$(cat "$COMMIT_MSG_FILE") -# Temp file to signal post-commit hook -RELEASE_TRIGGER_FILE="/tmp/.marksyncr-release-trigger" +# Where the release trigger is recorded, for the post-commit hook to read. +# Kept inside the repository's git directory rather than /tmp: a fixed name in a +# world-writable directory can be pre-created or symlinked by another user on a +# shared machine, and a per-repo path also stops two checkouts colliding. +GIT_DIR_PATH=$(git rev-parse --git-dir) +RELEASE_TRIGGER_FILE="$GIT_DIR_PATH/marksyncr-release-trigger" # Clean up any previous trigger rm -f "$RELEASE_TRIGGER_FILE" diff --git a/.githooks/post-commit b/.githooks/post-commit index b180856..6327318 100755 --- a/.githooks/post-commit +++ b/.githooks/post-commit @@ -18,8 +18,12 @@ BLUE='\033[0;34m' RED='\033[0;31m' NC='\033[0m' # No Color -# Temp file from commit-msg hook -RELEASE_TRIGGER_FILE="/tmp/.marksyncr-release-trigger" +# Where the release trigger is recorded, for the post-commit hook to read. +# Kept inside the repository's git directory rather than /tmp: a fixed name in a +# world-writable directory can be pre-created or symlinked by another user on a +# shared machine, and a per-repo path also stops two checkouts colliding. +GIT_DIR_PATH=$(git rev-parse --git-dir) +RELEASE_TRIGGER_FILE="$GIT_DIR_PATH/marksyncr-release-trigger" # Check if a release was triggered if [ -f "$RELEASE_TRIGGER_FILE" ]; then diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 8abab9e..89b55f9 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -20,16 +20,19 @@ NC='\033[0m' # No Color # Track if any check fails FAILED=0 -# Function to run a check +# Function to run a check. +# Takes the command as separate arguments and runs it directly rather than +# through `eval`, which would re-parse the string as shell and expand anything +# a caller interpolated into it. run_check() { local name="$1" - local cmd="$2" + shift echo "----------------------------------------" echo " $name" echo "----------------------------------------" - if eval "$cmd"; then + if "$@"; then echo "${GREEN} $name passed${NC}" echo "" else @@ -49,10 +52,10 @@ if [ -z "$STAGED_FILES" ]; then fi # 1. Linting -run_check "Lint" "pnpm lint" +run_check "Lint" pnpm lint # 2. Build check -run_check "Build" "pnpm build" +run_check "Build" pnpm build # Final result echo "----------------------------------------" diff --git a/.gitleaksignore b/.gitleaksignore new file mode 100644 index 0000000..a21aa1e --- /dev/null +++ b/.gitleaksignore @@ -0,0 +1,21 @@ +# gitleaks false positives, verified by reading the flagged commit. +# +# The CI job scans the full history (`gitleaks detect --source .`), so these +# findings cannot be resolved by editing the working tree -- the match lives in +# a commit that is already written. Each fingerprint below was checked against +# `git show :` and carries no credential material. +# +# Re-verify before adding an entry here. An entry is a claim that a human looked +# at the matched line and found no secret, not a way to quiet a noisy job. + +# Rule `dropbox-api-token` matched the *response header name* in +# response.headers.get('dropbox-api-result') +# The literal is an HTTP header key, not a token. +4bfe09616e7cb4e28428992f8ca33a2835caba2e:packages/sources/src/oauth/dropbox-sync.ts:dropbox-api-token:142 +7f5c8e0dfba8493dfb2055518851c4fad0fb1078:packages/sources/src/oauth/dropbox-sync.ts:dropbox-api-token:112 + +# Rule `generic-api-key` matched the Ahrefs Analytics site key on the +#