Giter Site home page Giter Site logo

commanded-audit-middleware's Introduction

Commanded

Use Commanded to build your own Elixir applications following the CQRS/ES pattern.

Provides support for:

  • Command registration and dispatch.
  • Hosting and delegation to aggregates.
  • Event handling.
  • Long running process managers.

Commanded provides a solid technical foundation for you to build on. It allows you to focus on modelling your domain, the most important part of your app, creating a better application at a faster pace.

You can use Commanded with one of the following event stores for persistence:

Please refer to the CHANGELOG for features, bug fixes, and any upgrade advice included for each release.

Requires Erlang/OTP v21.0 and Elixir v1.11 or later.


Sponsors

Alembic


MIT License

Build Status Join the chat at https://gitter.im/commanded/Lobby


This README and the following guides follow the master branch which may not be the currently published version.

Read the documentation for the latest published version of Commanded on Hex.

Overview


Used in production?

Yes, see the companies using Commanded.

Example application

Conduit is an open source, example Phoenix 1.3 web application implementing the CQRS/ES pattern in Elixir. It was built to demonstrate the implementation of Commanded in an Elixir application for the Building Conduit book.

Learn Commanded in 20 minutes

Watch Bernardo Amorim introduce CQRS and event sourcing at Code Beam SF 2018. Including a tutorial on how to implement an Elixir application using these concepts with Commanded.

Contributing

Pull requests to contribute new or improved features, and extend documentation are most welcome.

Please follow the existing coding conventions, or refer to the Elixir style guide.

You should include unit tests to cover any changes. Run mix test to execute the test suite.

Contributors

Commanded exists thanks to the following people who have contributed.

Need help?

Please open an issue if you encounter a problem, or need assistance. You can also seek help in the #commanded channel in the official Elixir Slack.

commanded-audit-middleware's People

Contributors

cptbreeza avatar hopeshigh avatar jdav-dev avatar mkaravaev avatar slashdotdash avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

commanded-audit-middleware's Issues

Error thrown before the start_time causes delta for end_time to fail

Error

1) test register user should fail when email address already taken and return error (Conduit.UsersTest)
     test/conduit/users/users_test.exs:69
     ** (FunctionClauseError) no function clause matching in Commanded.Middleware.Auditing.delta/1

     The following arguments were given to Commanded.Middleware.Auditing.delta/1:

%Commanded.Middleware.Pipeline{assigns: %{error: :validation_failure, error_reason: %{email: ["has already been taken"]}}, 
...

To Reproduce

Add commanded-audit-middleware to Conduit, and then run mix test.

Suggested Solution

Pattern Matching for delta

for when a delta does not yet have a start_time and error is already thrown.

Filter specific fields from audited commands

It seems that there is not a way to hide secrets, for example, when a command %CreateUser{email: foo@123, password: 123123, password_confirmation: 123123} is given:

This is what phoenix does, by default:

Parameters: %{"_csrf_token" => "URlELFdLASBAPzQzLD4IYDYrG1V1AAAA3s+B42ij0ngdDY1SBIc9Fw==", "_utf8" => "✓", "email" => "foo@123", "password" => "[FILTERED]", "password_confirmation" => "[FILTERED]"}

And this is what audit does:

[debug] QUERY OK db=5.9ms queue=0.1ms
INSERT INTO "command_audit" ("command_type","command_uuid","correlation_id","data","metadata","occurred_at") VALUES ($1,$2,$3,$4,$5,$6) ["Elixir.Accounts.User.Commands.CreateUser", "1918d8b1-dccb-4ae2-9a7b-2f37002dbb23", <<36, 209, 176, 66, 185, 241, 77, 1, 132, 82, 117, 247, 155, 104, 150, 135>>, "{\"password_confirmation\":\"123\",\"password\":\"123\",\"email\":\"foo@123\"}", "{}", {{2017, 12, 16}, {20, 27, 22, 68258}}]

The solution should be having some sensible defaults, and allow people to configure it further.

Use 2 different DB when running an application with 2 Commanded Applications

Hi,

Thanks for this library!

Im facing the following limitation, Im running an application that is currently running 2 different Commanded Applications with 2 different Routers and 2 differente event store DB.

Ideally I would want to add this library and be able to have 2 DB for the audits.
For what I can see that is not possible now.

Is this something that make sense to add to this project?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.