@@ -137,12 +137,30 @@ export function getInlinedEnvVars() {
137137 const externalTools = JSON . parse (
138138 readFileSync ( path . join ( rootPath , 'external-tools.json' ) , 'utf-8' ) ,
139139 )
140- const cdxgenVersion = externalTools [ '@cyclonedx/cdxgen' ] ?. version || ''
141- const coanaVersion = externalTools [ '@coana-tech/cli' ] ?. version || ''
142- const pyCliVersion = externalTools [ 'socketsecurity' ] ?. version || ''
143- const pythonBuildTag = externalTools [ 'python' ] ?. buildTag || ''
144- const pythonVersion = externalTools [ 'python' ] ?. version || ''
145- const sfwVersion = externalTools [ 'sfw' ] ?. version || ''
140+
141+ function getExternalToolVersion ( key , field = 'version' ) {
142+ const tool = externalTools [ key ]
143+ if ( ! tool ) {
144+ throw new Error (
145+ `External tool "${ key } " not found in external-tools.json. Please add it to the configuration.` ,
146+ )
147+ }
148+ const value = tool [ field ]
149+ if ( ! value ) {
150+ throw new Error (
151+ `External tool "${ key } " is missing required field "${ field } " in external-tools.json.` ,
152+ )
153+ }
154+ return value
155+ }
156+
157+ const cdxgenVersion = getExternalToolVersion ( '@cyclonedx/cdxgen' )
158+ const coanaVersion = getExternalToolVersion ( '@coana-tech/cli' )
159+ const pyCliVersion = getExternalToolVersion ( 'socketsecurity' )
160+ const pythonBuildTag = getExternalToolVersion ( 'python' , 'buildTag' )
161+ const pythonVersion = getExternalToolVersion ( 'python' )
162+ const sfwVersion = getExternalToolVersion ( 'sfw' )
163+ const socketPatchVersion = getExternalToolVersion ( 'socket-patch' )
146164
147165 // Build-time constants that can be overridden by environment variables.
148166 const publishedBuild =
@@ -166,6 +184,7 @@ export function getInlinedEnvVars() {
166184 INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION : JSON . stringify ( cdxgenVersion ) ,
167185 INLINED_SOCKET_CLI_PYCLI_VERSION : JSON . stringify ( pyCliVersion ) ,
168186 INLINED_SOCKET_CLI_SFW_VERSION : JSON . stringify ( sfwVersion ) ,
187+ INLINED_SOCKET_CLI_SOCKET_PATCH_VERSION : JSON . stringify ( socketPatchVersion ) ,
169188 INLINED_SOCKET_CLI_SYNP_VERSION : JSON . stringify ( synpVersion ) ,
170189 INLINED_SOCKET_CLI_PUBLISHED_BUILD : JSON . stringify (
171190 publishedBuild ? '1' : '' ,
0 commit comments