我遇到 Hangfire 是为了使用 ASP.NET core MVC 构建后台作业,我已经向我的经理提出了这个想法,他关心的是安全性,其中一些问题如下。
- Hangfire Server 是否有权访问将在应用程序中实现的敏感数据?
- Hangfire 服务器如何触发代码中实现的作业?
- Hangfire 服务器中是否保存了任何敏感数据?
如果您有任何有关 Hangfire 安全性的建议或信息,我将不胜感激。
最佳答案
Does Hangfire Server have access to sensitive data that will be implemented within the application?
它不会比应用程序中加载的任何其他 nuget 包拥有更多的访问权限。
How does the Hangfire Server trigger the jobs implemented within the code?
作业正在后台运行,并定期轮询 Hangfire 数据库以查找要执行的新作业。如果发现新的作业,则反序列化其存储在数据库中的调用数据,并使用反序列化的参数通过反射调用结果方法。
Is there any sensitive data saved in the Hangfire Server ?
这取决于你。每个作业参数都在 Hangfire 数据库中序列化。如果这是一个问题(您不控制或共享hangfire数据库),您可以只传递标识符,并在作业处理过程中检索您自己的数据库中的相应值。
例如,如果您调用
BackgroundJob.Enqueue(() => HandleSensitiveData(new SensitiveData{Id="123", Value="VerySensitiveData"}));
VerySensitiveData
将与整个序列化的 SensitiveData
对象一起存储在hangfire数据库中
但是,如果 Id
123 的 SensitiveData
在您的数据库中,并且您调用
BackgroundJob.Enqueue(() => HandleSensitiveDataFromId("123"));
Hangfire DB 中仅保存了 123,您只需在执行 HandleSensitiveDataFromId
时检索 ID 为 123 的对象即可。
VerySensitiveData
永远不会存储在 Hangfire DB 中
关于sql-server - Hangfire Server 是否有权访问应用程序内的敏感数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70339946/