Skip to content

AEM Password with special characters wont work #72

@hputman-icrossing

Description

@hputman-icrossing

If your AEM password has special characters it that require urlencoding, they don't get decoded before passing to AEM. For example if your password is st@r-P0wer you'd set your target to: http://admin:st%40r-P0wer@localhost:4502. The code to post to AEM uses URL.password to pull that password out of the URL and pass it as an http basic authentication header. According to the docs: The password is percent-encoded when setting but not percent-decoded when reading. so %40 gets sent in the password to AEM. The relevant code from index.js is below:

    const urlObj = new URL(target + packmgrPath)
    const url = urlObj.origin + urlObj.pathname
    const fetchArgs = { method: 'POST', body: form }
    if (urlObj.password) {
      const credentials = Buffer.from(`${urlObj.username}:${urlObj.password}`).toString('base64')
      fetchArgs.headers = { Authorization: `Basic ${credentials}` }
    }

The solution would be to call decodeURIComponent on urlObj.password

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions