pt-show-grant doesn't support column-level grants

Bug #866075 reported by none.enon
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to https://jira.percona.com/projects/PT
Fix Released
Low
Daniel Nichter
1.0
Won't Fix
Undecided
Unassigned
2.0
Won't Fix
Undecided
Unassigned
2.1
Fix Released
Low
Daniel Nichter

Bug Description

[In:<strong class="program">pt-show-grants</strong>]

Good day,

show-grant outputs incorrect Sql format when access to the table is on selected fields only.

consider the ff. table
Code: [Select all] [Show/ hide]
CREATE TABLE IF NOT EXISTS `table3` (
  `SOrNum` mediumint(9) unsigned NOT NULL auto_increment,
  `SPNum` mediumint(9) unsigned NOT NULL,
  `DateCreated` timestamp NOT NULL default CURRENT_TIMESTAMP,
  `DateRelease` timestamp NOT NULL default '0000-00-00 00:00:00',
  `ActualReleasedDate` timestamp NULL default NULL,
  `PckPrice` decimal(10,2) NOT NULL default '0.00',
  `Status` varchar(20) NOT NULL,
  `PaymentStat` varchar(20) NOT NULL default 'Unpaid',
  `CusCode` int(9) unsigned NOT NULL,
  `SANumber` mediumint(9) unsigned NOT NULL default '0',
  `SpecialInstruction` varchar(500) default NULL,
  PRIMARY KEY (`SOrNum`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

if the user have only access to the following fields: DateCreated, PckPrice, PaymentStat, SANumber
the ouput of
Code: [Select all] [Show/ hide]
pt-show-grants --user=root --ask-pass --only=user

is the ff. which is invalid
GRANT DateCreated, PaymentStat, PckPrice), SELECT (SANumber ON `inventory`.`table3` TO 'user'@'%';

mysql-server-5.0.77-4.el5_6.6
percona-toolkit-1.0.1-1

Regards,

Related branches

Revision history for this message
Baron Schwartz (baron-xaprb) wrote :

Thank you for the bug report. We (unofficially) don't support column-level grants. I don't know whether we will add support for them, or whether we will just make the tool output valid grants that ignore the column-level grants. But we will solve this in a future release.

tags: added: pt-show-grants
removed: pt-show-grant
tags: added: wrong-ouput
tags: added: wrong-output
removed: wrong-ouput
Revision history for this message
Mrten (bugzilla-ii) wrote :

--separate output is funny too, but probably not worth to file another bug for it?

Brian Fraser (fraserbn)
Changed in percona-toolkit:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

Bug 866075 is a dupe of this one.

Changed in percona-toolkit:
importance: Low → Undecided
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

We'll see if I can fix this quickly.

summary: - pt-show-grant shows incorrect SQL format output
+ pt-show-grant doesn't support column-level grants
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

Fixed. Just needed to split grants more intelligently: if any column-level grants, then use a regex to match each grant, else use simple split(", ", $grants) as before. The given test case was failing before but works now.

Revision history for this message
Carl Welch (carl-welch-2-718) wrote :

Sorry I took so long, but I just tested this on a development box with users that have column-level permissions, and it worked just as advertised. Thanks very much.

Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

Excellent, thanks for the feedback.

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-758

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.