console.log(req) 显示数据库数据

发布于 2025-01-10 06:22:27 字数 913 浏览 0 评论 0原文

我运行了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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

南笙 2025-01-17 06:22:27

我的疑问总结是,请求可以从用户端查看/获取吗?

不。

请求对象用于在中间件和端点处理程序之间传递数据。它仅在服务器上可见。

The summary of my doubt is, can the req become viewable/obtainable from the user side?

No.

The request object is used to pass data between middleware and end point handlers. It is only visible on the server.

巨坚强 2025-01-17 06:22:27

看起来您正在从节点进程调用 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 this req object back to client via say http), this will not be visible from client side.

始于初秋 2025-01-17 06:22:27

如果这让你感觉好一点,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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文