【发布时间】:2011-05-08 05:33:40
【问题描述】:
如果您查看this MSDN 文档,则有一个包含以下代码的示例:
// Define a change interceptor for the Products entity set.
[ChangeInterceptor("Products")]
public void OnChangeProducts(Product product, UpdateOperations operations)
{
if (operations == UpdateOperations.Add ||
operations == UpdateOperations.Change)
{
// Reject changes to discontinued products.
if (product.Discontinued) //<-- IS THIS BASED ON UNVERIFIED CLIENT DATA???
{
throw new DataServiceException(400,
"A discontinued product cannot be modified");
}
}
else if (operations == UpdateOperations.Delete)
{
// Block the delete and instead set the Discontinued flag.
throw new DataServiceException(400,
"Products cannot be deleted; instead set the Discontinued flag to 'true'");
}
}
查看所有大写字母的评论。我的问题是:“该行是否取决于客户提供的数据......如果是,我们可以做些什么来进行安全验证”?
【问题讨论】:
-
感谢您在文档中报告可能存在的问题!
标签: c# security entity-framework wcf-security odata