progress / JSDO

Client side TypeScript library to access Progress® Data Object Services
Other
23 stars 27 forks source link

Basic auth issue with passwords that contain international characters #231

Closed radu2501 closed 5 years ago

radu2501 commented 5 years ago

When using Basic Authentication, in a node.js environment, passwords and/or usernames that contain special characters do not get properly base-64 encoded.

I have debugged this and the issue is caused by the base-64 module that is required when in the context of a node.js or NativeScript environment.

For node.js, one could use the following function instead of require('base-64').encode, which works nicely:

base64 = function(str) { return Buffer.from(str).toString('base64'); }
edselg commented 5 years ago

Hello Radu,

Thank you for reporting this issue and providing the reference to the toString() API in Node.js.

I took a look at this and it seems that that issue is not specifically caused by the base-64 module but by the btoa() API only expecting ASCII characters:

The following thread at Stack Overflow provide info on BASIC Authentication and mentions about the old RFC 2617 and the new RFC7617:

RFC 7617 indicates that a charset="UTF-8" auth parameter can be sent in its challenge to indicate the character encoding expected by the agent:

I think that should look into honoring the charset parameter. However, this also depends on the backend that you are using.

What are you using on the backend? PASOE?

Thank you.

edselg commented 5 years ago

The Node.js API toString("base64") seems to be equivalent to the utoa() API from the notes in the btoa() article:

mikefechner commented 5 years ago

What are you using on the backend? PASOE?

PASOE, of course. Is there any other backend ;-)

edselg commented 5 years ago

Great.

PASOE of course. :-)

Thank you for the info.

zerovian commented 5 years ago

Progress internal issue # OCTA-11854

zerovian commented 5 years ago

Closing as this is fixed in jsdo-core release 6.0.1.