console.log(req) 显示数据库数据
我运行了console.log(req);来查看那里有什么,发现数据库中的数据与
sessionStore: MySQLStore {
. . .
options: {
host: 'localhost',
user: 'root',
password: '1324',
database: 'dbso',
endConnectionOnClose: true,
clearExpired: true,
checkExpirationInterval: 900000,
expiration: 86400000,
createDatabaseTable: true,
connectionLimit: 1,
charset: 'utf8mb4_bin',
schema: [Object]
}, . . .
我正在使用的会话数据一起显示express-mysql-session< /code> 和
express-session
app.use(session({
secret: "sss",
resave: false,
saveUninitialized: false,
store: new mySQLStore({ /*Database info*/ })
}));
我关心和疑惑的是我应该为此担心多少,如果我应该担心,我该如何解决呢?
我们的网站使用 cookie 来存储用户会话。
我的疑问总结是,请求可以从用户端查看/获取吗?
I ran a console.log(req);
to see what was there and found that the data from the DB is shown together with the session data
sessionStore: MySQLStore {
. . .
options: {
host: 'localhost',
user: 'root',
password: '1324',
database: 'dbso',
endConnectionOnClose: true,
clearExpired: true,
checkExpirationInterval: 900000,
expiration: 86400000,
createDatabaseTable: true,
connectionLimit: 1,
charset: 'utf8mb4_bin',
schema: [Object]
}, . . .
I am working with express-mysql-session
and express-session
app.use(session({
secret: "sss",
resave: false,
saveUninitialized: false,
store: new mySQLStore({ /*Database info*/ })
}));
My concern and doubt is how much I should worry about this, and if I should worry about it, how can I solve it?
Our site uses cookies to store user sessions.
The summary of my doubt is, can the req become viewable/obtainable from the user side?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不。
请求对象用于在中间件和端点处理程序之间传递数据。它仅在服务器上可见。
No.
The request object is used to pass data between middleware and end point handlers. It is only visible on the server.
看起来您正在从节点进程调用
console.log
。除非您正在做一些非常奇怪的事情(例如通过 http 将此req
对象发送回客户端),否则这从客户端是不可见的。It looks like you are doing calling
console.log
from the node process. Unless you are doing something very strange (eg sending thisreq
object back to client via say http), this will not be visible from client side.如果这让你感觉好一点,express-session 已经存在了 8 年了,请参阅 这个,
这完全是故意的,没有人抱怨过。
我认为它只会添加到您收到的
req
中。但客户端无法访问它If it makes you feel better, that has been there 8 years in express-session, see this,
it's completely intentional, and nobody's has complained.
I think it's only added to the
req
that you recieve. but the client side has no access to it