私はBreezeJSを使用しており、データの保存方法に関する質問があります。ここに私のコードは、ユーザーのために、それはやや不可能、私が最初にaccess_tokenはuser_idのから抽出したデータを取得し、where句でこれを含めるためにすべての私のクエリを制限する発信者の能力へのアクセスを制限するにはBreezeJS SaveChanges()セキュリティ上の問題
[Authorize]
/*
* I want to point out the security hole here. Any Authorized user is able to pass to this method
* a saveBundle which will be saved to the DB. This saveBundle can contain anything, for any user,
* or any table.
*
* This cannot be stopped at the client level as this method can be called from Postman, curl, or whatever.
*
* The only way I can see to subvert this attack would be to examine the saveBundle and verify
* no data is being impacted that is not owned or related directly to the calling user.
*
* Brute force could be applied here because SaveResult contains Errors and impacted Entities.
*
*/
[HttpPost]
public SaveResult SaveChanges(JObject saveBundle)
{
return _efContext.SaveChanges(saveBundle);
}
コメント別のユーザーデータを取得します。
しかし、有効なaccess_tokenを持っている悪意のあるユーザーが、インクリメンタルなオブジェクトIDを持つブルートフォースループでSaveChanges()を呼び出すのを止めることはありません。
私はこれをオフにしていますか?たぶん私は何かが欠けているでしょう。
ありがとうございました。クライアントがSaveChanges
メソッドに渡す
マイク
breezeについて詳しくはありませんが、適切なアクセス制御を実装しているように思えます。オブジェクトIDの生成には暗号のランダム性を使用することをお勧めしますが、実際には適切なアクセス制御を実装することには二次的です。 SaveChanges()に関しては、ユーザーが行うことができる保存操作の数を制限することができます。そうしなければ、DBを迷惑メールで埋めることができます。 – TheGreatContini