CGordon830606 (Community Member) asked a question.

Should the following code be flagged for CWEs? Its loading a script from an outside source, so I assumed this is a problem. There is not a whitelist and the script is just added to the DOM. We don't see any CWEs, but that seems wrong to me. please help

Should the following code be flagged for CWEs? Its loading a script from an outside source, so I assumed this is a problem. There is not a whitelist and the script is just added to the DOM.

 

export function createHubspotForm(portalId, formId, formclass) {

const targetDiv = document.createElement("div");

/* istanbul ignore else */

if (formclass) {

targetDiv.classList.add(formclass);

}

targetDiv.id = formId;

const script = document.createElement("script");

script.src = "//js.hsforms.net/forms/embed/v2.js";

script.charset = "utf-8";

script.async = true;

 

script.onload = function onLoad() {

loadHubspotForm(portalId, formId);

};

document.head.appendChild(script);

return targetDiv;

}


  • CGordon830606 (Community Member)

    please don't just tell me to open a case. I can do that, but would really appreciate community participation if that can happen here

Topics (3)

No articles found
Loading

Ask the Community

Get answers, share a use case, discuss your favorite features, or get input from the community.