Skip to content

Commit 432dbde

Browse files
committed
Store allowlist rejections
1 parent 437213e commit 432dbde

File tree

3 files changed

+2
-35
lines changed

3 files changed

+2
-35
lines changed

src/allowlist/index.ts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -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

worker-configuration.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface Env {
66
REGION: 'auto'
77
STUDIO_USER: 'admin'
88
STUDIO_PASS: '123456'
9-
ENABLE_ALLOWLIST: 1
9+
ENABLE_ALLOWLIST: 0
1010
ENABLE_RLS: 0
1111
EXTERNAL_DB_TYPE: 'postgresql'
1212
AUTH_ALGORITHM: 'RS256'

wrangler.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ STUDIO_USER = "admin"
4343
STUDIO_PASS = "123456"
4444

4545
# Toggle to enable default features
46-
ENABLE_ALLOWLIST = 1
46+
ENABLE_ALLOWLIST = 0
4747
ENABLE_RLS = 0
4848

4949
# External database source details

0 commit comments

Comments
 (0)