@@ -80,39 +80,6 @@ export async function isQueryAllowed(opts: {
8080 const normalizedQuery = parser . astify ( normalizeSQL ( sql ) )
8181
8282 // Compare ASTs while ignoring specific values
83- // const isCurrentAllowed = normalizedAllowlist?.some((allowedQuery) => {
84- // // Create deep copies to avoid modifying original ASTs
85- // const allowedAst = JSON.parse(JSON.stringify(allowedQuery))
86- // const queryAst = JSON.parse(JSON.stringify(normalizedQuery))
87-
88- // // Remove or normalize value fields from both ASTs
89- // const normalizeAst = (ast: any) => {
90- // if (Array.isArray(ast)) {
91- // ast.forEach(normalizeAst)
92- // } else if (ast && typeof ast === 'object') {
93- // // Remove or normalize fields that contain specific values
94- // if ('value' in ast) {
95- // // Preserve the value for specific clauses like LIMIT
96- // if (ast.as === 'limit' || ast.type === 'limit') {
97- // // Do not normalize LIMIT values
98- // return;
99- // }
100- // ast.value = '?'; // Normalize other values
101- // }
102-
103- // // Recursively normalize all other fields
104- // Object.values(ast).forEach(normalizeAst)
105- // }
106-
107- // return ast;
108- // };
109-
110- // normalizeAst(allowedAst)
111- // normalizeAst(queryAst)
112-
113- // return JSON.stringify(allowedAst) === JSON.stringify(queryAst)
114- // })
115-
11683 const deepCompareAst = ( allowedAst : any , queryAst : any ) : boolean => {
11784 if ( typeof allowedAst !== typeof queryAst ) return false
11885
0 commit comments