Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic audit trails via logging #3317

Merged
merged 25 commits into from
Aug 8, 2024
Merged

Basic audit trails via logging #3317

merged 25 commits into from
Aug 8, 2024

Conversation

ammar92
Copy link
Contributor

@ammar92 ammar92 commented Aug 5, 2024

Changes

This PR implements some more audit trails via logging:

  • Adding, creating and deleting objects
  • Plugins
    • Change plugin state
    • Update plugin settings
  • Raw data has been uploaded
  • Login, logout and failed logins
  • Organization creation and deletion

Most of the other logging related to models have been implemented in #3314 and merged into this branch.

Also implemented basic event codes for specific ORM record trails. This is a very basic implementation to get things started. I also considered using a tuple for the event codes (an element for each CRUDE action), but since there's probably still room for improvement and development around the audit trails I used a dict for now for flexibility.

Ideally we'd use more descriptive codes (using alphanumerics) when possible. In both cases, whether we use alphanumeric or numeric codes, we should work towards automatically labeling them as much as possible.

Issue link

Partially closes #3043

QA notes

You should see more logging on certain actions, such as creating an object or enabling a plugin. On certain model changes (such as an organization or organization tags), you should also see an event_code variable in the log record.


Code Checklist

  • All the commits in this PR are properly PGP-signed and verified.
  • This PR only contains functionality relevant to the issue.
  • I have written unit tests for the changes or fixes I made.
  • I have checked the documentation and made changes where necessary.
  • I have performed a self-review of my code and refactored it to the best of my abilities.
  • Tickets have been created for newly discovered issues.
  • For any non-trivial functionality, I have added integration and/or end-to-end tests.
  • I have informed others of any required .env changes files if required and changed the .env-dist accordingly.
  • I have included comments in the code to elaborate on what is not self-evident from the code itself, including references to issues and discussions online, or implicit behavior of an interface.

Checklist for code reviewers:

Copy-paste the checklist from the docs/source/templates folder into your comment.


Checklist for QA:

Copy-paste the checklist from the docs/source/templates folder into your comment.

@ammar92 ammar92 added rocky Issues related to Rocky bytes Issues related to Bytes boefjes Issues related to boefjes octopoes Issues related to octopoes katalogus labels Aug 5, 2024
@ammar92 ammar92 requested a review from a team as a code owner August 5, 2024 08:01
rocky/katalogus/client.py Outdated Show resolved Hide resolved
octopoes/octopoes/connector/octopoes.py Outdated Show resolved Hide resolved
rocky/tools/models.py Outdated Show resolved Hide resolved
@stephanie0x00
Copy link
Contributor

Checklist for QA:

  • I have checked out this branch, and successfully ran a fresh make reset.
  • I confirmed that there are no unintended functional regressions in this branch:
    • I have managed to pass the onboarding flow
    • Objects and Findings are created properly
    • Tasks are created and completed properly
  • I confirmed that the PR's advertised feature or hotfix works as intended.
  • I checked the logs for errors and/or warnings and made issues where necessary

What works:

Looks good. I see various events in the logs. Not observing anything weird, like error messages. Onboarding works and boefjes can be started and complete.

What doesn't work:

n/a

Bug or feature?:

n/a

@underdarknl underdarknl merged commit 72457cc into main Aug 8, 2024
21 checks passed
@underdarknl underdarknl deleted the feature/basic-audit-trails branch August 8, 2024 09:33
jpbruinsslot added a commit that referenced this pull request Aug 8, 2024
* main:
  Basic audit trails via logging (#3317)
  Raw upload with Scan OOIS (#3169)
  Fix Garbage collection and disappearing ports issue (#3214)
  Updated `Django` and `opentelemetry` packages (#3324)
jpbruinsslot added a commit that referenced this pull request Aug 8, 2024
* feature/mula/refactor-queue:
  Fix poetry
  Updates according to code review
  Basic audit trails via logging (#3317)
  Raw upload with Scan OOIS (#3169)
  Fix Garbage collection and disappearing ports issue (#3214)
  Formatting
  Formatting
  Fix formatting
  Updated `Django` and `opentelemetry` packages (#3324)
  Restructure scheduler development scripts (#3293)
  Change report flow to POST requests (#3174)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
boefjes Issues related to boefjes bytes Issues related to Bytes katalogus octopoes Issues related to octopoes rocky Issues related to Rocky
Projects
None yet
Development

Successfully merging this pull request may close these issues.

We need to investigate which events we want to add the our Audit Log.
4 participants