Appendix B
Updating Item Protection
Item protection can be critical to the security boundary of an APEX application. The provided wizard within the application builder that applies item protection is not versatile enough for continued use throughout development.
If you use a consistent naming strategy when creating application or page items, it is possible to update and reapply item protection using a custom PL/SQL procedure to modify the APEX metadata tables.
The following example procedure applies session state protection to all application-level items, at the restricted level, and then sets items back to unrestricted that are named with an UNSAFE suffix. Similarly for page items, protection is applied across all items, but then is relaxed for items whose names begin with J, (rather than the usual P), because these are intended for use in JavaScript/Ajax so protection is not required. Finally, all hidden items have the “value protected” setting enabled, except such items that are marked for use in JavaScript.
create or replace procedure RECX_ITEM_PROTECTION_UPDATE ( l_appid IN number ) is begin -- Set application items to Restricted: update apex_040200.wwv_flow_items set protection_level = 'I' where flow_id = l_appid; -- Set UNSAFE application items to Unrestricted: update apex_040200.wwv_flow_items set protection_level = 'N' where flow_id = l_appid and name like '%_UNSAFE'; -- Set page items to Checksum Required - Session Level: update apex_040200.wwv_flow_step_items set protection_level ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access