Skip to content

Commit

Permalink
stages/user_write: ensure user data is json-serializable (#8926)
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
  • Loading branch information
BeryJu committed Mar 15, 2024
1 parent ac1ef51 commit cf6bbba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion authentik/stages/user_write/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from authentik.core.middleware import SESSION_KEY_IMPERSONATE_USER
from authentik.core.models import USER_ATTRIBUTE_SOURCES, User, UserSourceConnection, UserTypes
from authentik.core.sources.stage import PLAN_CONTEXT_SOURCES_CONNECTION
from authentik.events.utils import sanitize_item
from authentik.flows.planner import PLAN_CONTEXT_PENDING_USER
from authentik.flows.stage import StageView
from authentik.flows.views.executor import FlowExecutorView
Expand Down Expand Up @@ -47,7 +48,7 @@ def write_attribute(user: User, key: str, value: Any):
# this is just a sanity check to ensure that is removed
if parts[0] == "attributes":
parts = parts[1:]
set_path_in_dict(user.attributes, ".".join(parts), value)
set_path_in_dict(user.attributes, ".".join(parts), sanitize_item(value))

def ensure_user(self) -> tuple[User | None, bool]:
"""Ensure a user exists"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export class UserSettingsFlowExecutor
`authentik/user/flows: unsupported stage type ${this.challenge.component}`,
);
return html`
<a href="/if/flow/${this.flowSlug}" class="pf-c-button pf-m-primary">
<a href="/if/flow/${this.flowSlug}/" class="pf-c-button pf-m-primary">
${msg("Open settings")}
</a>
`;
Expand Down

0 comments on commit cf6bbba

Please sign in to comment.