المكتبة التقنية ←

Session State ليست حدود أمان للـAPI

English version

Session state is useful application context. It is not, by itself, a security layer for every REST API an application calls.

Correction to my original post: putting ADMIN in P0USERROLE and attaching an APEX authorization scheme does not automatically protect an independently reachable ORDS endpoint.

Protect each entry point

For an APEX page or callback, enforce authorization on the server and check access to the requested rows. Derive roles from a trusted source. A role value that the browser can submit must not become the source of authority.

For an ORDS API, configure the API's own authentication and authorization—for example, the applicable privileges and roles—and enforce business-level row access in its implementation. A caller who bypasses the APEX page must face the same access boundary.

Treat tenant identity as trusted context

Multi-tenant isolation requires a validated tenant identity and consistent filtering or database policies on every relevant path. A salary threshold in one report query is not a general tenant-isolation design.

Test as an authorized user, a user with the wrong role, a user from another tenant, and an unauthenticated caller. Include direct requests, not only clicks through the UI.

APEX authorization schemes are valuable. Their protection applies where they are enforced; it does not automatically extend to unrelated services.

Reference: ORDS Developer's Guide.

النسخة العربية

Session State مفيدة كسياق للتطبيق، لكنها مش طبقة حماية تلقائية لكل REST API التطبيق بيتعامل معها.

تصحيح للبوست الأصلي: تخزين ADMIN في P0USERROLE وربطه بـAuthorization Scheme لا يحمي ORDS Endpoint مستقلة تلقائيًا.

احمِ كل مدخل على حدة

في صفحة APEX أو Callback، طبّق الصلاحيات على السيرفر وراجع السجلات المطلوبة. استخرج الأدوار من مصدر موثوق؛ قيمة Role يقدر المتصفح يرسلها لا يصح تكون مصدر القرار الأمني.

في ORDS API، جهّز المصادقة والصلاحيات الخاصة بالخدمة، مثل Privileges وRoles المناسبة، وطبّق صلاحيات السجلات داخل التنفيذ. اللي يستدعي الخدمة مباشرة لازم يمر بنفس حدود الوصول.

هوية المستأجر لازم تكون موثوقة

عزل العملاء يحتاج Tenant Identity متحققًا منها، وفلاتر أو سياسات قاعدة بيانات متسقة في كل المسارات. شرط على الراتب داخل تقرير واحد ليس تصميمًا عامًا لعزل العملاء.

اختبر مستخدمًا مصرحًا له، ومستخدمًا بدور مختلف، ومستخدمًا من عميل آخر، وطلبًا بدون تسجيل دخول. اختبر الاستدعاءات المباشرة أيضًا، مش مجرد الأزرار.

Authorization Schemes قوية في الأماكن اللي بتُطبق فيها، ولا تمتد تلقائيًا إلى خدمات مستقلة.

المرجع: دليل ORDS.