Skip to content

events: add better fallback for sanitize_item to ensure everything can be saved as JSON#7694

Merged
BeryJu merged 2 commits intomainfrom
events/finally-fix-json-encoding
Nov 23, 2023
Merged

events: add better fallback for sanitize_item to ensure everything can be saved as JSON#7694
BeryJu merged 2 commits intomainfrom
events/finally-fix-json-encoding

Conversation

@BeryJu
Copy link
Member

@BeryJu BeryJu commented Nov 22, 2023

Details

The sanitize_item function already has a lot of special case, but there wasn't really a guarantee that what it returned was JSON-able.

closes #7691


Checklist

  • Local tests pass (ak test authentik/)
  • The code has been formatted (make lint-fix)

If an API change has been made

  • The API schema has been updated (make gen-build)

If changes to the frontend have been made

  • The code has been formatted (make web)
  • The translation files have been updated (make i18n-extract)

If applicable

  • The documentation has been updated
  • The documentation has been formatted (make website)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
@BeryJu BeryJu requested a review from a team as a code owner November 22, 2023 19:34
@netlify
Copy link

netlify bot commented Nov 22, 2023

Deploy Preview for authentik-storybook canceled.

Name Link
🔨 Latest commit 4060e5a
🔍 Latest deploy log https://app.netlify.com/sites/authentik-storybook/deploys/655e57adb2308a0008652cc8

@codecov
Copy link

codecov bot commented Nov 22, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (255e143) 92.64% compared to head (4060e5a) 92.63%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7694      +/-   ##
==========================================
- Coverage   92.64%   92.63%   -0.01%     
==========================================
  Files         588      588              
  Lines       29140    29141       +1     
==========================================
- Hits        26997    26996       -1     
- Misses       2143     2145       +2     
Flag Coverage Δ
e2e 50.71% <100.00%> (+<0.01%) ⬆️
integration 25.94% <85.71%> (+0.01%) ⬆️
unit 89.71% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@smusali
Copy link
Contributor

smusali commented Nov 22, 2023

Why do you remove the print statements?

@BeryJu
Copy link
Member Author

BeryJu commented Nov 23, 2023

Why do you remove the print statements?

@smusali they shouldn't have been in there in the first place, most likely debug leftovers

Copy link
Contributor

@smusali smusali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@BeryJu BeryJu merged commit 0797dec into main Nov 23, 2023
@BeryJu BeryJu deleted the events/finally-fix-json-encoding branch November 23, 2023 10:43
kensternberg-authentik added a commit that referenced this pull request Nov 27, 2023
* main: (47 commits)
  web: bump the wdio group in /tests/wdio with 2 updates (#7702)
  events: fix lint (#7700)
  events: add better fallback for sanitize_item to ensure everything can be saved as JSON (#7694)
  web: bump the wdio group in /tests/wdio with 4 updates (#7696)
  events: include user agent in events (#7693)
  web: fix labels on group view page (#7677)
  website/docs: Add OIDC auth integration with Nextcloud (#7406)
  web: fix locale (#7689)
  core: bump python from 3.11.5-bookworm to 3.12.0-bookworm (#7048)
  translate: Updates for file web/xliff/en.xlf in zh_TW (#7688)
  web: bump pyright from 1.1.336 to 1.1.337 in /web (#7681)
  core: bump sentry-sdk from 1.35.0 to 1.36.0 (#7683)
  website: bump prism-react-renderer from 2.2.0 to 2.3.0 in /website (#7685)
  web: bump the sentry group in /web with 2 updates (#7679)
  web: bump rollup from 4.5.0 to 4.5.1 in /web (#7680)
  web: bump @types/codemirror from 5.60.14 to 5.60.15 in /web (#7682)
  web: bump the wdio group in /tests/wdio with 2 updates (#7684)
  website: bump react-tooltip from 5.23.0 to 5.24.0 in /website (#7686)
  core: bump goauthentik.io/api/v3 from 3.2023103.4 to 3.2023104.1 (#7687)
  website/blog: Blog on security (#7671)
  ...
kensternberg-authentik added a commit that referenced this pull request Dec 8, 2023
* main: (219 commits)
  web: bump the wdio group in /tests/wdio with 2 updates (#7702)
  events: fix lint (#7700)
  events: add better fallback for sanitize_item to ensure everything can be saved as JSON (#7694)
  web: bump the wdio group in /tests/wdio with 4 updates (#7696)
  events: include user agent in events (#7693)
  web: fix labels on group view page (#7677)
  website/docs: Add OIDC auth integration with Nextcloud (#7406)
  web: fix locale (#7689)
  core: bump python from 3.11.5-bookworm to 3.12.0-bookworm (#7048)
  translate: Updates for file web/xliff/en.xlf in zh_TW (#7688)
  web: bump pyright from 1.1.336 to 1.1.337 in /web (#7681)
  core: bump sentry-sdk from 1.35.0 to 1.36.0 (#7683)
  website: bump prism-react-renderer from 2.2.0 to 2.3.0 in /website (#7685)
  web: bump the sentry group in /web with 2 updates (#7679)
  web: bump rollup from 4.5.0 to 4.5.1 in /web (#7680)
  web: bump @types/codemirror from 5.60.14 to 5.60.15 in /web (#7682)
  web: bump the wdio group in /tests/wdio with 2 updates (#7684)
  website: bump react-tooltip from 5.23.0 to 5.24.0 in /website (#7686)
  core: bump goauthentik.io/api/v3 from 3.2023103.4 to 3.2023104.1 (#7687)
  website/blog: Blog on security (#7671)
  ...
@BeryJu
Copy link
Member Author

BeryJu commented Dec 19, 2023

/cherry-pick version-2023.10

gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Dec 19, 2023
…n be saved as JSON (#7694)

* events: fix events sanitizing not handling all types

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* remove some leftover prints

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
BeryJu added a commit that referenced this pull request Dec 19, 2023
…n be saved as JSON (cherry-pick #7694) (#7937)

events: add better fallback for sanitize_item to ensure everything can be saved as JSON (#7694)

* events: fix events sanitizing not handling all types



* remove some leftover prints



---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Jens L <jens@goauthentik.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using ak_create_event in an event policy

2 participants