Appearance
question:A key defense mechanism is for the application to handle unexpected errors gracefully, and either recover from them or present a suitable error message to the user. In a production context, the application should never return any system-generated messages or other debug information in its responses. As you will see throughout this book, overly verbose error messages can greatly assist malicious users in furthering their attacks against the application. In some situations, an attacker can leverage defective error handling to retrieve sensitive information within the error messages themselves, providing a valuable channel for stealing data from the application. Figure 2-6 shows an example of an unhandled error resulting in a verbose error message.
answer:آلية الدفاع الرئيسية هي أن يتعامل التطبيق مع الأخطاء غير المتوقعة بشكل لائق، وإما يستعيد منها أو يعرض رسالة خطأ مناسبة للمستخدم. في سياق الإنتاج، يجب ألا يعيد التطبيق أي رسائل تم إنشاؤها من قِبَل النظام أو معلومات تصحيح الأخطاء الأخرى في استجاباته. كما سترى في جميع أنحاء هذا الكتاب، يمكن أن تساعد رسائل الأخطاء المفصلة للغاية المستخدمين الخبيثين في تعميق هجماتهم على التطبيق. في بعض الحالات، يمكن للمهاجم الاستفادة من معالجة الأخطاء المعيبة لاسترجاع المعلومات الحساسة من داخل رسائل الأخطاء نفسها، وهو ما يوفر قناة قيمة لسرقة البيانات من التطبيق. توضح الشكل 2-6 مثالًا لحدوث خطأ غير معالج يؤدي إلى ظهور رسالة خطأ مفصلة بشكل مبالغ فيه.
question:Most web development languages provide good error-handling support through try-catch blocks and checked exceptions. Application code should make extensive use of these constructs to catch specifi c and general errors and handle them appropriately. Furthermore, most application servers can be confi gured to deal with unhandled application errors in customized ways, such as by presenting an uninformative error message. See Chapter 15 for more details on these measures.
answer:معظم لغات تطوير الويب توفر دعمًا جيدًا لمعالجة الأخطاء من خلال كتل try-catch والاستثناءات المُراجعة. ينبغي على كود التطبيق أن يستخدم هذه البنى التحكمية بشكل واسع للتقاط الأخطاء المحددة والعامة ومعالجتها بالشكل الصحيح. علاوة على ذلك، يمكن تكوين معظم خوادم التطبيق للتعامل مع الأخطاء التطبيق غير المعالجة بطرق مخصصة، مثل عرض رسالة خطأ بلا معلومات. يمكنك الإطلاع على الفصل 15 لمزيد من التفاصيل حول هذه التدابير.
question:Effective error handling is often integrated with the application’s logging mechanisms, which record as much debug information as possible about unanticipated errors. Unexpected errors often point to defects within the application’s defenses that can be addressed at the source if the application’s owner has the required information.
answer:يتم غالبًا دمج إجراءات التعامل مع الأخطاء الفعالة مع آليات تسجيل الأحداث في التطبيق، التي تقوم بتسجيل أكبر قدر ممكن من المعلومات التصحيحية حول الأخطاء غير المتوقعة. غالبًا ما تشير الأخطاء غير المتوقعة إلى عيوب داخل الآليات الدفاعية في التطبيق يمكن معالجتها من المصدر إذا كان لدى مالك التطبيق المعلومات المطلوبة.
question:Audit logs are valuable primarily when investigating intrusion attempts against an application. Following such an incident, effective audit logs should enable the application’s owners to understand exactly what has taken place, which vulnerabilities (if any) were exploited, whether the attacker gained unauthorized access to data or performed any unauthorized actions, and, as far as possible, provide evidence of the intruder’s identity.
answer:سجلات التدقيق تكون قيمة بشكل أساسي عند التحقيق في محاولات التسلل ضد التطبيق. بعد وقوع مثل هذا الحدث، يجب أن تمكن سجلات التدقيق الفعالة مالكي التطبيق من فهم بالضبط ما حدث، والثغرات المستغلة (إن وجدت)، سواء كان المهاجم قد حصل على وصول غير مصرح به إلى البيانات أو قام بأي أعمال غير مصرح بها، وأن توفر أدلة على هوية المتسلل قدر الإمكان.