nonceCheck 수정2

This commit is contained in:
sultanofdisco 2025-05-31 14:39:20 +09:00
commit 252400a911
3 changed files with 14 additions and 12 deletions

View file

@ -1,5 +1,5 @@
import type { SDK, DefineAPI } from "caido:plugin";
import type { Request } from "caido:utils";
import type { Request, Response } from "caido:utils";
import { ImplicitGrantController } from "./controller/implictGrant";
import { AuthZCodeGrantController } from "./controller/authZCodeGrant";
import { NonceCheckController } from "./controller/nonceCheck";
@ -8,6 +8,7 @@ export type API = DefineAPI<{}>;
const implicitGrantController = new ImplicitGrantController();
const authZCodeGrantController = new AuthZCodeGrantController();
const nonceCheckController = new NonceCheckController();
// function matchSSORequest(req: Request): boolean {
// const raw = req.getRaw().toString();
@ -28,7 +29,8 @@ const authZCodeGrantController = new AuthZCodeGrantController();
// }
export function init(sdk: SDK<API>) {
sdk.events.onInterceptRequest(async (sdk, req: Request) => {
// 요청 이벤트
sdk.events.onInterceptRequest(async (sdk, req) => {
const result =
authZCodeGrantController.testReq(req) ||
implicitGrantController.testReq(req);
@ -41,8 +43,12 @@ export function init(sdk: SDK<API>) {
reporter: "",
});
}
});
if(NonceCheckController.isOidcFlow(req)) {
// 응답 이벤트
sdk.events.onInterceptResponse(async (sdk, req, res) => {
if (NonceCheckController.isOidcFlow(req, res)) {
await sdk.findings.create({
title: "OIDC Flow Detected",
description: "The request appears to be part of an OIDC flow.",