Skip to content
Snippets Groups Projects
  1. Dec 20, 2023
    • Dmitry Rodionov's avatar
      chore: deduplicate constants for admin user id · d83013d1
      Dmitry Rodionov authored and Yaroslav Dynnikov's avatar Yaroslav Dynnikov committed
      Before this patch we've had ADMIN_ID in schema.rs and ADMIN_USER_ID
      in lib.rs. This patch removes ADMIN_USER_ID in favor of ADMIN_ID
      
      (cherry picked from commit 4dde8dd8)
      d83013d1
    • Dmitry Rodionov's avatar
      feat(audit) add initiator field to relevant events (almost all of them) · 3d6d50d7
      Dmitry Rodionov authored and Yaroslav Dynnikov's avatar Yaroslav Dynnikov committed
      This patch adds initiator field to most of the events. Initiator is
      added to members of Op enum which do not contain it already (e g owner
      in CreateUser serves as initiator). To me it is reasonable to remove
      as_user from CaS/ACL checks because it matches initiator. But I decided
      not to do this just yet.
      
      Additionally I've mande small cleanup to UserMetadata to avoid need for
      intermediate step in decoding when we first fetch tuple and then decode
      it into model struct.
      
      Close https://git.picodata.io/picodata/picodata/picodata/-/issues/433
      
      (cherry picked from commit c2838650)
      3d6d50d7
    • Kurdakov Alexander's avatar
      feat: check for circular role grants · f9f6fb23
      Kurdakov Alexander authored and Yaroslav Dynnikov's avatar Yaroslav Dynnikov committed
      (cherry picked from commit 0845aa03)
      f9f6fb23
    • Dmitry Rodionov's avatar
      test: make connection usable by itself · 5a1f6749
      Dmitry Rodionov authored and Yaroslav Dynnikov's avatar Yaroslav Dynnikov committed
      Frequently when we want to execute commands from different users we need
      to pass username and password separatly to each invokation. With this
      patch this approach can be simplified and connection can be used
      directlry in form of context manager.
      
      Additionally this patch fixes handling of NOLOG env var. When it is
      supplied logs are disabled which simplifies debugging of a test nbecause
      with continuous output from multiple instances it is impossible to use
      debugger efficiently.
      
      (cherry picked from commit c4b1eaf6)
      5a1f6749
    • Dmitry Rodionov's avatar
      feat: validate combination of object type and privilege in PrivilegeDef · 13e5e2b4
      Dmitry Rodionov authored and Yaroslav Dynnikov's avatar Yaroslav Dynnikov committed
      At the later stage I discovered that sbroad applies the same validation
      rules during parsing of grant/revoke statements and even its own
      Privilege enum that is a ~copy of our PrivilegeType. Unfortunately
      at the moment there is no way to share code between picodata and sbroad
      efficiently (now only tarantool-module is shared and it is not suitable
      for such kind of things) so it still makes sense to have this in
      picodata because this is the point where all APIs converge to the single
      point (CaS). In the future all other ways of validation should be
      removed. Aside from sbroad similar kind of validation is performed
      independently on lua API side.
      
      Note that in prior commit 45ba7392 we've
      removed all privileges from role super. This patch removes privileges
      from admin that do not match the model: namely all privileges on
      universe except session and usage. With this patch it is no longer possible
      to grant or revoke such privileges.
      
      (cherry picked from commit 7e8d2652)
      13e5e2b4
    • Dmitry Rodionov's avatar
      refactor: make fields of PrivilegeDef private · 0a57f1fd
      Dmitry Rodionov authored and Yaroslav Dynnikov's avatar Yaroslav Dynnikov committed
      This allows future constructors to enforce invariants.
      Additionally this commit removes redundant set_schema_version on Op by
      passing schema version to corresponding Op constructors.
      
      (cherry picked from commit 53dbcc69)
      0a57f1fd
    • Yaroslav Dynnikov's avatar
      705dad95
  2. Dec 07, 2023
  3. Dec 06, 2023
    • Egor Ivkov's avatar
      fix: set default value of max login attempts to 4 · 2be3aecf
      Egor Ivkov authored and Yaroslav Dynnikov's avatar Yaroslav Dynnikov committed
      2be3aecf
    • Yaroslav Dynnikov's avatar
      test: access control user story · 28d3d223
      Yaroslav Dynnikov authored and Yaroslav Dynnikov's avatar Yaroslav Dynnikov committed
      Tested scenarios:
      
      1. Alice is granted a privilege to create global/sharded table
      2. Alice can create, read, and write it
      3. Bob can't read it
      4. Alice grants Bob a privilege to read it
      5. Now Bob can read it, but he still can't write
      28d3d223
    • Kurdakov Alexander's avatar
      refactor: remove all privileges from role super · 45ba7392
      Kurdakov Alexander authored and Alexander Kurdakov's avatar Alexander Kurdakov committed
      45ba7392
    • Dmitry Ivanov's avatar
      feat(audit): don't print None values · 2e035654
      Dmitry Ivanov authored
      This patch adds a proper support for auxiliary fields containing `Option<T>`.
      As of now, KV pairs containing `Some(x)` will be printed as just `x`,
      while the ones with `None` won't be printed at all.
      
      Example:
      
      ```rust
      crate::audit!(
          message: "demo audit event",
          title: "example",
          severity: Low,
          test: Some(0u32),
      );
      ```
      
      ```json
      {
        "id": "1.0.1",
        "message": "demo audit event",
        "severity": "low",
        "time": "2023-12-06T17:16:51.085+0300",
        "title": "example",
        "test": "0"
      }
      ```
      
      ```rust
      crate::audit!(
          message: "demo audit event",
          title: "example",
          severity: Low,
          test: None::<i32>,
      );
      ```
      
      ```json
      {
        "id": "1.0.1",
        "message": "demo audit event",
        "severity": "low",
        "time": "2023-12-06T17:16:51.085+0300",
        "title": "example"
      }
      ```
      2e035654
  4. Dec 04, 2023
  5. Dec 03, 2023
  6. Dec 01, 2023
  7. Nov 29, 2023
    • Kurdakov Alexander's avatar
      0c96fceb
    • Dmitry Ivanov's avatar
      feat(audit): implement composite record id · 1340f8a3
      Dmitry Ivanov authored
      Logically, the record id consists of 3 fields:
      * `raft_id` -- raft id of the current node (or `null` if uninitialized);
      * `count` -- in-memory id which is auto incremented for each new record;
      * `gen` -- persistent id which is incremented each time node is started.
      
      However, in practice they are stored inside a global `LogicalClock`.
      
      This is what the record looks like now:
      
      ```json
      {
        "id": "1.0.3",
        "instance_id": "i1",
        "message": "a new instance `i1` joined the cluster",
        "raft_id": "1",
        "severity": "low",
        "time": "2023-11-29T17:07:36.524+0300",
        "title": "join_instance"
      }
      ```
      
      Note how those fields are concatenated using `.`; the resulting
      unique id is represented by a json string type.
      
      Furthermore, since audit record logger now depends on the
      raft machine's state, we decided to move its initialization
      further into the init sequence (postjoin).
      1340f8a3
  8. Nov 28, 2023
Loading