New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(orc8r): Sanitizing user input on N/W creation #15370
base: master
Are you sure you want to change the base?
Conversation
Thanks for opening a PR! 💯
Howto
More infoPlease take a moment to read through the Magma project's
If this is your first Magma PR, also consider reading
|
✔️ The Semantic PR check ended with status success. See instructions on formatting your commit and pull request titles. |
nms/server/network/routes.ts
Outdated
res | ||
.status(400) | ||
.send(`Unsupported network type ${data.networkType}`) | ||
.send(`Unsupported network type}`) | ||
.end(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Replace ⏎············.status(400)⏎············.send(
Unsupported·network·type})⏎············
with .status(400).send(
Unsupported·network·type})
res | |
.status(400) | |
.send(`Unsupported network type ${data.networkType}`) | |
.send(`Unsupported network type}`) | |
.end(); | |
res.status(400).send(`Unsupported network type}`).end(); |
a1b194e
to
8bb8f56
Compare
nms/server/network/routes.ts
Outdated
res | ||
.status(400) | ||
.send(`Unsupported network type ${data.networkType}`) | ||
.send(`Unsupported network type`) | ||
.end(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Replace ⏎············.status(400)⏎············.send(
Unsupported·network·type)⏎············
with .status(400).send(
Unsupported·network·type)
res | |
.status(400) | |
.send(`Unsupported network type ${data.networkType}`) | |
.send(`Unsupported network type`) | |
.end(); | |
res.status(400).send(`Unsupported network type`).end(); |
8bb8f56
to
05cd710
Compare
nms/server/network/routes.ts
Outdated
const allowedNetworkTypes = ['LTE', 'FEG_LTE', 'CWF', 'FEG']; | ||
|
||
if (!allowedNetworkTypes.includes(data.networkType?.toUpperCase())) { | ||
const allowedNetworkTypes: typeof data["networkType"][] = [LTE, FEG_LTE, CWF, FEG]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [eslint] <@typescript-eslint/array-type> reported by reviewdog 🐶
Array type using 'T[]' is forbidden. Use 'Array' instead.
const allowedNetworkTypes: typeof data["networkType"][] = [LTE, FEG_LTE, CWF, FEG]; | |
const allowedNetworkTypes: Array<typeof data["networkType"]> = [LTE, FEG_LTE, CWF, FEG]; |
nms/server/network/routes.ts
Outdated
const allowedNetworkTypes = ['LTE', 'FEG_LTE', 'CWF', 'FEG']; | ||
|
||
if (!allowedNetworkTypes.includes(data.networkType?.toUpperCase())) { | ||
const allowedNetworkTypes: typeof data["networkType"][] = [LTE, FEG_LTE, CWF, FEG]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Replace "networkType"][]·=·[LTE,·FEG_LTE,·CWF,·FEG
with 'networkType'][]·=·[⏎········LTE,⏎········FEG_LTE,⏎········CWF,⏎········FEG,⏎······
const allowedNetworkTypes: typeof data["networkType"][] = [LTE, FEG_LTE, CWF, FEG]; | |
const allowedNetworkTypes: typeof data['networkType'][] = [ | |
LTE, | |
FEG_LTE, | |
CWF, | |
FEG, | |
]; |
nms/server/network/routes.ts
Outdated
|
||
if (!allowedNetworkTypes.includes(data.networkType?.toUpperCase())) { | ||
const allowedNetworkTypes: typeof data["networkType"][] = [LTE, FEG_LTE, CWF, FEG]; | ||
if (!allowedNetworkTypes.includes((data.networkType))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Replace (data.networkType)
with data.networkType
if (!allowedNetworkTypes.includes((data.networkType))) { | |
if (!allowedNetworkTypes.includes(data.networkType)) { |
05cd710
to
dd7e5e4
Compare
nms/server/network/routes.ts
Outdated
const allowedNetworkTypes = ['LTE', 'FEG_LTE', 'CWF', 'FEG']; | ||
|
||
if (!allowedNetworkTypes.includes(data.networkType?.toUpperCase())) { | ||
const allowedNetworkTypes: Array<typeof data['networkType']> = [LTE, FEG_LTE, CWF, FEG]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Replace LTE,·FEG_LTE,·CWF,·FEG
with ⏎········LTE,⏎········FEG_LTE,⏎········CWF,⏎········FEG,⏎······
const allowedNetworkTypes: Array<typeof data['networkType']> = [LTE, FEG_LTE, CWF, FEG]; | |
const allowedNetworkTypes: Array<typeof data['networkType']> = [ | |
LTE, | |
FEG_LTE, | |
CWF, | |
FEG, | |
]; |
dd7e5e4
to
af708ca
Compare
Signed-off-by: jahid-wavelabs <jahidul.mallick@wavelabs.ai>
af708ca
to
42ba9db
Compare
Fixes security issues #159
Summary
The current implementation includes sanitization of network inputs through the use of predefined
allowedNetworkTypes
. To enhance clarity and efficiency, this modification involves removing the reference todata.networkType
from the else section.Test Plan
This change was validated manually by deliberately sending a web-inject script. The testing process confirmed that the input is effectively filtered, and the system appropriately responds with an error.