Add Tuple type

This commit is contained in:
Koen Vlaswinkel
2023-04-14 10:53:34 +02:00
parent f0fbaabd69
commit fd98f3400b

View File

@@ -12,13 +12,15 @@ export type ExternalApiUsageByType = {
export type ExtensiblePredicateDefinition = { export type ExtensiblePredicateDefinition = {
extensiblePredicate: string; extensiblePredicate: string;
generateMethodDefinition: (method: ExternalApiUsageByType) => any[]; generateMethodDefinition: (method: ExternalApiUsageByType) => Tuple[];
readModeledMethod: (row: any[]) => ModeledMethodWithSignature; readModeledMethod: (row: Tuple[]) => ModeledMethodWithSignature;
supportedKinds?: string[]; supportedKinds?: string[];
}; };
function readRowToMethod(row: any[]): string { type Tuple = boolean | number | string;
function readRowToMethod(row: Tuple[]): string {
return `${row[0]}.${row[1]}#${row[3]}${row[4]}`; return `${row[0]}.${row[1]}#${row[3]}${row[4]}`;
} }
@@ -48,8 +50,8 @@ export const extensiblePredicateDefinitions: Record<
modeledMethod: { modeledMethod: {
type: "source", type: "source",
input: "", input: "",
output: row[6], output: row[6] as string,
kind: row[7], kind: row[7] as string,
}, },
}), }),
supportedKinds: ["remote"], supportedKinds: ["remote"],
@@ -75,9 +77,9 @@ export const extensiblePredicateDefinitions: Record<
signature: readRowToMethod(row), signature: readRowToMethod(row),
modeledMethod: { modeledMethod: {
type: "sink", type: "sink",
input: row[6], input: row[6] as string,
output: "", output: "",
kind: row[7], kind: row[7] as string,
}, },
}), }),
supportedKinds: ["sql", "xss", "logging"], supportedKinds: ["sql", "xss", "logging"],
@@ -104,9 +106,9 @@ export const extensiblePredicateDefinitions: Record<
signature: readRowToMethod(row), signature: readRowToMethod(row),
modeledMethod: { modeledMethod: {
type: "summary", type: "summary",
input: row[6], input: row[6] as string,
output: row[7], output: row[7] as string,
kind: row[8], kind: row[8] as string,
}, },
}), }),
supportedKinds: ["taint", "value"], supportedKinds: ["taint", "value"],