From 4638cd713dcdd007cd7f49b9a95fa62ac7823e7c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 15 Nov 2022 14:41:55 +0100 Subject: Don't inject untrusted input Even if it's already checked in middlewares It's better to have safe modals too --- shared/core-utils/common/index.ts | 1 + shared/core-utils/common/number.ts | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 shared/core-utils/common/number.ts (limited to 'shared/core-utils') diff --git a/shared/core-utils/common/index.ts b/shared/core-utils/common/index.ts index 720977ead..8d63ee1b2 100644 --- a/shared/core-utils/common/index.ts +++ b/shared/core-utils/common/index.ts @@ -2,6 +2,7 @@ export * from './array' export * from './random' export * from './date' export * from './env' +export * from './number' export * from './object' export * from './path' export * from './regexp' diff --git a/shared/core-utils/common/number.ts b/shared/core-utils/common/number.ts new file mode 100644 index 000000000..9a96dcf5c --- /dev/null +++ b/shared/core-utils/common/number.ts @@ -0,0 +1,7 @@ +function forceNumber (value: any) { + return parseInt(value + '') +} + +export { + forceNumber +} -- cgit v1.2.3