Added warning for special URL sensitive characters for appId (#6159)
* Added warning for special url sensitive characters for appId * refactored and added test case
This commit is contained in:
committed by
Diamond Lewis
parent
f50f8beb62
commit
cf9245a4a2
@@ -26,6 +26,14 @@ describe('server', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('show warning if any reserved characters in appId', done => {
|
||||||
|
spyOn(console, 'warn').and.callThrough();
|
||||||
|
reconfigureServer({ appId: 'test!-^' }).then(() => {
|
||||||
|
expect(console.warn).toHaveBeenCalled();
|
||||||
|
return done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('support http basic authentication with masterkey', done => {
|
it('support http basic authentication with masterkey', done => {
|
||||||
reconfigureServer({ appId: 'test' }).then(() => {
|
reconfigureServer({ appId: 'test' }).then(() => {
|
||||||
request({
|
request({
|
||||||
|
|||||||
@@ -376,6 +376,16 @@ function injectDefaults(options: ParseServerOptions) {
|
|||||||
options.serverURL = `http://localhost:${options.port}${options.mountPath}`;
|
options.serverURL = `http://localhost:${options.port}${options.mountPath}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reserved Characters
|
||||||
|
if (options.appId) {
|
||||||
|
const regex = /[!#$%'()*+&/:;=?@[\]{}^,|<>]/g;
|
||||||
|
if (options.appId.match(regex)) {
|
||||||
|
console.warn(
|
||||||
|
`\nWARNING, appId that contains special characters can cause issues while using with urls.\n`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Backwards compatibility
|
// Backwards compatibility
|
||||||
if (options.userSensitiveFields) {
|
if (options.userSensitiveFields) {
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
|
|||||||
Reference in New Issue
Block a user