🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

lightning-flow-scanner-core

Package Overview
Dependencies
Maintainers
0
Versions
281
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lightning-flow-scanner-core - npm Package Compare versions

Comparing version

to
4.18.1

2

main/rules/HardcodedId.js

@@ -1,1 +0,1 @@

import IdPrefixes from"../data/IdPrefixes.js";import{RuleCommon}from"../models/RuleCommon.js";import*as core from"../internals/internals.js";export class HardcodedId extends RuleCommon{execute(flow){const prefixes=IdPrefixes.ids.map(prefix=>{return prefix["Key Prefix"]});const nodesWithHardcodedIds=[];const customPrefixes=new Array(100);for(let i=0;i<customPrefixes.length;i++){const prefix=(""+i).length===1?"a0"+String(i):"a"+String(i);prefixes.push(prefix)}for(const prefix of prefixes){const match18charIds=new RegExp("\\b"+prefix+"\\w{15}\\b");const match15charIds=new RegExp("\\b"+prefix+"\\w{12}\\b");for(const node of flow.elements){const nodeString=JSON.stringify(node);const hardcodedIdsL18=nodeString.match(match18charIds);const hardcodedIdsL15=nodeString.match(match15charIds);if(hardcodedIdsL15||hardcodedIdsL18){nodesWithHardcodedIds.push(node)}}}const results=[];for(const det of nodesWithHardcodedIds){results.push(new core.ResultDetails(det))}return new core.RuleResult(this,results)}constructor(){super({name:"HardcodedId",label:"Hardcoded Id",description:"Avoid hard-coding IDs as they are org-specific. Instead, pass them into variables at the start of the flow. You can achieve this by utilizing merge fields in URL parameters or employing a Get Records element.",supportedTypes:core.FlowType.allTypes(),docRefs:[{label:"Flow Best Practices",path:"https://help.salesforce.com/s/articleView?id=sf.flow_prep_bestpractices.htm&type=5"},{label:"Don't hard code Record Type IDs in Flow. By Stephen Church.",path:"https://www.linkedin.com/feed/update/urn:li:activity:6947530300012826624/?updateEntityUrn=urn%3Ali%3Afs_feedUpdate%3A%28V2%2Curn%3Ali%3Aactivity%3A6947530300012826624%29"}],isConfigurable:false,autoFixable:false})}}
import{RuleCommon}from"../models/RuleCommon.js";import*as core from"../internals/internals.js";export class HardcodedId extends RuleCommon{execute(flow){const nodesWithHardcodedIds=[];const salesforceIdRegex=/\b[a-zA-Z0-9]{5}0[a-zA-Z0-9]{9}([a-zA-Z0-9]{3})?\b/g;for(const node of flow.elements){const nodeString=JSON.stringify(node);if(salesforceIdRegex.test(nodeString)){nodesWithHardcodedIds.push(node)}}const results=nodesWithHardcodedIds.map(node=>new core.ResultDetails(node));return new core.RuleResult(this,results)}constructor(){super({name:"HardcodedId",label:"Hardcoded Id",description:"Avoid hard-coding IDs as they are org-specific. Instead, pass them into variables at the start of the flow. You can achieve this by utilizing merge fields in URL parameters or employing a Get Records element.",supportedTypes:core.FlowType.allTypes(),docRefs:[{label:"Flow Best Practices",path:"https://help.salesforce.com/s/articleView?id=sf.flow_prep_bestpractices.htm&type=5"},{label:"Don't hard code Record Type IDs in Flow. By Stephen Church.",path:"https://www.linkedin.com/feed/update/urn:li:activity:6947530300012826624/?updateEntityUrn=urn%3Ali%3Afs_feedUpdate%3A%28V2%2Curn%3Ali%3Aactivity%3A6947530300012826624%29"}],isConfigurable:false,autoFixable:false})}}
{
"name": "lightning-flow-scanner-core",
"version": "4.17.0",
"version": "4.18.1",
"main": "index.js",

@@ -47,3 +47,3 @@ "types": "index.d.ts",

"@types/semantic-release": "20.0.6",
"eslint": "9.20.1",
"eslint": "9.21.0",
"eslint-plugin-jest": "28.11.0",

@@ -50,0 +50,0 @@ "husky": "9.1.7",