Skip to content

Commit cf9245a

Browse files
ssafayetdplewis
authored andcommitted
Added warning for special URL sensitive characters for appId (#6159)
* Added warning for special url sensitive characters for appId * refactored and added test case
1 parent f50f8be commit cf9245a

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

spec/index.spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ describe('server', () => {
2626
});
2727
});
2828

29+
it('show warning if any reserved characters in appId', done => {
30+
spyOn(console, 'warn').and.callThrough();
31+
reconfigureServer({ appId: 'test!-^' }).then(() => {
32+
expect(console.warn).toHaveBeenCalled();
33+
return done();
34+
});
35+
});
36+
2937
it('support http basic authentication with masterkey', done => {
3038
reconfigureServer({ appId: 'test' }).then(() => {
3139
request({

src/ParseServer.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,16 @@ function injectDefaults(options: ParseServerOptions) {
376376
options.serverURL = `http://localhost:${options.port}${options.mountPath}`;
377377
}
378378

379+
// Reserved Characters
380+
if (options.appId) {
381+
const regex = /[!#$%'()*+&/:;=?@[\]{}^,|<>]/g;
382+
if (options.appId.match(regex)) {
383+
console.warn(
384+
`\nWARNING, appId that contains special characters can cause issues while using with urls.\n`
385+
);
386+
}
387+
}
388+
379389
// Backwards compatibility
380390
if (options.userSensitiveFields) {
381391
/* eslint-disable no-console */

0 commit comments

Comments
 (0)