From 692a8af8909b26e2cd3a6cf5b23d34ac7364721b Mon Sep 17 00:00:00 2001 From: Jayden Date: Fri, 27 Nov 2026 11:50:00 +0900 Subject: [PATCH] =?UTF-8?q?ci:=20=ED=91=B8=EC=8B=9C=C2=B7PR=EB=A7=88?= =?UTF-8?q?=EB=8B=A4=20gitleaks=20=EB=A1=9C=20=EB=B9=84=EB=B0=80=EA=B0=92?= =?UTF-8?q?=20=EC=BB=A4=EB=B0=8B=20=EC=97=AC=EB=B6=80=20=EA=B2=80=EC=82=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - git 기록 전체를 검사하고 비밀값이 나오면 실패한다 (gitleaks 8.30.1, 체크섬 확인) - 의존성·빌드 결과물·lock·캐시 파일은 .gitleaks.toml 에서 제외한다 - 확인을 마친 테스트·문서의 가짜 값은 .gitleaksignore 에 지문으로 등록한다 Co-Authored-By: Claude Opus 5.5 --- .github/workflows/gitleaks.yml | 45 ++++++++++++++++++++++++++++++++++ .gitleaks.toml | 32 ++++++++++++++++++++++++ .gitleaksignore | 16 ++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 .github/workflows/gitleaks.yml create mode 100644 .gitleaks.toml create mode 100644 .gitleaksignore diff --git a/.github/workflows/gitleaks.yml b/.github/workflows/gitleaks.yml new file mode 100644 index 0000000..b3767bd --- /dev/null +++ b/.github/workflows/gitleaks.yml @@ -0,0 +1,45 @@ +# 푸시·PR마다 git 기록 전체에서 비밀값(키, 토큰, 비밀번호)이 커밋됐는지 검사한다. +# git 에 올라간 파일만 읽으므로 node_modules·빌드 결과물은 대상이 아니고, +# lock·캐시 파일과 테스트용 가짜 값은 .gitleaks.toml / .gitleaksignore 에서 제외한다. +name: gitleaks + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: gitleaks-${{ github.ref }} + cancel-in-progress: true + +jobs: + scan: + runs-on: ubuntu-latest + timeout-minutes: 5 + env: + GITLEAKS_VERSION: 8.30.1 + GITLEAKS_SHA256: 551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Install gitleaks + run: | + curl -sSfL -o gitleaks.tar.gz \ + "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" + echo "${GITLEAKS_SHA256} gitleaks.tar.gz" | sha256sum -c - + tar -xzf gitleaks.tar.gz -C "$RUNNER_TEMP" gitleaks + rm gitleaks.tar.gz + + - name: Scan git history + run: | + "$RUNNER_TEMP/gitleaks" git . \ + --log-opts="--all" \ + --redact \ + --no-banner \ + --exit-code 1 diff --git a/.gitleaks.toml b/.gitleaks.toml new file mode 100644 index 0000000..bd1718b --- /dev/null +++ b/.gitleaks.toml @@ -0,0 +1,32 @@ +# gitleaks 비밀값 검사 설정 +# 기본 규칙을 그대로 쓰고, 의존성·빌드 결과물·lock·캐시 파일은 검사하지 않는다. +# 테스트에 넣은 가짜 값은 .gitleaksignore 에 지문으로 등록하거나 해당 줄에 `gitleaks:allow` 주석을 단다. + +[extend] +useDefault = true + +[[allowlists]] +description = "의존성, 빌드 결과물, lock, 캐시 파일" +paths = [ + '''(^|/)node_modules/''', + '''(^|/)\.pnpm-store/''', + '''(^|/)\.next/''', + '''(^|/)out/''', + '''(^|/)build/''', + '''(^|/)dist/''', + '''(^|/)coverage/''', + '''(^|/)\.vercel/''', + '''(^|/)\.turbo/''', + '''(^|/)\.cache/''', + '''(^|/)\.superpowers/''', + '''(^|/)\.hallmark/''', + '''(^|/)\.ua/''', + '''(^|/)\.terraform/''', + '''(^|/)[^/]*-lock\.ya?ml$''', + '''(^|/)package-lock\.json$''', + '''(^|/)yarn\.lock$''', + '''(^|/)\.terraform\.lock\.hcl$''', + '''\.tsbuildinfo$''', + '''(^|/)\.eslintcache$''', + '''(^|/)\.DS_Store$''', +] diff --git a/.gitleaksignore b/.gitleaksignore new file mode 100644 index 0000000..38e7b6b --- /dev/null +++ b/.gitleaksignore @@ -0,0 +1,16 @@ +# gitleaks 가 잡지만 실제 비밀값이 아닌 항목 (테스트·문서의 가짜 값) +# 형식: 커밋:파일:규칙:줄. 새 가짜 값은 해당 줄에 gitleaks:allow 주석을 다는 편이 낫다. +0b67ee18eb58577b004e7e042cf8dece5caf5ee2:lib/actions/admin/users.test.ts:generic-api-key:84 +28e05e1c10083971063a66301668a3cd1c472cc6:lib/admin/guard.test.ts:generic-api-key:29 +380b5898d97b00e0529e17bd58c22e8276254d5e:docs/superpowers/plans/2026-11-10-ai-draft-prompt.md:aws-access-token:331 +380b5898d97b00e0529e17bd58c22e8276254d5e:docs/superpowers/plans/2026-11-10-ai-draft-prompt.md:generic-api-key:332 +44c1de9e730d815525dc3432f077ff5f261efe92:lib/actions/admin/ai-control.test.ts:generic-api-key:53 +44c1de9e730d815525dc3432f077ff5f261efe92:lib/actions/admin/ai-prompts.test.ts:generic-api-key:83 +7779a38f20e640bf6e10e95d9c694eef98908615:lib/admin/path-key.test.ts:generic-api-key:8 +7f914ab03a1b6b620b15ed4915aeb77ad337c9f5:lib/report/report.test.ts:private-key:201 +8327b00185b68a623db24eb4ace79daed06eb248:lib/report/report.test.ts:private-key:213 +8bef6beaa9cc293708258dfb55d766bcbdd64c00:lib/observability/scrub.test.ts:jwt:19 +c3120bf6728c5906541926f8adabd45cb50a54ba:docs/superpowers/plans/2026-11-19-admin-console.md:generic-api-key:158 +e6487d13b338a8d1b910044c040174a7aa76273f:lib/actions/admin/posts.test.ts:generic-api-key:93 +e6487d13b338a8d1b910044c040174a7aa76273f:lib/actions/admin/prompt-history.test.ts:generic-api-key:75 +f46fd911150c9ba3f2750d1a372281619c6b7e0c:lib/admin/agent-request.test.ts:generic-api-key:77