11import type { SDK } from "caido:plugin" ;
2+ import type { Request , Response } from "caido:utils" ;
23
34import type { CspVulnerability } from "./types" ;
45import { VULNERABILITY_RULES } from "./vulnerability-rules" ;
@@ -8,8 +9,8 @@ export class FindingsGenerator {
89
910 static async createFinding (
1011 vulnerability : CspVulnerability ,
11- request : any , // Caido Request object
12- response : any , // Caido Response object
12+ request : unknown , // Caido Request object
13+ response : unknown , // Caido Response object
1314 sdk : SDK ,
1415 ) : Promise < void > {
1516 try {
@@ -19,8 +20,8 @@ export class FindingsGenerator {
1920 title : rule . title ,
2021 description : this . generateDetailedDescription ( vulnerability , rule ) ,
2122 reporter : this . REPORTER_NAME ,
22- request : request ,
23- response : response ,
23+ request : request as Request ,
24+ response : response as Response ,
2425 severity : this . mapSeverityToCaido ( vulnerability . severity ) ,
2526 } ;
2627
@@ -37,15 +38,16 @@ export class FindingsGenerator {
3738
3839 static async createMultipleFindings (
3940 vulnerabilities : CspVulnerability [ ] ,
40- request : any ,
41- response : any ,
41+ request : unknown ,
42+ response : unknown ,
4243 sdk : SDK ,
4344 ) : Promise < void > {
4445 const promises = vulnerabilities . map ( ( vuln ) =>
4546 this . createFinding ( vuln , request , response , sdk ) ,
4647 ) ;
4748
4849 try {
50+ // eslint-disable-next-line compat/compat
4951 await Promise . all ( promises ) ;
5052 sdk . console . log ( `Created ${ vulnerabilities . length } CSP findings` ) ;
5153 } catch ( error ) {
@@ -73,7 +75,7 @@ export class FindingsGenerator {
7375 ] ;
7476
7577 // Add CWE information if available
76- if ( rule . cweId ) {
78+ if ( typeof rule . cweId === "number" && rule . cweId > 0 ) {
7779 sections . push (
7880 `<h3>References</h3>` ,
7981 `<p><strong>CWE:</strong> <a href="https://cwe.mitre.org/data/definitions/${ rule . cweId } .html">CWE-${ rule . cweId } </a></p>` ,
@@ -232,10 +234,10 @@ export class FindingsGenerator {
232234 return grouped ;
233235 }
234236
235- static async cleanupOldFindings (
237+ static cleanupOldFindings (
236238 sdk : SDK ,
237239 maxAge : number = 24 * 60 * 60 * 1000 ,
238- ) : Promise < void > {
240+ ) : void {
239241 // This would need to be implemented based on Caido's findings API
240242 // For now, we'll just log the intent
241243 sdk . console . log ( `Would cleanup CSP findings older than ${ maxAge } ms` ) ;
0 commit comments