wol-gate: 로그에 찍히는 요청 주소에서 token·key·secret·password 류 쿼리 값을 ***로 가림 — 10-25 /ws?token=… 이 깨우기 로그에 그대로 남아 있었음(배포 전: 이미지 재빌드+앱 재배포 필요)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
956a23297a
commit
d6a126cfdf
1 file changed
+6
-1
+6
-1
@@ -238,7 +238,12 @@ function describeRequester(req) {
|
||||
const ip = extractClientIp(req) || '-';
|
||||
const ua = req.headers['user-agent'] || '-';
|
||||
const host = req.headers['host'] || '-';
|
||||
return `${ip} "${req.method} ${host}${req.url}" UA="${ua}"`;
|
||||
return `${ip} "${req.method} ${host}${maskSecrets(req.url)}" UA="${ua}"`;
|
||||
}
|
||||
|
||||
// 로그에 인증 토큰이 그대로 남지 않게 쿼리의 token·key·secret·password 류 값을 가린다
|
||||
function maskSecrets(url) {
|
||||
return String(url || '').replace(/([?&](?:token|access_token|auth|auth_token|api_key|apikey|key|secret|password|pw|sid|session)=)[^&#\s]*/gi, '$1***');
|
||||
}
|
||||
|
||||
function maybeWake(req) {
|
||||
|
||||
Reference in new issue
Block a user