MCPcopy Create free account
hub / github.com/adobe/Marinus / is_valid_strings

Function is_valid_strings

web_server/routes/cloud_services.js:33–45  ·  view source on GitHub ↗

* Confirm that all parameters are a string and not an array. * This helps prevent NoSQL injection since NoSQL will honor arrays as parameters. * @param {*} req The Express request.query object representing the GET parameters.

(params)

Source from the content-addressed store, hash-verified

31 * @param {*} req The Express request.query object representing the GET parameters.
32 */
33function is_valid_strings(params) {
34 for (var prop in params) {
35 if (Object.hasOwn(params, prop)) {
36 if (typeof params[prop] != "string") {
37 return false;
38 }
39 if (params[prop].includes("[") || params[prop].includes["$"] || params[prop].includes["{"]) {
40 return false;
41 }
42 }
43 }
44 return true;
45}
46
47/* eslint-disable-next-line no-unused-vars */
48export default function cloudServicesRouter(envConfig) {

Callers 1

cloudServicesRouterFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected