JIT
securing code for product attribute management
Secure this code let aMTCompType = modelData?.ProductAttributes?.filter(x=>x.Id === 'aMTCompType')[0]?.Value; if(aMTCompType){ let cMTCompType = cds.configurator.runtime.attributes['aMTCompType'].getValue(); if(!cMTCompType || (cMTCompType[0].id !== aMTCompType)) cds.configurator.runtime.attributes['aMTCompType'].setValue(aMTCompType); } let aLTCompType = modelData?.ProductAttributes?.filter(x=>x.Id === 'aLTCompType')[0]?.Value; if(aLTCompType) { let cLTCompType = cds.configurator.runtime.attributes['aLTCompType'].getValue(); if(!cLTCompType || (cLTCompType[0].id !== aLTCompType)) cds.configurator.runtime.attributes['aLTCompType'].setValue(aLTCompType); }

Here's the secured version of your code with proper null checks and type safety:

Updated files
v1