@sjcrh/proteinpaint-server 2.211.0 → 2.212.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -178,7 +178,19 @@ if (serverconfig.debugmode && !serverconfig.binpath.includes('sjcrh/')) {
178
178
  serverconfig.routeSetters = routeSetters
179
179
  }
180
180
 
181
- if (typeof serverconfig.dsCredentials == 'string') {
181
+ if (process.env.PP_CREDS) {
182
+ // preferred over a dsCredentials file path, so that the server process does not need
183
+ // read access to a credentials file that a path traversal bug could expose;
184
+ // see container/envHelpers.mjs for how to set this env variable from a file
185
+ try {
186
+ serverconfig.dsCredentials = JSON.parse(process.env.PP_CREDS)
187
+ } catch {
188
+ // do not include the parse error message, since it may quote part of the credentials
189
+ throw `invalid JSON in process.env.PP_CREDS`
190
+ }
191
+ // not inherited by spawned child processes, and not exposed by any code that reads process.env later
192
+ delete process.env.PP_CREDS
193
+ } else if (typeof serverconfig.dsCredentials == 'string') {
182
194
  const dsCredentialsFile = serverconfig.dsCredentials
183
195
  try {
184
196
  const json = fs.readFileSync(dsCredentialsFile, { encoding: 'utf8' })