Comments (10)
@johnsonjo4531 I think we need your PR:) Thanks for doing this
from node-casbin.
@nodece @Zxilly @Shivansh-yadav13
from node-casbin.
Could you provide your case?
from node-casbin.
@IonVillarreal plz provide the full code, Casbin model, policy, request and response (expected and got)
from node-casbin.
Hi, sorry for the delay, I attached the snippet of the code where the error happened
import Head from "next/head";
import Image from "next/image";
import { Inter } from "next/font/google";
import styles from "@/styles/Home.module.css";
import { useEffect } from "react";
import {
Enforcer,
newEnforcer,
newModelFromString,
StringAdapter,
} from "casbin";
export const basicModel = `
[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = (r.sub == p.sub || p.sub == "*") && keyMatch2(r.obj, p.obj) && regexMatch(r.act, p.act)
`;
export const basicPolicy = `g, admin, ADMINISTRADOR`;
export default function Home() {
const iniciar = async () => {
const politicas: string[][] = []; // TODO: add
const model = newModelFromString(basicModel);
const policy = new StringAdapter(basicPolicy);
const enforcerTemp: Enforcer = await newEnforcer(model, policy);
for await (const p of politicas) {
await enforcerTemp.addPolicy(p[0], p[1], p[2], p[3], p[4], p[5]);
}
return enforcerTemp;
};
useEffect(() => {
iniciar();
}, []);
return (
<>
<Head>
<title>Create Next App</title>
</Head>
<main className={styles.main}>
<div className={styles.description}>
<div>
<a
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
By{" "}
<Image
src="/vercel.svg"
alt="Vercel Logo"
className={styles.vercelLogo}
width={100}
height={24}
priority
/>
</a>
</div>
</div>
</main>
</>
);
}
The error happens in Safari v16.3, but not happen in Safari v16.4 that released today
from node-casbin.
It still happens in v5.26.0 in Safari v16.3 but it doesn't happen in Safari v16.4
from node-casbin.
@johnsonjo4531 please take a look as it is caused by: #439
from node-casbin.
Yes, this is definitely my fault π . I used an ES2018 feature RegExp Negative LookBehind to implement the two lines of RegExp I used in my PR. I should have let you all know that it wouldn't work on older browsers. It should work on all modern (non End Of Life) Node.js versions though as far as I'm aware. I don't have much time to assist with the fix. But these two lines in ./src/util/util.ts are what need to be changed to not use back references. If they are changed back to what they used to be they will fail the tests I added to fix the bug in #438. See this series of answers on stack overflow for possible answers to not use the negative lookbehind.
from node-casbin.
@hsluoyz hopefully the above is enough info to get you guys going. I'll try to help you tomorrow if you can't get this by then just ping me, thanks.
from node-casbin.
π This issue has been resolved in version 5.26.1 π
The release is available on:
Your semantic-release bot π¦π
from node-casbin.
Related Issues (20)
- No Cloudflare Workers support? HOT 3
- Casbin Watcher for Prisma ORM HOT 4
- Add to Nest.js docs HOT 1
- KeyMatch5 does not match the expected result HOT 1
- [email protected]: The expression-eval npm package is no longer maintained HOT 5
- [feature] ABAC support for EnableAcceptJsonRequest() HOT 2
- enforcer.deleteUser() wiped out all data from `casbin_rule` table HOT 1
- Without enforcer.loadPolicy() Casbin behave unpredictably on mass updates. HOT 1
- [Bug] Can't resolve 'fs' HOT 7
- [bug] When using βwatcherExβ, deletion does not trigger it; you need to configure a βwatcherβ for it to work. HOT 2
- [Bug] The lack of a constructor results in the default configuration not taking effect. HOT 3
- addMatchingFunc HOT 2
- usage of addMatchingFunc HOT 2
- [Question] Can the cache stored in memory here be placed in Redis? HOT 3
- Why I can't use enforcer to judge the req using the rbac modle? HOT 1
- Enforcing with domains and 100k+ policies causing performance issues HOT 4
- [Bug] Policy definition contains 2 different policy sets (p and p2) doesn't work in Casbin editor HOT 4
- escapeAssertion does not respect string literals HOT 3
- Effects are ignored for all policies other than the first one HOT 2
- Fix: Discrepancy between `getAllNamedRoles` function implementation and comments HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-casbin.