diff options
| author | Robert Haas | 2013-04-12 12:55:56 +0000 |
|---|---|---|
| committer | Robert Haas | 2013-04-12 12:58:01 +0000 |
| commit | f8a54e936bdf4c31b395a2ab7d7bc98eefa6dbad (patch) | |
| tree | 957024396b9375191802c4b9eb5a2ed8e80809fb /contrib/sepgsql/sql | |
| parent | d017bf41a32d08885f00a274603ed2e50816fe7f (diff) | |
sepgsql: Enforce db_procedure:{execute} permission.
To do this, we add an additional object access hook type,
OAT_FUNCTION_EXECUTE.
KaiGai Kohei
Diffstat (limited to 'contrib/sepgsql/sql')
| -rw-r--r-- | contrib/sepgsql/sql/label.sql | 2 | ||||
| -rw-r--r-- | contrib/sepgsql/sql/misc.sql | 25 |
2 files changed, 27 insertions, 0 deletions
diff --git a/contrib/sepgsql/sql/label.sql b/contrib/sepgsql/sql/label.sql index 6201cd77214..7a05c248ebb 100644 --- a/contrib/sepgsql/sql/label.sql +++ b/contrib/sepgsql/sql/label.sql @@ -97,6 +97,8 @@ SECURITY LABEL ON COLUMN t2.b -- Tests for Trusted Procedures -- -- @SECURITY-CONTEXT=unconfined_u:unconfined_r:sepgsql_regtest_user_t:s0 +SET sepgsql.debug_audit = true; +SET client_min_messages = log; SELECT f1(); -- normal procedure SELECT f2(); -- trusted procedure SELECT f3(); -- trusted procedure that raises an error diff --git a/contrib/sepgsql/sql/misc.sql b/contrib/sepgsql/sql/misc.sql index a46d8a6b5c8..c2777117818 100644 --- a/contrib/sepgsql/sql/misc.sql +++ b/contrib/sepgsql/sql/misc.sql @@ -3,3 +3,28 @@ -- LOAD '$libdir/sepgsql'; -- failed + +-- +-- Permissions to execute functions +-- +CREATE TABLE t1 (x int, y text); +INSERT INTO t1 (SELECT x, md5(x::text) FROM generate_series(1,100) x); + +SET sepgsql.debug_audit = on; +SET client_min_messages = log; + +-- regular function and operators +SELECT * FROM t1 WHERE x > 50 AND y like '%64%'; + +-- aggregate function +SELECT MIN(x), AVG(x) FROM t1; + +-- window function +SELECT row_number() OVER (order by x), * FROM t1 WHERE y like '%86%'; + +RESET sepgsql.debug_audit; +RESET client_min_messages; +-- +-- Cleanup +-- +DROP TABLE IF EXISTS t1 CASCADE; |
