Should the password be plain text when creating a user through the API?

I’m creating a small windows application that will use Discourse as the SSO provider. The first step in that chain is allowing the app to create a user through the Discourse API.

I’ve got that working, however it seems that the password for the user is passed in plain text and I’m wondering why that is? It seems like that could be a security issue… is the thought just that people should use SSL and that’s good enough to protect the password?

Yes, SSL is considered sufficient to protect secrets in-flight. Until the world sees the light and switches to something like TLS-SRP, sharing secrets over a secured channel are pretty much all we’ve got to work with.

我们可以发送加密密码而不是明文密码吗?

有没有办法传递加密密码而不是明文密码?我们正在开发一个应用,其中使用 /session API 来验证用户身份,需要提交用户名和密码。我注意到一个问题:如果打开浏览器的开发者工具,可以看到我们登录时传递的明文密码。因此,如果任何人能访问我的笔记本电脑,密码就可能被窃取,对吗?

如果启用了 SSO,则根本不会使用密码,因此这不是问题。只需提供一些随机字符即可。

如果你想做得更彻底,可以在你的 APP 中实施证书锁定(certificate pinning),以确保没有中间人攻击。

只要您使用 TLS,密码就会以加密形式发送。如果您未使用 TLS,那么无论怎样都注定会遭遇严重问题。

如果您指的是“哈希”而非“加密”,那么答案是否定的,这不是受支持的配置。因为 Discourse 内部使用的哈希机制不属于公开接口契约的一部分,并且随时可能发生变化。

是的,确实如此。但如果有人能够访问您的笔记本电脑,他们只需安装一个键盘记录器,即可在密码经过任何哈希处理之前就将其捕获。Discourse(以及每一个 Web 应用程序)的安全威胁模型都包含一条规定:终端设备不得被攻陷。