show create procedure gives NULL in the Field "Create Procedure" if the permission is missing.
It works, if the caller is the owner of the proedure or with the SELECT right of mysql.proc
This works not, if the owner is a role.
To reproduce:
create database rtest;
|
create role db_owner_rtest;
|
grant all privileges on rtest.* to db_owner_rtest;
|
|
|
create user user1;
|
grant db_owner_rtest to user1;
|
|
set default role db_owner_rtest for user1;
|
|
Login as user 1:
use rtest;
|
|
set role db_owner_rtest;
|
|
DELIMITER //
|
DROP PROCEDURE IF EXISTS user1_proc;
|
CREATE DEFINER=current_role() PROCEDURE user1_proc()
|
SQL SECURITY INVOKER
|
BEGIN
|
SELECT NOW(), VERSION();
|
END;//
|
DELIMITER ;
|
Role db_owner_rtest is the owner and user1 has this role,but
show create procedure db_owner_rtest;
gives this output.
MariaDB [rtest]> show create procedure user1_proc;
|
+------------+-------------------------------------------------------------------------------------------+------------------+----------------------+----------------------+--------------------+
|
| Procedure | sql_mode | Create Procedure | character_set_client | collation_connection | Database Collation |
|
+------------+-------------------------------------------------------------------------------------------+------------------+----------------------+----------------------+--------------------+
|
| user1_proc | STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | NULL | latin1 | latin1_swedish_ci | latin1_swedish_ci |
|
+------------+-------------------------------------------------------------------------------------------+------------------+----------------------+----------------------+--------------------+
|
1 row in set (0.00 sec)
|
|
|
{"report":{"fcp":1229.5,"ttfb":354.5,"pageVisibility":"visible","entityId":62904,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"c7fbf541-dd83-4db3-beb4-1c675f37424a","navigationType":0,"readyForUser":1317.5,"redirectCount":0,"resourceLoadedEnd":2130.6000003814697,"resourceLoadedStart":360,"resourceTiming":[{"duration":238.69999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":360,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":360,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":598.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":239.39999961853027,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":360.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":360.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":599.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":331.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":360.6000003814697,"connectEnd":360.6000003814697,"connectStart":360.6000003814697,"domainLookupEnd":360.6000003814697,"domainLookupStart":360.6000003814697,"fetchStart":360.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":360.6000003814697,"responseEnd":691.8000001907349,"responseStart":691.8000001907349,"secureConnectionStart":360.6000003814697},{"duration":411.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":360.69999980926514,"connectEnd":360.69999980926514,"connectStart":360.69999980926514,"domainLookupEnd":360.69999980926514,"domainLookupStart":360.69999980926514,"fetchStart":360.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":360.69999980926514,"responseEnd":772.5,"responseStart":772.5,"secureConnectionStart":360.69999980926514},{"duration":415.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":360.8999996185303,"connectEnd":360.8999996185303,"connectStart":360.8999996185303,"domainLookupEnd":360.8999996185303,"domainLookupStart":360.8999996185303,"fetchStart":360.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":360.8999996185303,"responseEnd":776.3999996185303,"responseStart":776.3000001907349,"secureConnectionStart":360.8999996185303},{"duration":416.3999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":361,"connectEnd":361,"connectStart":361,"domainLookupEnd":361,"domainLookupStart":361,"fetchStart":361,"redirectEnd":0,"redirectStart":0,"requestStart":361,"responseEnd":777.3999996185303,"responseStart":777.3999996185303,"secureConnectionStart":361},{"duration":416.9000005722046,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":361.19999980926514,"connectEnd":361.19999980926514,"connectStart":361.19999980926514,"domainLookupEnd":361.19999980926514,"domainLookupStart":361.19999980926514,"fetchStart":361.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":361.19999980926514,"responseEnd":778.1000003814697,"responseStart":778.1000003814697,"secureConnectionStart":361.19999980926514},{"duration":484.4000005722046,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":361.3999996185303,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":361.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":845.8000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":417,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":361.6000003814697,"connectEnd":361.6000003814697,"connectStart":361.6000003814697,"domainLookupEnd":361.6000003814697,"domainLookupStart":361.6000003814697,"fetchStart":361.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":361.6000003814697,"responseEnd":778.6000003814697,"responseStart":778.6000003814697,"secureConnectionStart":361.6000003814697},{"duration":484.30000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":361.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":361.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":846,"responseStart":0,"secureConnectionStart":0},{"duration":417.4000005722046,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":361.8999996185303,"connectEnd":361.8999996185303,"connectStart":361.8999996185303,"domainLookupEnd":361.8999996185303,"domainLookupStart":361.8999996185303,"fetchStart":361.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":361.8999996185303,"responseEnd":779.3000001907349,"responseStart":779.3000001907349,"secureConnectionStart":361.8999996185303},{"duration":1464.3000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":375,"connectEnd":375,"connectStart":375,"domainLookupEnd":375,"domainLookupStart":375,"fetchStart":375,"redirectEnd":0,"redirectStart":0,"requestStart":375,"responseEnd":1839.3000001907349,"responseStart":1839.3000001907349,"secureConnectionStart":375},{"duration":1755.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":375,"connectEnd":375,"connectStart":375,"domainLookupEnd":375,"domainLookupStart":375,"fetchStart":375,"redirectEnd":0,"redirectStart":0,"requestStart":375,"responseEnd":2130.6000003814697,"responseStart":2130.6000003814697,"secureConnectionStart":375},{"duration":997,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":871.6000003814697,"connectEnd":871.6000003814697,"connectStart":871.6000003814697,"domainLookupEnd":871.6000003814697,"domainLookupStart":871.6000003814697,"fetchStart":871.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":871.6000003814697,"responseEnd":1868.6000003814697,"responseStart":1868.6000003814697,"secureConnectionStart":871.6000003814697},{"duration":1002.6000003814697,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1201.8999996185303,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1201.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2204.5,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":187,"responseStart":355,"responseEnd":368,"domLoading":359,"domInteractive":2150,"domContentLoadedEventStart":2150,"domContentLoadedEventEnd":2201,"domComplete":2980,"loadEventStart":2980,"loadEventEnd":2981,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":2133},{"name":"bigPipe.sidebar-id.end","time":2133.8999996185303},{"name":"bigPipe.activity-panel-pipe-id.start","time":2134.1000003814697},{"name":"bigPipe.activity-panel-pipe-id.end","time":2135.199999809265},{"name":"activityTabFullyLoaded","time":2214.199999809265}],"measures":[],"correlationId":"bcca6792557171","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":102,"dbReadsTimeInMs":13,"dbConnsTimeInMs":23,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Hi Sergei!
Can you review the patch for this bug?
http://lists.askmonty.org/pipermail/commits/2017-October/011541.html
If we don't want to support allowing indirectly granted roles to see procedure code, we can skip the additions to sql_acl.cc entirely and just leave the simple strcmp with current_role.