File: sensitive_variables.inc

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (75 lines) | stat: -rw-r--r-- 3,199 bytes parent folder | download
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
# ===== Usage ====
# --let PLUGIN_DIR=<plugin dir path>
# --source include/keyring_tests/sensitive_variables/sensitive_variables.inc

# Tests for SENSITIVE variables

--echo #
--echo # WL#13469: secure storage for sensitive system variables
--echo #

--echo # ----------------------------------------------------------------------
--echo # 1. Tests for persisted SENSITIVE variables

--connection default
INSTALL COMPONENT "file://component_test_sensitive_system_variables";
CREATE USER wl13469_no_privilege;
--connect(conn_no_priv, localhost, wl13469_no_privilege,,)

--connection default
SET PERSIST test_component.sensitive_string_1 = 'haha';
SET PERSIST_ONLY test_component.sensitive_ro_string_1 = 'haha';

--let $expected_entries = 2
--echo
--let $assert_text= PFS table persisted_variables should show SENSITIVE variables for users with SENSITIVE_VARIABLES_OBSERVER privilege
--let $assert_cond=[SELECT COUNT(*) AS entries FROM performance_schema.persisted_variables WHERE variable_name LIKE "test_component.sensitive%", entries, 1] = $expected_entries;
--source include/assert.inc

--connection conn_no_priv
--let $expected_entries = 0
--echo
--let $assert_text= PFS table persisted_variables should not show SENSITIVE variables for users without SENSITIVE_VARIABLES_OBSERVER privilege
--let $assert_cond=[SELECT COUNT(*) AS entries FROM performance_schema.persisted_variables WHERE variable_name LIKE "test_component.sensitive%", entries, 1] = $expected_entries;
--source include/assert.inc

--connection default
--disconnect conn_no_priv
DROP USER wl13469_no_privilege;

--echo # Stop the running server.
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 300
--source include/wait_until_disconnected.inc

--echo # Restart server with keyring component
let $restart_parameters= $PLUGIN_DIR;
--source include/start_mysqld_no_echo.inc

--connection default
SELECT a.variable_name, b.variable_value, a.variable_source FROM performance_schema.variables_info AS a, performance_schema.global_variables AS b WHERE a.variable_name = b.variable_name AND a.variable_name LIKE 'test_component.sensitive%';

SET PERSIST test_component.sensitive_string_2 = 'hoho';
SET PERSIST_ONLY test_component.sensitive_ro_string_2 = 'hoho';
SET PERSIST test_component.sensitive_string_3 = 'hoho';
SET PERSIST_ONLY test_component.sensitive_ro_string_3 = 'hoho';

--echo # Stop the running server.
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 300
--source include/wait_until_disconnected.inc

--echo # Restart server with keyring component
let $restart_parameters= $PLUGIN_DIR;
--source include/start_mysqld_no_echo.inc

--connection default
SELECT a.variable_name, b.variable_value, a.variable_source FROM performance_schema.variables_info AS a, performance_schema.global_variables AS b WHERE a.variable_name = b.variable_name AND a.variable_name LIKE 'test_component.sensitive%';

--connection default
RESET PERSIST;

UNINSTALL COMPONENT "file://component_test_sensitive_system_variables";
let $MYSQLD_DATADIR= `select @@datadir`;
--remove_file $MYSQLD_DATADIR/mysqld-auto.cnf
--echo # ----------------------------------------------------------------------