fix: redact gateway session header from Caddy logs
This commit is contained in:
@@ -123,6 +123,10 @@ docker compose logs --tail=200 runtime caddy
|
|||||||
docker compose exec runtime pnpm --filter @sammo-ts/release-controller status
|
docker compose exec runtime pnpm --filter @sammo-ts/release-controller status
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Caddy의 runtime logger는 reverse proxy 오류에도 요청 정보를 남길 수 있으므로
|
||||||
|
`X-Session-Token` 값을 encoder 단계에서 삭제합니다. 장애 로그를 수집할 때도
|
||||||
|
인증 헤더, cookie, token과 secret을 보고서나 채팅에 복사하지 않습니다.
|
||||||
|
|
||||||
## 개발 bind 모드
|
## 개발 bind 모드
|
||||||
|
|
||||||
로컬 Core2026 checkout을 container에 bind하고 DB/Redis/Caddy는 같은 구성으로
|
로컬 Core2026 checkout을 container에 bind하고 DB/Redis/Caddy는 같은 구성으로
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
{
|
{
|
||||||
email {$ACME_EMAIL}
|
email {$ACME_EMAIL}
|
||||||
|
log {
|
||||||
|
format filter {
|
||||||
|
request>headers>X-Session-Token delete
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{$SITE_ADDRESS} {
|
{$SITE_ADDRESS} {
|
||||||
|
|||||||
@@ -38,3 +38,9 @@ test('runtime entrypoint removes raw repository secrets before launching PM2', a
|
|||||||
assert.ok(httpsUnset > 0 && httpsUnset < pm2Start);
|
assert.ok(httpsUnset > 0 && httpsUnset < pm2Start);
|
||||||
assert.ok(sshUnset > 0 && sshUnset < pm2Start);
|
assert.ok(sshUnset > 0 && sshUnset < pm2Start);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Caddy runtime logs remove the custom Gateway session header', async () => {
|
||||||
|
const caddyfile = await fs.readFile(new URL('../caddy/Caddyfile', import.meta.url), 'utf8');
|
||||||
|
|
||||||
|
assert.match(caddyfile, /log\s*\{[\s\S]*format filter\s*\{[\s\S]*request>headers>X-Session-Token delete/);
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user