@hachej/boring-governance 0.1.64 → 0.1.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/index.js +12 -1
- package/package.json +10 -10
package/dist/server/index.js
CHANGED
|
@@ -700,7 +700,18 @@ function compileRules(rules) {
|
|
|
700
700
|
function userFromContext(ctx) {
|
|
701
701
|
const requestUser = ctx.request?.user;
|
|
702
702
|
if (requestUser?.email) {
|
|
703
|
-
|
|
703
|
+
const requestEmail = normalizePolicyEmail(requestUser.email);
|
|
704
|
+
const contextEmail = ctx.userEmail ? normalizePolicyEmail(ctx.userEmail) : null;
|
|
705
|
+
const sameContextPrincipal = contextEmail === requestEmail && (!requestUser.id || !ctx.userId || requestUser.id === ctx.userId);
|
|
706
|
+
return {
|
|
707
|
+
id: requestUser.id ?? (sameContextPrincipal ? ctx.userId : void 0),
|
|
708
|
+
email: requestUser.email,
|
|
709
|
+
// Some host auth hooks expose the principal on request.user but keep the
|
|
710
|
+
// normalized verification bit in the binding context. Trust the context
|
|
711
|
+
// bit only when it names the same principal; never combine verification
|
|
712
|
+
// from one principal with another request user's email.
|
|
713
|
+
emailVerified: requestUser.emailVerified === true || sameContextPrincipal && ctx.userEmailVerified === true
|
|
714
|
+
};
|
|
704
715
|
}
|
|
705
716
|
if (!ctx.userEmail) return null;
|
|
706
717
|
return { id: ctx.userId, email: ctx.userEmail, emailVerified: ctx.userEmailVerified === true };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hachej/boring-governance",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.65",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": "^18.0.0 || ^19.0.0",
|
|
41
41
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
42
|
-
"@hachej/boring-
|
|
43
|
-
"@hachej/boring-
|
|
44
|
-
"@hachej/boring-
|
|
45
|
-
"@hachej/boring-ui-kit": "0.1.
|
|
42
|
+
"@hachej/boring-agent": "0.1.65",
|
|
43
|
+
"@hachej/boring-bash": "0.1.65",
|
|
44
|
+
"@hachej/boring-core": "0.1.65",
|
|
45
|
+
"@hachej/boring-ui-kit": "0.1.65"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"yaml": "^2.9.0"
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
"react-dom": "^19.0.0",
|
|
61
61
|
"tsup": "^8.4.0",
|
|
62
62
|
"typescript": "~5.9.3",
|
|
63
|
-
"vitest": "^
|
|
64
|
-
"@hachej/boring-
|
|
65
|
-
"@hachej/boring-
|
|
66
|
-
"@hachej/boring-
|
|
67
|
-
"@hachej/boring-
|
|
63
|
+
"vitest": "^4.1.9",
|
|
64
|
+
"@hachej/boring-agent": "0.1.65",
|
|
65
|
+
"@hachej/boring-core": "0.1.65",
|
|
66
|
+
"@hachej/boring-bash": "0.1.65",
|
|
67
|
+
"@hachej/boring-ui-kit": "0.1.65"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"build": "tsup",
|