Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"eslint-plugin-prettier": "^3.3.1",
"husky": "^2.3.0",
"jest": "^26.6.3",
"lint-staged": "^8.1.7",
"lint-staged": "^16.2.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.2.1",
"pretty-quick": "^3.1.0",
Expand All @@ -52,8 +52,8 @@
"@casbin/expression-eval": "^5.3.0",
"await-lock": "^2.0.1",
"buffer": "^6.0.3",
"csv-parse": "^5.5.6",
"minimatch": "^10.2.1"
"csv-parse": "^7.0.3",
"minimatch": "^10.2.6"
},
"files": [
"lib",
Expand All @@ -75,5 +75,8 @@
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"engines": {
"node": "20 || >=22"
}
}
4 changes: 2 additions & 2 deletions src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ function deepCopy(obj: Array<any> | any): any {

function customIn(a: number | string, b: number | string): number {
if ((b as any) instanceof Array) {
return (((b as any) as Array<any>).includes(a) as unknown) as number;
return (b as any as Array<any>).includes(a) as unknown as number;
}
return ((a in (b as any)) as unknown) as number;
return (a in (b as any)) as unknown as number;
}

function bracketCompatible(exp: string): string {
Expand Down
14 changes: 7 additions & 7 deletions test/enforcer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -601,9 +601,9 @@ test('test ABAC multiple eval()', async () => {
);

const e = await newEnforcer(m, policy);
await testEnforce(e, 56, (98 as unknown) as string, 'read', true);
await testEnforce(e, 23, (67 as unknown) as string, 'read', false);
await testEnforce(e, 78, (34 as unknown) as string, 'read', false);
await testEnforce(e, 56, 98 as unknown as string, 'read', true);
await testEnforce(e, 23, 67 as unknown as string, 'read', false);
await testEnforce(e, 78, 34 as unknown as string, 'read', false);
});

// https://github.com/apache/casbin-node-casbin/issues/438
Expand All @@ -621,10 +621,10 @@ test('test ABAC single eval() with r. in unexpected places', async () => {
);

const e = await newEnforcer(m, policy);
await testEnforce(e, { id: 3 }, ({ owner: { id: 3 } } as unknown) as string, 'read', true);
await testEnforce(e, {}, ({ owner: {} } as unknown) as string, 'read', false);
await testEnforce(e, { id: 3 }, ({ owner: {} } as unknown) as string, 'read', false);
await testEnforce(e, { id: 3 }, ({ owner: { id: 2 } } as unknown) as string, 'read', false);
await testEnforce(e, { id: 3 }, { owner: { id: 3 } } as unknown as string, 'read', true);
await testEnforce(e, {}, { owner: {} } as unknown as string, 'read', false);
await testEnforce(e, { id: 3 }, { owner: {} } as unknown as string, 'read', false);
await testEnforce(e, { id: 3 }, { owner: { id: 2 } } as unknown as string, 'read', false);
});

test('test escapeAssertion with string literals (issue)', async () => {
Expand Down
Loading
Loading