Skip to content

Commit

Permalink
WIP: Event logging
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackDex committed Nov 18, 2022
1 parent 7a76731 commit 88167c4
Show file tree
Hide file tree
Showing 36 changed files with 1,872 additions and 289 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
# This is done globally to prevent rebuilds when the RUSTFLAGS env variable changes.
env:
RUSTFLAGS: "-D warnings"
if: ${{ github.repository == 'BlackDex/vaultwarden' }} # HACK: Remove in final PR, leave for now to prevent rebuilds on push everytime
strategy:
fail-fast: false
matrix:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/hadolint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
hadolint:
name: Validate Dockerfile syntax
runs-on: ubuntu-20.04
if: ${{ github.repository == 'BlackDex/vaultwarden' }} # HACK: Remove in final PR, leave for now to prevent rebuilds on push everytime
steps:
# Checkout the repo
- name: Checkout
Expand Down
97 changes: 50 additions & 47 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ tokio = { version = "1.21.2", features = ["rt-multi-thread", "fs", "io-util", "p

# A generic serialization/deserialization framework
serde = { version = "1.0.147", features = ["derive"] }
serde_json = "1.0.87"
serde_json = "1.0.88"

# A safe, extensible ORM and Query builder
diesel = { version = "2.0.2", features = ["chrono", "r2d2"] }
diesel_migrations = "2.0.0"
diesel_logger = "0.2.0"


# Bundled SQLite
libsqlite3-sys = { version = "0.25.2", features = ["bundled"], optional = true }
Expand All @@ -79,10 +81,10 @@ rand = { version = "0.8.5", features = ["small_rng"] }
ring = "0.16.20"

# UUID generation
uuid = { version = "1.2.1", features = ["v4"] }
uuid = { version = "1.2.2", features = ["v4"] }

# Date and time libraries
chrono = { version = "0.4.22", features = ["clock", "serde"], default-features = false }
chrono = { version = "0.4.23", features = ["clock", "serde"], default-features = false }
chrono-tz = "0.8.0"
time = "0.3.17"

Expand Down Expand Up @@ -116,7 +118,7 @@ email_address = "0.2.4"
handlebars = { version = "4.3.5", features = ["dir_source"] }

# HTTP client
reqwest = { version = "0.11.12", features = ["stream", "json", "gzip", "brotli", "socks", "cookies", "trust-dns"] }
reqwest = { version = "0.11.13", features = ["stream", "json", "gzip", "brotli", "socks", "cookies", "trust-dns"] }

# For favicon extraction from main website
html5gum = "0.5.2"
Expand Down Expand Up @@ -147,7 +149,7 @@ semver = "1.0.14"

# Allow overriding the default memory allocator
# Mainly used for the musl builds, since the default musl malloc is very slow
mimalloc = { version = "0.1.31", features = ["secure"], default-features = false, optional = true }
mimalloc = { version = "0.1.32", features = ["secure"], default-features = false, optional = true }

[patch.crates-io]
# Using a patched version of multer-rs (Used by Rocket) to fix attachment/send file uploads
Expand Down
1 change: 1 addition & 0 deletions migrations/mysql/2022-10-18-170602_add_events/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE event;
19 changes: 19 additions & 0 deletions migrations/mysql/2022-10-18-170602_add_events/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CREATE TABLE event (
uuid CHAR(36) NOT NULL PRIMARY KEY,
event_type INTEGER NOT NULL,
user_uuid CHAR(36),
org_uuid CHAR(36),
cipher_uuid CHAR(36),
collection_uuid CHAR(36),
group_uuid CHAR(36),
org_user_uuid CHAR(36),
act_user_uuid CHAR(36),
device_type INTEGER,
ip_address TEXT,
event_date DATETIME NOT NULL,
policy_uuid CHAR(36),
provider_uuid CHAR(36),
provider_user_uuid CHAR(36),
provider_org_uuid CHAR(36),
UNIQUE (uuid)
);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE event;
19 changes: 19 additions & 0 deletions migrations/postgresql/2022-10-18-170602_add_events/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CREATE TABLE event (
uuid CHAR(36) NOT NULL PRIMARY KEY,
event_type INTEGER NOT NULL,
user_uuid CHAR(36),
org_uuid CHAR(36),
cipher_uuid CHAR(36),
collection_uuid CHAR(36),
group_uuid CHAR(36),
org_user_uuid CHAR(36),
act_user_uuid CHAR(36),
device_type INTEGER,
ip_address TEXT,
event_date TIMESTAMP NOT NULL,
policy_uuid CHAR(36),
provider_uuid CHAR(36),
provider_user_uuid CHAR(36),
provider_org_uuid CHAR(36),
UNIQUE (uuid)
);
1 change: 1 addition & 0 deletions migrations/sqlite/2022-10-18-170602_add_events/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE event;
Loading

0 comments on commit 88167c4

Please sign in to comment.