STYLE : 로그 수정

This commit is contained in:
KMINGON 2025-05-31 11:55:44 +09:00
commit 7b704cacf4

View file

@ -2,21 +2,21 @@ import type { Request, Response } from "caido:utils";
// 토큰 누출 검사 결과를 담는 구조
export interface TokenLeakResult {
found: boolean; // 토큰이 발견되었는지 여부 (true/false)
location: 'url' | 'body' | 'header'; // 토큰이 발견된 위치 (url, body, header 중 하나)
title: string; // 경고 제목
description: string; // 상세 설명
value?: string; // 실제 발견된 값 (선택적)
found: boolean; // 토큰이 발견되었는지 여부 (true/false)
location: 'url' | 'body' | 'header'; // 토큰이 발견된 위치 (url, body, header 중 하나)
title: string; // 경고 제목
description: string; // 상세 설명
value?: string; // 실제 발견된 값 (선택적)
}
// 액세스 토큰 누출 검사 클래스
export class AccessTokenLeakController {
/**
* @param request - HTTP
* @returns , null
*/
async testReq(request: Request): Promise<TokenLeakResult | null> {
/**
* @param request - HTTP
* @returns , null
*/
async testReq(request: Request): Promise<TokenLeakResult | null> {
// === 1. URL에서 토큰 검사 ===
const url = request.getUrl();
@ -28,7 +28,7 @@ export class AccessTokenLeakController {
found: true,
location: 'url',
title: "Access Token Leak in URL",
description: `요청 URL에 액세스 토큰 파라미터가 포함되어 있습니다. (토큰: ${extractedTokenFromUrl.substring(0, 20)}...)`,
description: `요청 URL에 토큰이 포함되어 있습니다. (토큰: ${extractedTokenFromUrl.substring(0, 20)}...)`,
value: url
};
}
@ -46,7 +46,7 @@ export class AccessTokenLeakController {
found: true,
location: 'body',
title: "Access Token Leak in Request Body",
description: `요청 Body에 access_token 파라미터가 포함되어 있습니다. (토큰: ${extractedTokenFromBody.substring(0, 20)}...)`,
description: `요청 Body에 토큰이이 포함되어 있습니다. (토큰: ${extractedTokenFromBody.substring(0, 20)}...)`,
value: bodyText
};
}
@ -75,7 +75,7 @@ export class AccessTokenLeakController {
found: true,
location: 'header',
title: "Access Token Leak in Redirect URL",
description: `Location 헤더에 액세스 토큰이 노출되었습니다: ${locationHeaderStr} (토큰: ${extractedTokenFromHeader.substring(0, 20)}...)`,
description: `Location 헤더에 토큰이 노출되었습니다: ${locationHeaderStr} (토큰: ${extractedTokenFromHeader.substring(0, 20)}...)`,
value: locationHeaderStr
};
}
@ -88,13 +88,13 @@ export class AccessTokenLeakController {
const bodyText = await bodyBytes.toText();
const extractedTokenFromBody = this.extractTokenFromText(bodyText);
if (extractedTokenFromBody) {
return {
found: true,
location: 'body',
title: "Access Token Leak in Response Body",
description: `HTTP 응답 본문에 'access_token' 토큰이 노출되었습니다. (토큰: ${extractedTokenFromBody.substring(0, 20)}...)`,
description: `HTTP 응답 본문에 토큰이 노출되었습니다. (토큰: ${extractedTokenFromBody.substring(0, 20)}...)`,
value: bodyText
};
}