Skip to content

Cannot save LDAP settings if Server URI ends with custom domain(i.e. not ending with com, net, org, etc) #3646

Closed

Description

@SylvainMartel
ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • UI
SUMMARY
ENVIRONMENT
  • AWX version: 4.0.0
  • AWX install method: docker on linux
  • Ansible version: 2.7.9
  • Operating System: Centos 7
  • Web Browser: chrome
STEPS TO REPRODUCE
  1. Go to Settings -> AUTHENTICATION.
  2. In the Sub Category drop-down, select LDAP.
  3. In the LDAP Server URI field, attempt to add a URI that ends with a custom internal domain like: ldap://servername.cotoso.coto.so3:389
  4. Hit Save
EXPECTED RESULTS

It should save the config

ACTUAL RESULTS

Error message stating: Failed to save settings. Returned status: 400

The field then display : Enter a valid URL
But the url is valid, for an internal domain.

ADDITIONAL INFORMATION

Activity

  1. ryanpetrello commented on May 31, 2019

    @ryanpetrello
    Contributor

    I'm able to reproduce this:

    image

  2. fosterseth commented on Sep 16, 2019

    @fosterseth
    Member

    the error occurs if a number is present anywhere in the top-level domain portion of the url, e.g. .so3, s3o, 3so, etc.

    the full url is validated using the built-in django URLValidator, which checks against a pre-defined reg expression to make sure the string looks like a valid url
    (https://docs.djangoproject.com/en/2.2/ref/validators/#urlvalidator)

    one workaround would be to replace any given url top level domain portion with something we know works, e.g. replace
    ldap://servername.cotoso.coto.so3:389
    with
    ldap://servername.cotoso.coto.com:389

    and sending that into the run_validations() method. That way it checks the validity of the rest of the url and url structure without getting hung up on the top level domain

    another option is to write a custom regex and send that into the validator

    or we can simply disallow non-conventional urls and give the user a more detailed error message instead of the generic 400

    or, we can remove this particular URLValidator altogether so the check never occurs.

  3. fosterseth commented on Sep 16, 2019

    @fosterseth
    Member
  4. kdelee commented on Sep 20, 2019

    @kdelee
    Member

    Tested out with a variety of different URIs, I'm happy with the unit test coverage that was added. Thanks!

  5. self-assigned this
    on Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions