flagsmith icon indicating copy to clipboard operation
flagsmith copied to clipboard

feat: audit additional events

Open riceyrice opened this issue 2 years ago • 2 comments

Thanks for submitting a PR! Please check the boxes below:

  • [x] I have run pre-commit to check linting
  • [x] I have filled in the "Changes" section below?
  • [x] I have filled in the "How did you test this code" section below?
  • [x] I have used a Conventional Commit title for this Pull Request

Changes

Implements #2797

  • refactors AuditLog to associate with organisation without needing project/environment
  • audits security-related project, user, group, role, permission changes per organisation
  • upgrades and patches django-simple-history to correctly handle indirect m2m signals
  • audits user login success/failure and logout signals
  • refactors auth mechanisms to send login success/failure and logout signals

Note: python manage.py populate_history --auto must be run after migrations in order to create initial history instances, otherwise the first update to any model will log a warning but create no audit log records.

Note: There are corresponding changes in flagsmith-saml to ensure django signals are sent which must be deployed to correctly audit saml login success/failure.

Note: Does not include front-end changes to view per-organisation audit logs. AuditLog views look for organisation directly/indirectly and should be simplified once organisation field is backfilled for existing records.

How did you test this code?

Tested manually by making changes to memberships and permissions in the front end app or django admin or django shell. Audit log may be inspected per-project or per-environment in the front end but otherwise must be checked using REST API for per-organisation feed or django shell. ~Unit tests will be added once functionality approved. Existing unit tests may fail as I'm currently unable to run them 😞~ Login success/failure tested manually in front end using samltest.id and developer GitHib/Google apps. Unit tests now complete.

riceyrice avatar Nov 02 '23 15:11 riceyrice

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 15, 2024 2:22pm
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 15, 2024 2:22pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 15, 2024 2:22pm

vercel[bot] avatar Nov 02 '23 15:11 vercel[bot]

Uffizzi Ephemeral Environment deployment-43169

:cloud: https://app.uffizzi.com/github.com/Flagsmith/flagsmith/pull/2918

:page_facing_up: View Application Logs etc.

What is Uffizzi? Learn more!

github-actions[bot] avatar Nov 02 '23 15:11 github-actions[bot]