File: gh-4104-view-access-check.test.lua

package info (click to toggle)
tarantool 2.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 85,364 kB
  • sloc: ansic: 513,760; cpp: 69,489; sh: 25,650; python: 19,190; perl: 14,973; makefile: 4,173; yacc: 1,329; sql: 1,074; pascal: 620; ruby: 190; awk: 18; lisp: 7
file content (18 lines) | stat: -rw-r--r-- 914 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
box.execute("CREATE TABLE supersecret(id INT PRIMARY KEY, data TEXT);")
box.execute("CREATE TABLE supersecret2(id INT PRIMARY KEY, data TEXT);")
box.execute("INSERT INTO supersecret VALUES(1, 'very very big secret');")
box.execute("INSERT INTO supersecret2 VALUES(1, 'very big secret 2');")
box.execute("CREATE VIEW supersecret_leak AS  SELECT * FROM supersecret, supersecret2;")
remote = require 'net.box'
cn = remote.connect(box.cfg.listen)

box.schema.user.grant('guest','read', 'space', 'SUPERSECRET_LEAK')
cn:execute('SELECT * FROM SUPERSECRET_LEAK')
box.schema.user.grant('guest','read', 'space', 'SUPERSECRET')
cn:execute('SELECT * FROM SUPERSECRET_LEAK')

box.schema.user.revoke('guest','read', 'space', 'SUPERSECRET')
box.schema.user.revoke('guest','read', 'space', 'SUPERSECRET_LEAK')
box.execute("DROP VIEW supersecret_leak")
box.execute("DROP TABLE supersecret")
box.execute("DROP TABLE supersecret2")