|
| 1 | +-- SET commands fire both the ProcessUtility_hook and the |
| 2 | +-- object_access_hook_str. Since the auditing GUC starts out false, we miss the |
| 3 | +-- initial "attempting" audit message from the ProcessUtility_hook, but we |
| 4 | +-- should thereafter see the audit messages |
| 5 | +SET test_oat_hooks.audit = true; |
| 6 | +NOTICE: in object_access_hook_str: superuser attempting alter (set) [test_oat_hooks.audit] |
| 7 | +NOTICE: in object_access_hook_str: superuser finished alter (set) [test_oat_hooks.audit] |
| 8 | +NOTICE: in process utility: superuser finished set |
| 9 | +-- Create objects for use in the test |
| 10 | +CREATE USER regress_test_user; |
| 11 | +NOTICE: in process utility: superuser attempting CreateRoleStmt |
| 12 | +NOTICE: in object access: superuser attempting create (subId=0) [explicit] |
| 13 | +NOTICE: in object access: superuser finished create (subId=0) [explicit] |
| 14 | +NOTICE: in process utility: superuser finished CreateRoleStmt |
| 15 | +CREATE TABLE regress_test_table (t text); |
| 16 | +NOTICE: in process utility: superuser attempting CreateStmt |
| 17 | +NOTICE: in object access: superuser attempting namespace search (subId=0) [no report on violation, allowed] |
| 18 | +LINE 1: CREATE TABLE regress_test_table (t text); |
| 19 | + ^ |
| 20 | +NOTICE: in object access: superuser finished namespace search (subId=0) [no report on violation, allowed] |
| 21 | +LINE 1: CREATE TABLE regress_test_table (t text); |
| 22 | + ^ |
| 23 | +NOTICE: in object access: superuser attempting create (subId=0) [explicit] |
| 24 | +NOTICE: in object access: superuser finished create (subId=0) [explicit] |
| 25 | +NOTICE: in object access: superuser attempting create (subId=0) [explicit] |
| 26 | +NOTICE: in object access: superuser finished create (subId=0) [explicit] |
| 27 | +NOTICE: in object access: superuser attempting create (subId=0) [explicit] |
| 28 | +NOTICE: in object access: superuser finished create (subId=0) [explicit] |
| 29 | +NOTICE: in object access: superuser attempting create (subId=0) [internal] |
| 30 | +NOTICE: in object access: superuser finished create (subId=0) [internal] |
| 31 | +NOTICE: in object access: superuser attempting create (subId=0) [internal] |
| 32 | +NOTICE: in object access: superuser finished create (subId=0) [internal] |
| 33 | +NOTICE: in process utility: superuser finished CreateStmt |
| 34 | +GRANT SELECT ON Table regress_test_table TO public; |
| 35 | +NOTICE: in process utility: superuser attempting GrantStmt |
| 36 | +NOTICE: in process utility: superuser finished GrantStmt |
| 37 | +CREATE FUNCTION regress_test_func (t text) RETURNS text AS $$ |
| 38 | + SELECT $1; |
| 39 | +$$ LANGUAGE sql; |
| 40 | +NOTICE: in process utility: superuser attempting CreateFunctionStmt |
| 41 | +NOTICE: in object access: superuser attempting create (subId=0) [explicit] |
| 42 | +NOTICE: in object access: superuser finished create (subId=0) [explicit] |
| 43 | +NOTICE: in process utility: superuser finished CreateFunctionStmt |
| 44 | +GRANT EXECUTE ON FUNCTION regress_test_func (text) TO public; |
| 45 | +NOTICE: in process utility: superuser attempting GrantStmt |
| 46 | +NOTICE: in process utility: superuser finished GrantStmt |
| 47 | +-- Do a few things as superuser |
| 48 | +SELECT * FROM regress_test_table; |
| 49 | +NOTICE: in executor check perms: superuser attempting execute |
| 50 | +NOTICE: in executor check perms: superuser finished execute |
| 51 | + t |
| 52 | +--- |
| 53 | +(0 rows) |
| 54 | + |
| 55 | +SELECT regress_test_func('arg'); |
| 56 | +NOTICE: in executor check perms: superuser attempting execute |
| 57 | +NOTICE: in executor check perms: superuser finished execute |
| 58 | + regress_test_func |
| 59 | +------------------- |
| 60 | + arg |
| 61 | +(1 row) |
| 62 | + |
| 63 | +SET work_mem = 8192; |
| 64 | +NOTICE: in process utility: superuser attempting set |
| 65 | +NOTICE: in object_access_hook_str: superuser attempting alter (set) [work_mem] |
| 66 | +NOTICE: in object_access_hook_str: superuser finished alter (set) [work_mem] |
| 67 | +NOTICE: in process utility: superuser finished set |
| 68 | +RESET work_mem; |
| 69 | +NOTICE: in process utility: superuser attempting set |
| 70 | +NOTICE: in object_access_hook_str: superuser attempting alter (set) [work_mem] |
| 71 | +NOTICE: in object_access_hook_str: superuser finished alter (set) [work_mem] |
| 72 | +NOTICE: in process utility: superuser finished set |
| 73 | +ALTER SYSTEM SET work_mem = 8192; |
| 74 | +NOTICE: in process utility: superuser attempting alter system |
| 75 | +NOTICE: in object_access_hook_str: superuser attempting alter (alter system set) [work_mem] |
| 76 | +NOTICE: in object_access_hook_str: superuser finished alter (alter system set) [work_mem] |
| 77 | +NOTICE: in process utility: superuser finished alter system |
| 78 | +ALTER SYSTEM RESET work_mem; |
| 79 | +NOTICE: in process utility: superuser attempting alter system |
| 80 | +NOTICE: in object_access_hook_str: superuser attempting alter (alter system set) [work_mem] |
| 81 | +NOTICE: in object_access_hook_str: superuser finished alter (alter system set) [work_mem] |
| 82 | +NOTICE: in process utility: superuser finished alter system |
| 83 | +-- Do those same things as non-superuser |
| 84 | +SET SESSION AUTHORIZATION regress_test_user; |
| 85 | +NOTICE: in process utility: superuser attempting set |
| 86 | +NOTICE: in object_access_hook_str: non-superuser attempting alter (set) [session_authorization] |
| 87 | +NOTICE: in object_access_hook_str: non-superuser finished alter (set) [session_authorization] |
| 88 | +NOTICE: in process utility: non-superuser finished set |
| 89 | +SELECT * FROM regress_test_table; |
| 90 | +NOTICE: in object access: non-superuser attempting namespace search (subId=0) [no report on violation, allowed] |
| 91 | +LINE 1: SELECT * FROM regress_test_table; |
| 92 | + ^ |
| 93 | +NOTICE: in object access: non-superuser finished namespace search (subId=0) [no report on violation, allowed] |
| 94 | +LINE 1: SELECT * FROM regress_test_table; |
| 95 | + ^ |
| 96 | +NOTICE: in executor check perms: non-superuser attempting execute |
| 97 | +NOTICE: in executor check perms: non-superuser finished execute |
| 98 | + t |
| 99 | +--- |
| 100 | +(0 rows) |
| 101 | + |
| 102 | +SELECT regress_test_func('arg'); |
| 103 | +NOTICE: in executor check perms: non-superuser attempting execute |
| 104 | +NOTICE: in executor check perms: non-superuser finished execute |
| 105 | + regress_test_func |
| 106 | +------------------- |
| 107 | + arg |
| 108 | +(1 row) |
| 109 | + |
| 110 | +SET work_mem = 8192; |
| 111 | +NOTICE: in process utility: non-superuser attempting set |
| 112 | +NOTICE: in object_access_hook_str: non-superuser attempting alter (set) [work_mem] |
| 113 | +NOTICE: in object_access_hook_str: non-superuser finished alter (set) [work_mem] |
| 114 | +NOTICE: in process utility: non-superuser finished set |
| 115 | +RESET work_mem; |
| 116 | +NOTICE: in process utility: non-superuser attempting set |
| 117 | +NOTICE: in object_access_hook_str: non-superuser attempting alter (set) [work_mem] |
| 118 | +NOTICE: in object_access_hook_str: non-superuser finished alter (set) [work_mem] |
| 119 | +NOTICE: in process utility: non-superuser finished set |
| 120 | +ALTER SYSTEM SET work_mem = 8192; |
| 121 | +NOTICE: in process utility: non-superuser attempting alter system |
| 122 | +ERROR: must be superuser to execute ALTER SYSTEM command |
| 123 | +ALTER SYSTEM RESET work_mem; |
| 124 | +NOTICE: in process utility: non-superuser attempting alter system |
| 125 | +ERROR: must be superuser to execute ALTER SYSTEM command |
| 126 | +RESET SESSION AUTHORIZATION; |
| 127 | +NOTICE: in process utility: non-superuser attempting set |
| 128 | +NOTICE: in object_access_hook_str: superuser attempting alter (set) [session_authorization] |
| 129 | +NOTICE: in object_access_hook_str: superuser finished alter (set) [session_authorization] |
| 130 | +NOTICE: in process utility: superuser finished set |
| 131 | +-- Turn off non-superuser permissions |
| 132 | +SET test_oat_hooks.deny_set_variable = true; |
| 133 | +NOTICE: in process utility: superuser attempting set |
| 134 | +NOTICE: in object_access_hook_str: superuser attempting alter (set) [test_oat_hooks.deny_set_variable] |
| 135 | +NOTICE: in object_access_hook_str: superuser finished alter (set) [test_oat_hooks.deny_set_variable] |
| 136 | +NOTICE: in process utility: superuser finished set |
| 137 | +SET test_oat_hooks.deny_alter_system = true; |
| 138 | +NOTICE: in process utility: superuser attempting set |
| 139 | +NOTICE: in object_access_hook_str: superuser attempting alter (set) [test_oat_hooks.deny_alter_system] |
| 140 | +NOTICE: in object_access_hook_str: superuser finished alter (set) [test_oat_hooks.deny_alter_system] |
| 141 | +NOTICE: in process utility: superuser finished set |
| 142 | +SET test_oat_hooks.deny_object_access = true; |
| 143 | +NOTICE: in process utility: superuser attempting set |
| 144 | +NOTICE: in object_access_hook_str: superuser attempting alter (set) [test_oat_hooks.deny_object_access] |
| 145 | +NOTICE: in object_access_hook_str: superuser finished alter (set) [test_oat_hooks.deny_object_access] |
| 146 | +NOTICE: in process utility: superuser finished set |
| 147 | +SET test_oat_hooks.deny_exec_perms = true; |
| 148 | +NOTICE: in process utility: superuser attempting set |
| 149 | +NOTICE: in object_access_hook_str: superuser attempting alter (set) [test_oat_hooks.deny_exec_perms] |
| 150 | +NOTICE: in object_access_hook_str: superuser finished alter (set) [test_oat_hooks.deny_exec_perms] |
| 151 | +NOTICE: in process utility: superuser finished set |
| 152 | +SET test_oat_hooks.deny_utility_commands = true; |
| 153 | +NOTICE: in process utility: superuser attempting set |
| 154 | +NOTICE: in object_access_hook_str: superuser attempting alter (set) [test_oat_hooks.deny_utility_commands] |
| 155 | +NOTICE: in object_access_hook_str: superuser finished alter (set) [test_oat_hooks.deny_utility_commands] |
| 156 | +NOTICE: in process utility: superuser finished set |
| 157 | +-- Try again as non-superuser with permisisons denied |
| 158 | +SET SESSION AUTHORIZATION regress_test_user; |
| 159 | +NOTICE: in process utility: superuser attempting set |
| 160 | +NOTICE: in object_access_hook_str: non-superuser attempting alter (set) [session_authorization] |
| 161 | +ERROR: permission denied: set session_authorization |
| 162 | +SELECT * FROM regress_test_table; |
| 163 | +NOTICE: in object access: superuser attempting namespace search (subId=0) [no report on violation, allowed] |
| 164 | +LINE 1: SELECT * FROM regress_test_table; |
| 165 | + ^ |
| 166 | +NOTICE: in object access: superuser finished namespace search (subId=0) [no report on violation, allowed] |
| 167 | +LINE 1: SELECT * FROM regress_test_table; |
| 168 | + ^ |
| 169 | +NOTICE: in executor check perms: superuser attempting execute |
| 170 | +NOTICE: in executor check perms: superuser finished execute |
| 171 | + t |
| 172 | +--- |
| 173 | +(0 rows) |
| 174 | + |
| 175 | +SELECT regress_test_func('arg'); |
| 176 | +NOTICE: in executor check perms: superuser attempting execute |
| 177 | +NOTICE: in executor check perms: superuser finished execute |
| 178 | + regress_test_func |
| 179 | +------------------- |
| 180 | + arg |
| 181 | +(1 row) |
| 182 | + |
| 183 | +SET work_mem = 8192; |
| 184 | +NOTICE: in process utility: superuser attempting set |
| 185 | +NOTICE: in object_access_hook_str: superuser attempting alter (set) [work_mem] |
| 186 | +NOTICE: in object_access_hook_str: superuser finished alter (set) [work_mem] |
| 187 | +NOTICE: in process utility: superuser finished set |
| 188 | +RESET work_mem; |
| 189 | +NOTICE: in process utility: superuser attempting set |
| 190 | +NOTICE: in object_access_hook_str: superuser attempting alter (set) [work_mem] |
| 191 | +NOTICE: in object_access_hook_str: superuser finished alter (set) [work_mem] |
| 192 | +NOTICE: in process utility: superuser finished set |
| 193 | +ALTER SYSTEM SET work_mem = 8192; |
| 194 | +NOTICE: in process utility: superuser attempting alter system |
| 195 | +NOTICE: in object_access_hook_str: superuser attempting alter (alter system set) [work_mem] |
| 196 | +NOTICE: in object_access_hook_str: superuser finished alter (alter system set) [work_mem] |
| 197 | +NOTICE: in process utility: superuser finished alter system |
| 198 | +ALTER SYSTEM RESET work_mem; |
| 199 | +NOTICE: in process utility: superuser attempting alter system |
| 200 | +NOTICE: in object_access_hook_str: superuser attempting alter (alter system set) [work_mem] |
| 201 | +NOTICE: in object_access_hook_str: superuser finished alter (alter system set) [work_mem] |
| 202 | +NOTICE: in process utility: superuser finished alter system |
| 203 | +RESET SESSION AUTHORIZATION; |
| 204 | +NOTICE: in process utility: superuser attempting set |
| 205 | +NOTICE: in object_access_hook_str: superuser attempting alter (set) [session_authorization] |
| 206 | +NOTICE: in object_access_hook_str: superuser finished alter (set) [session_authorization] |
| 207 | +NOTICE: in process utility: superuser finished set |
| 208 | +SET test_oat_hooks.audit = false; |
| 209 | +NOTICE: in process utility: superuser attempting set |
0 commit comments