Issue Details (XML | Word | Printable)

Key: DERBY-3736
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Dag H. Wanvik
Reporter: Dag H. Wanvik
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

Revoking a column level privilege from a user, a prepared statement relying on that privilege can still be executed

Created: 25/Jun/08 09:14 PM   Updated: 01/Jul/09 04:35 PM
Return to search
Component/s: SQL
Affects Version/s: 10.3.1.4, 10.3.2.1, 10.3.3.0, 10.4.1.3
Fix Version/s: 10.4.2.0, 10.5.1.1

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works column-level.sql 2008-06-25 09:23 PM Dag H. Wanvik 0.4 kB
File Licensed for inclusion in ASF works derby-3736.diff 2008-07-02 12:39 PM Dag H. Wanvik 2 kB
File Licensed for inclusion in ASF works derby-3736.stat 2008-07-02 12:39 PM Dag H. Wanvik 0.2 kB
File Licensed for inclusion in ASF works derby-3736b.diff 2008-07-07 08:58 AM Dag H. Wanvik 3 kB
File Licensed for inclusion in ASF works derby-3736b.stat 2008-07-07 08:58 AM Dag H. Wanvik 0.2 kB
File Licensed for inclusion in ASF works GrantRevokeDDLTest.diff 2008-06-25 09:23 PM Dag H. Wanvik 2 kB
File Licensed for inclusion in ASF works table-level.sql 2008-06-25 09:23 PM Dag H. Wanvik 0.3 kB
Issue Links:
Reference
 

Bug behavior facts: Security, Regression
Resolution Date: 09/Jul/08 09:02 AM


 Description  « Hide
When a table level SELECT privilege is revoked, a dependent prepared statement is
invalidated and can no longer be executed, but in the case of a column level privilege
SELECT privilege, the dependent prepared statement can still be executed.

This works as expected in 10.2, but does not work in all 10.3 and 10.4 releases.


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Dag H. Wanvik added a comment - 25/Jun/08 09:23 PM
Attaching a repro, column-level.sql which shows the issue.
For contrast I attach table-level.sql which fails as expected.

I also attach a diff I made to GrantRevokeDDLTest with a test case
which can be used to reproduce.

I ran the scripts with this incantation
java -Dderby.user.dag=wanvik -Dderby.user.donald=duck -Dderby.connection.requireAuthentication=true -Dderby.database.sqlAuthorization=true -jar derbyrun.jar ij < script

Dag H. Wanvik added a comment - 02/Jul/08 12:39 PM
Enclosing a patch which fixes the issue by adding a
line for the column case in TablePrivilegeInfo:

> dd.getDependencyManager().invalidateFor
   (td, DependencyManager.INTERNAL_RECOMPILE_REQUEST, lcc);

There is already such a line for the case when a table level privilege is revoked
and there it carries the following comment:

// When revoking a privilege from a Table we need to
// invalidate all GPSs refering to it. But GPSs aren't
// Dependents of TablePermsDescr, but of the
// TableDescriptor itself, so we must send
// INTERNAL_RECOMPILE_REQUEST to the TableDescriptor's
// Dependents.

The patch adds the test case to GrantRevokeDDLTest uploaded earlier.
It fails without the above change to TablePrivilegeInfo, but works with it.

Running regressions now, ready for review.

Rick Hillegas added a comment - 02/Jul/08 02:18 PM
Thanks for the patch, Dag. It looks good. You might want to decorate your one line fix with the comment block which explains why INTERNAL_RECOMPILE_REQUEST is being requested:

// When revoking a privilege from a Table we need to
// invalidate all GPSs refering to it. But GPSs aren't
// Dependents of TablePermsDescr, but of the
// TableDescriptor itself, so we must send
// INTERNAL_RECOMPILE_REQUEST to the TableDescriptor's
// Dependents.

Thanks,
-Rick

Dag H. Wanvik added a comment - 03/Jul/08 08:15 AM
Thanks for looking at this, Rick. I will add the comment for the
column case as well. Regressions ran ok.

Dag H. Wanvik added a comment - 07/Jul/08 08:58 AM
Updating a new version, derby-3736b which replaces the first version.
This adds the comment Rick asked for plus fixes some whitespace issues.

I will commit this soon if no objects arise.

Dag H. Wanvik added a comment - 08/Jul/08 01:06 PM
committed derby-3736b as svn 674808 on trunk.

Dag H. Wanvik added a comment - 08/Jul/08 01:23 PM
I link this issue to DERBY-2594, which addressed the
analog issue for table level privileges.

Dag H. Wanvik added a comment - 08/Jul/08 01:26 PM
DERBY-2594 explains why this was not an issue in 10.2.
I will backport this fix to the 10.3 and 10.4 branches.

Dag H. Wanvik added a comment - 09/Jul/08 09:02 AM
Merged patch to 10.3 branch as svn 675121 and to 10.4 branch as svn 675116, closing.

The regressions ran OK on 10.3 branch, but I saw several errors and and one fault on the 10.4 branch which
I deem to be unrelated (JMX management beans tests).

Dag H. Wanvik added a comment - 09/Jul/08 09:25 AM
The errors I saw on the 10.4 branch running regressions were due to running with classes,
not the DERBY jar files in CLASSPATH.