Page MenuHomePhabricator

[keyserver] Fix importJSON environmental variables to avoid special chars in name
ClosedPublic

Authored by ashoat on Jun 1 2022, 1:29 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 27, 11:34 AM
Unknown Object (File)
Thu, Dec 19, 3:15 PM
Unknown Object (File)
Thu, Dec 19, 11:10 AM
Unknown Object (File)
Thu, Dec 19, 9:07 AM
Unknown Object (File)
Mon, Dec 16, 1:13 AM
Unknown Object (File)
Sat, Dec 7, 9:04 AM
Unknown Object (File)
Oct 28 2024, 3:03 AM
Unknown Object (File)
Oct 28 2024, 3:03 AM

Details

Summary

I did not test D4102 well enough. When I actually got around to using it, I realized that placing special characters like / and . in environmental variable names does not work.

This diff does two things:

  1. Makes sure we don't have any special chars in the names of the environmental variables
  2. It improves the security by limiting access to facts and keyserver directories (assuming we can trust Flow)
Test Plan

I configured a .env that uses importJSON like this:

COMM_MYSQL_DATABASE=commdev
COMM_MYSQL_USER=commdev
COMM_MYSQL_PASSWORD=pass
COMM_JSONCONFIG_facts_landing_url='{"baseDomain":"http://localhost","basePath":"/commlanding/","baseRoutePath":"/commlanding/","https":false}'
COMM_JSONCONFIG_facts_commapp_url='{"baseDomain":"http://localhost","basePath":"/comm/","https":false,"baseRoutePath":"/comm/"}'

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ashoat requested review of this revision.Jun 1 2022, 1:36 AM
atul added inline comments.
keyserver/src/utils/import-json.js
32 ↗(On Diff #13264)

Guessing that we're prefixing the ENV name with COMM_JSONCONFIG to avoid potential collisions with other environment variables?

This revision is now accepted and ready to land.Jun 1 2022, 6:45 AM
keyserver/src/utils/import-json.js
32 ↗(On Diff #13264)

Yup!