Details

    Description

      create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;
      insert into t values (1,'2022-01-01','2023-01-01');
      create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01';
      insert into t (a) values (1);
      select * from t for system_time all;
       
      # Cleanup
      drop table t;
      

      bb-10.11-MDEV-16546 2b1d32429

      create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;
      create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01';
      insert into t (a) values (1);
      select * from t for system_time all;
      a	s	e
      1	2022-01-01 00:00:00.000000	2023-01-01 00:00:00.000000
      drop table t;
      

      Attachments

        Issue Links

          Activity

            elenst Elena Stepanova created issue -
            elenst Elena Stepanova made changes -
            Field Original Value New Value
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            serg Sergei Golubchik made changes -
            Affects Version/s 10.6 [ 24028 ]
            Affects Version/s 10.7 [ 24805 ]
            Affects Version/s 10.8 [ 26121 ]
            Affects Version/s 10.9 [ 26905 ]
            Affects Version/s 10.10 [ 27530 ]
            Affects Version/s N/A [ 14700 ]
            serg Sergei Golubchik made changes -
            Summary system_versioning_insert_history allows to bypass privilege check via trigger one can modify history via triggers
            serg Sergei Golubchik made changes -
            Summary one can modify history via triggers triggers can modify history
            serg Sergei Golubchik made changes -
            Affects Version/s 10.3 [ 22126 ]
            Affects Version/s 10.4 [ 22408 ]
            Affects Version/s 10.5 [ 23123 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            Fix Version/s 10.7 [ 24805 ]
            Fix Version/s 10.8 [ 26121 ]
            Fix Version/s 10.9 [ 26905 ]
            Fix Version/s 10.10 [ 27530 ]
            Fix Version/s 10.11 [ 27614 ]
            serg Sergei Golubchik made changes -
            Description {code:sql}
            if (`select @@secure_timestamp != 'YES'`)
            {
              --die # Run with @@secure_timestamp YES
            }

            create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;
            set system_versioning_insert_history= on;
            --error ER_OPTION_PREVENTS_STATEMENT
            insert into t values (1,'2022-01-01','2023-01-01');
            create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01';
            insert into t (a) values (1);
            select * from t for system_time all;

            # Cleanup
            drop table t;
            {code}

            {code:sql|title=bb-10.11-MDEV-16546 2b1d32429}
            create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;
            set system_versioning_insert_history= on;
            insert into t values (1,'2022-01-01','2023-01-01');
            ERROR HY000: The MariaDB server is running with the --secure-timestamp=YES option so it cannot execute this statement
            create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01';
            insert into t (a) values (1);
            select * from t for system_time all;
            a s e
            1 2022-01-01 00:00:00.000000 2023-01-01 00:00:00.000000
            drop table t;
            {code}
            {code:sql}
            create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;
            insert into t values (1,'2022-01-01','2023-01-01');
            create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01';
            insert into t (a) values (1);
            select * from t for system_time all;

            # Cleanup
            drop table t;
            {code}

            {code:sql|title=bb-10.11-MDEV-16546 2b1d32429}
            create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;
            set system_versioning_insert_history= on;
            insert into t values (1,'2022-01-01','2023-01-01');
            ERROR HY000: The MariaDB server is running with the --secure-timestamp=YES option so it cannot execute this statement
            create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01';
            insert into t (a) values (1);
            select * from t for system_time all;
            a s e
            1 2022-01-01 00:00:00.000000 2023-01-01 00:00:00.000000
            drop table t;
            {code}
            serg Sergei Golubchik made changes -
            Description {code:sql}
            create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;
            insert into t values (1,'2022-01-01','2023-01-01');
            create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01';
            insert into t (a) values (1);
            select * from t for system_time all;

            # Cleanup
            drop table t;
            {code}

            {code:sql|title=bb-10.11-MDEV-16546 2b1d32429}
            create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;
            set system_versioning_insert_history= on;
            insert into t values (1,'2022-01-01','2023-01-01');
            ERROR HY000: The MariaDB server is running with the --secure-timestamp=YES option so it cannot execute this statement
            create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01';
            insert into t (a) values (1);
            select * from t for system_time all;
            a s e
            1 2022-01-01 00:00:00.000000 2023-01-01 00:00:00.000000
            drop table t;
            {code}
            {code:sql}
            create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;
            insert into t values (1,'2022-01-01','2023-01-01');
            create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01';
            insert into t (a) values (1);
            select * from t for system_time all;

            # Cleanup
            drop table t;
            {code}

            {code:sql|title=bb-10.11-MDEV-16546 2b1d32429}
            create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;
            create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01';
            insert into t (a) values (1);
            select * from t for system_time all;
            a s e
            1 2022-01-01 00:00:00.000000 2023-01-01 00:00:00.000000
            drop table t;
            {code}
            serg Sergei Golubchik made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            serg Sergei Golubchik made changes -
            Status In Progress [ 3 ] In Testing [ 10301 ]
            elenst Elena Stepanova made changes -
            Summary triggers can modify history Triggers can modify history
            serg Sergei Golubchik made changes -
            Fix Version/s 10.10.2 [ 28410 ]
            Fix Version/s 10.9.4 [ 28444 ]
            Fix Version/s 10.8.6 [ 28443 ]
            Fix Version/s 10.7.7 [ 28442 ]
            Fix Version/s 10.6.11 [ 28441 ]
            Fix Version/s 10.5.18 [ 28421 ]
            Fix Version/s 10.4.27 [ 28405 ]
            Fix Version/s 10.3.37 [ 28404 ]
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            Fix Version/s 10.7 [ 24805 ]
            Fix Version/s 10.8 [ 26121 ]
            Fix Version/s 10.9 [ 26905 ]
            Fix Version/s 10.10 [ 27530 ]
            Resolution Fixed [ 1 ]
            Status In Testing [ 10301 ] Closed [ 6 ]

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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