Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.

Commit 0d26f2b

Browse files
chore: rm erroneous ref commands from sdk (#29)
* chore: rm erroneous ref commands from sdk * fix: also rm sdk.toast refs replace with console logs * fix: also rm verbose logging * fix: refactor events with method listener on fe * fix: use correct sdk events * fix: rm setComment and setTag on RequestsSDK * fix: upgrade tsconfig and fix send method in declaration file * fix: single source of truth typechecks * chore: track global declaration files * chore: also direct detection from allow header * docs: update guidance * fix: options filtering * docs: add image from tests * chore: rm temp logging for debugging * docs: update code block now pushed
1 parent 749bb11 commit 0d26f2b

8 files changed

Lines changed: 340 additions & 101 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ build/
2020

2121
# Declaration files
2222
*.d.ts
23+
!src/caido-fixes.d.ts
24+
!packages/*/src/caido-fixes.d.ts
2325

2426
# Source maps
2527
*.js.map

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ __This is a similar approach to one of my go to BAPPs, '[HTTP Methods Discloser]
4747

4848
When an HTTP request passes through Caido's proxy (not limited to in-scope), the plugin:
4949

50-
- Checks if the request has already been processed (to avoid duplicates)
50+
- Checks if the request has already been processed (to avoid duplicates) - This has been commented out for now and is easily adjustable - see the [Code Snippet](https://github.com/GangGreenTemperTatum/MethodCheck/blob/90d41ab02c70d3ba785039aadd29349349b4c597/packages/backend/src/index.ts#L213-L222) section below for more details.
5151
- Skips `OPTIONS requests` (to avoid recursive checks)
5252
- Sends an `OPTIONS` request to the same URL
5353
- Examines both `Allow` and `Access-Control-Allow-Methods` headers in the response
@@ -97,6 +97,7 @@ MethodCheck is designed to work seamlessly in the background, automatically chec
9797
>
9898
> ```bash
9999
> tail -f <path_to_log_file>
100+
> IE: tail -f ~/Library/Application\ Support/io.caido.Caido/logs/logging.2025-05-10.log
100101
> ```
101102
102103
```bash
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Reference the frontend declaration to avoid duplication
2+
/// <reference path="../../frontend/src/caido-fixes.d.ts" />
3+
4+
// This declaration file fixes TypeScript errors without modifying the core code logic
5+
6+
declare module "caido:plugin" {
7+
// Define core types that are missing
8+
export type DefineAPI<T> = T;
9+
export type DefineEvents<T> = T;
10+
11+
// Define the SDK interface
12+
export interface SDK<API = {}, Events = {}> {
13+
console: {
14+
log(message: string): void;
15+
error(message: string): void;
16+
};
17+
api: {
18+
register(name: string, fn: Function): void;
19+
send(event: string, data: any): void;
20+
};
21+
events: {
22+
onInterceptResponse(handler: (sdk: SDK, request: any, response: any) => Promise<void>): void;
23+
};
24+
requests: {
25+
query(): any;
26+
get(id: string): Promise<any>;
27+
send(spec: any): Promise<any>;
28+
setComment?(id: string, comment: string): Promise<void>;
29+
setTag?(id: string, tag: string): Promise<void>;
30+
};
31+
findings: {
32+
create(finding: any): Promise<any>;
33+
exists(dedupeKey: string): Promise<boolean>;
34+
};
35+
}
36+
}
37+
38+
// Define caido:utils module
39+
declare module "caido:utils" {
40+
export class RequestSpec {
41+
constructor(url: string);
42+
setMethod(method: string): void;
43+
setHeader(name: string, value: string): void;
44+
getHost(): string;
45+
getPort(): number;
46+
getPath(): string;
47+
getHeaders(): Record<string, string[]>;
48+
}
49+
}
50+
51+
// Add global functions that are missing
52+
declare function setInterval(callback: (...args: any[]) => void, ms: number): number;
53+
declare function clearInterval(id: number): void;

0 commit comments

Comments
 (0)