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