【问题标题】:Why am I getting "A data breach on a site or app exposed your password. Chrome recommends changing your password on "SITENAME" now."为什么我会收到“网站或应用程序上的数据泄露泄露了您的密码。Chrome 建议立即更改您在“SITENAME”上的密码。”
【发布时间】:2020-06-13 16:15:37
【问题描述】:

我创建了一个应用,用 bcrypt 存储你的密码,表单的输入类型是密码。我不明白为什么我会收到此警报?为什么我会收到“网站或应用程序上的数据泄露泄露了您的密码。Chrome 建议立即更改您在“SITENAME”上的密码。”

  axios.post(`/signup`, {
                userBody: values.username,
                passwordBody: values.password
            }).then(response => console.log(response))
                .then(response => history.push('/login'))
                .catch(error => {
                    setErrors({
                        error: error.response.status
                    })
                })
        } else {

            alert('cant be empty fields')
        }
    }



server.js

app.post('/signup', async (req, res) => {

const today = new Date();
const userData = {
    username: req.body.userBody,
    password: req.body.passwordBody,
    created: today
};
User.findOne({
    where: {
        username: req.body.userBody
    }
})
    .then(user => {
        if (!user) {
            bcrypt.hash(req.body.passwordBody, 10, (err, hash) => {
                userData.password = hash
                User.create(userData)
                    .then(user => {
                        res.json({ status: user.username + " registered" })
                    })
                    .catch(err => {
                        res.send('error' + err)
                    })

            })
        }
        else {
            res.status(500).json({ message: 'message' })
            console.log('User exists')
        }

    })
    .catch(err => {
        res.send('error' + err)
    })

})

【问题讨论】:

    标签: node.js reactjs rest google-chrome axios


    【解决方案1】:

    代码看起来没问题。如果您使用的是谷歌浏览器,它有一个功能,如果您使用的密码以前被泄露,它会发出警告。因此,如果您使用通用密码进行测试,则可能会发生这种情况。如果这是生产,则应按照警告指示更新密码。

    Link to Consumer Affairs Article: New version of Chrome warns users if their password was exposed in a data breach

    【讨论】:

    • 谢谢你,我用 abc 做通过测试,吓死我了
    【解决方案2】:

    这是谷歌浏览器的一项新功能,用于检查密码泄露,您可以在这篇谷歌文章中阅读更多信息:https://security.googleblog.com/2019/12/better-password-protections-in-chrome.html

    他们也有这个 Beta API:https://cloud.google.com/recaptcha-enterprise/docs/check-passwords 这样,我们可以直接检查用户/密码是否被泄露,而不是依赖 Chrome 来通知用户/客户。

    【讨论】:

      【解决方案3】:

      我在 Vercel 开发环境中的 react 构建应用程序中遇到了同样的问题,我通过将密码更改为更复杂和更安全的密码来解决。也就是说,它与您的应用无关

      【讨论】:

        【解决方案4】:

        会发生这种情况,虽然代码可能没问题,但如果你照顾它会更好。

        我建议以下三个步骤:

        1. 验证您的网站是否有safe browsing status
        2. 举报incorrect phishing warning
        3. Google Search Console注册您的网站。

        最好的,

        【讨论】:

          猜你喜欢
          • 2020-05-03
          • 2022-08-06
          • 2020-08-17
          • 2020-10-13
          • 1970-01-01
          • 2013-05-06
          • 2020-12-04
          • 1970-01-01
          • 2022-01-21
          相关资源
          最近更新 更多