Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-40722

DROP PACKAGE leaves PACKAGE BODY grant in mysql.procs_priv

    XMLWordPrintable

Details

    • Can result in unexpected behaviour
    • Q3/2026 Server Development

    Description

      Originally reported at https://hackerone.com/reports/3908943

      I run this script:

      SET sql_mode=ORACLE;
       
      DELIMITER $$
      CREATE PACKAGE pkg1 AS
        FUNCTION f RETURN VARCHAR2(64);
      END
      $$
      CREATE PACKAGE BODY pkg1 AS
        FUNCTION f RETURN VARCHAR2(64) AS
          BEGIN RETURN 'benign';
        END;
      END$$
      DELIMITER ;
       
      CREATE OR REPLACE USER reader@localhost;
      GRANT EXECUTE ON PACKAGE test.pkg1 TO reader@localhost;
      GRANT EXECUTE ON PACKAGE BODY test.pkg1 TO reader@localhost;
       
      SELECT host,db,user,routine_name,routine_type,proc_priv FROM mysql.procs_priv ORDER BY routine_type;
      

      It returns the following output:

      +-----------+------+--------+--------------+--------------+-----------+
      | host      | db   | user   | routine_name | routine_type | proc_priv |
      +-----------+------+--------+--------------+--------------+-----------+
      | localhost | test | reader | pkg1         | PACKAGE      | Execute   |
      | localhost | test | reader | pkg1         | PACKAGE BODY | Execute   |
      +-----------+------+--------+--------------+--------------+-----------+
      

      Looks ok so far.

      Now I drop the package and re-run the query to mysql.procs_priv:

      DROP PACKAGE pkg1;
      SELECT host,db,user,routine_name,routine_type,proc_priv FROM mysql.procs_priv ORDER BY routine_type;
      

      It returns the following output:

      +-----------+------+--------+--------------+--------------+-----------+
      | host      | db   | user   | routine_name | routine_type | proc_priv |
      +-----------+------+--------+--------------+--------------+-----------+
      | localhost | test | reader | pkg1         | PACKAGE BODY | Execute   |
      +-----------+------+--------+--------------+--------------+-----------+
      

      Notice, the grant for PACKAGE BODY is still there. This is an unexpected behaviour. It should be removed by the DROP PACKAGE.

      Reported by heyoimjeb

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 0.5d
                  0.5d

                  Git Integration

                    Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.