Skip to content

Misplaced ignore_missing in user schema for password field #9233

Description

@etj

CKAN version

The lines have been there for 10 years, so I guess many version are involved.
Latest ones:

Describe the bug

In ckan.logic.schema.default_user_schema the password field is defined as:

        'password': [user_password_validator, user_password_not_empty,
                     ignore_missing, unicode_safe],

Since ignore_missing is not placed in first position, the password becomes mandatory while it shouldn't.

Steps to reproduce

Create a user without the password.
Even the sample code at https://github.com/ckan/ckan/blob/ckan-2.11.4/ckan/logic/action/create.py#L957-L968 won't work.

   user = get_action("user_create")(
      {"ignore_auth": True},
      {
         "name": "test_user",
         "email": "test@example.com",
         "plugin_extras": {
            "my_plugin": {
               "private_extra": 1
            },
            "another_plugin": {
               "another_extra": True
            }
         }
      }

Expected behavior

It should be possibile to create users without a password.

Additional details

Running on a ckan 2.10.9:

error stack trace
Traceback (most recent call last):
  File "/opt/ckan/src/ckanext-azure-auth/ckanext/azure_auth/blueprint.py", line 110, in token_login
    user_dict = auth_backend.process_access_token(id_token)
  File "/opt/ckan/src/ckanext-azure-auth/ckanext/azure_auth/auth_backend.py", line 284, in process_access_token
    return self.get_or_create_user(claims)
  File "/opt/ckan/src/ckanext-azure-auth/ckanext/azure_auth/auth_backend.py", line 436, in get_or_create_user
    user = get_action("user_create")(
  File "/opt/ckan/src/ckan/ckan/logic/__init__.py", line 580, in wrapped
    result = _action(context, data_dict, **kw)
  File "/opt/ckan/src/ckan/ckan/logic/action/create.py", line 1017, in user_create
    raise ValidationError(errors)
ckan.logic.ValidationError: None - {'password': ['Valore mancante']}
Details

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions