Files
oracle-deep-data-security-lab/scenarios/01-ai-prompt-injection/sql/03_data_grants.sql
Rodrigo Pace 8314351c98
Some checks failed
Repo Quality / structure (push) Has been cancelled
Fix local end user session grants and schema resolution
2026-05-13 14:49:12 -03:00

24 lines
635 B
SQL

WHENEVER SQLERROR EXIT SQL.SQLCODE
CREATE OR REPLACE DATA GRANT ai_sales_rep_customers
AS SELECT (customer_id, customer_name, region, account_owner, risk_rating)
ON dds_ai_customers
WHERE account_owner = ORA_END_USER_CONTEXT.username
TO sales_rep_role;
CREATE OR REPLACE DATA GRANT ai_regional_manager_customers
AS SELECT (ALL COLUMNS EXCEPT tax_id)
ON dds_ai_customers
WHERE region = 'LATAM'
TO regional_manager_role;
CREATE OR REPLACE DATA GRANT ai_hr_global_customers
AS SELECT
ON dds_ai_customers
TO hr_global_role;
BEGIN
EXECUTE IMMEDIATE 'SET USE DATA GRANTS ONLY ON dds_ai_customers ENABLED';
END;
/