mbkauthe 1.0.24 → 1.0.26
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/lib/main.js +2 -32
- package/lib/validateSessionAndRole.js +1 -1
- package/package.json +1 -1
package/lib/main.js
CHANGED
|
@@ -48,36 +48,6 @@ const LoginLimit = rateLimit({
|
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
router.use((req, res, next) => {
|
|
52
|
-
// Don't allow embedding in iframes
|
|
53
|
-
res.setHeader('X-Frame-Options', 'DENY');
|
|
54
|
-
|
|
55
|
-
// Prevent MIME type sniffing
|
|
56
|
-
res.setHeader('X-Content-Type-Options', 'nosniff');
|
|
57
|
-
|
|
58
|
-
// Enable XSS protection
|
|
59
|
-
res.setHeader('X-XSS-Protection', '1; mode=block');
|
|
60
|
-
|
|
61
|
-
// Referrer policy
|
|
62
|
-
res.setHeader('Referrer-Policy', 'strict-origin-when-cross-origin');
|
|
63
|
-
|
|
64
|
-
// Content Security Policy
|
|
65
|
-
const csp = [
|
|
66
|
-
"default-src 'self'",
|
|
67
|
-
"script-src 'self' 'unsafe-inline' https://www.google.com https://www.gstatic.com",
|
|
68
|
-
"style-src 'self' 'unsafe-inline'",
|
|
69
|
-
"img-src 'self' data:",
|
|
70
|
-
"connect-src 'self' https://www.google.com",
|
|
71
|
-
"frame-src https://www.google.com",
|
|
72
|
-
"form-action 'self'"
|
|
73
|
-
].join('; ');
|
|
74
|
-
|
|
75
|
-
res.setHeader('Content-Security-Policy', csp);
|
|
76
|
-
|
|
77
|
-
next();
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
|
|
81
51
|
// Configure session with proper domain settings for cross-subdomain sharing
|
|
82
52
|
const sessionConfig = {
|
|
83
53
|
store: new PgSession({
|
|
@@ -90,7 +60,7 @@ const sessionConfig = {
|
|
|
90
60
|
saveUninitialized: false,
|
|
91
61
|
proxy: true, // Trust the reverse proxy
|
|
92
62
|
cookie: {
|
|
93
|
-
maxAge: mbkautheVar.COOKIE_EXPIRE_TIME,
|
|
63
|
+
maxAge: mbkautheVar.COOKIE_EXPIRE_TIME * 24 * 60 * 60 * 1000,
|
|
94
64
|
domain: mbkautheVar.IS_DEPLOYED === 'true' ? `.${mbkautheVar.DOMAIN}` : undefined,
|
|
95
65
|
httpOnly: true,
|
|
96
66
|
secure: mbkautheVar.IS_DEPLOYED === 'true' ? 'auto' : false, // 'auto' respects X-Forwarded-Proto
|
|
@@ -127,7 +97,7 @@ router.use(async (req, res, next) => {
|
|
|
127
97
|
|
|
128
98
|
// Set consistent cookie options for all cookies
|
|
129
99
|
const getCookieOptions = () => ({
|
|
130
|
-
maxAge: mbkautheVar.COOKIE_EXPIRE_TIME,
|
|
100
|
+
maxAge: mbkautheVar.COOKIE_EXPIRE_TIME * 24 * 60 * 60 * 1000,
|
|
131
101
|
domain: mbkautheVar.IS_DEPLOYED === 'true' ? `.${mbkautheVar.DOMAIN}` : undefined,
|
|
132
102
|
secure: mbkautheVar.IS_DEPLOYED === 'true' ? 'auto' : false,
|
|
133
103
|
sameSite: 'lax',
|
|
@@ -3,7 +3,7 @@ const mbkautheVar = JSON.parse(process.env.mbkautheVar);
|
|
|
3
3
|
|
|
4
4
|
// Get consistent cookie options
|
|
5
5
|
const getCookieOptions = () => ({
|
|
6
|
-
maxAge: mbkautheVar.COOKIE_EXPIRE_TIME,
|
|
6
|
+
maxAge: mbkautheVar.COOKIE_EXPIRE_TIME * 24 * 60 * 60 * 1000,
|
|
7
7
|
domain: mbkautheVar.IS_DEPLOYED === 'true' ? `.${mbkautheVar.DOMAIN}` : undefined,
|
|
8
8
|
secure: mbkautheVar.IS_DEPLOYED === 'true' ? 'auto' : false,
|
|
9
9
|
sameSite: 'lax',
|