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)
Mon, Oct 28, 3:03 AM
Unknown Object (File)
Mon, Oct 28, 3:03 AM
Unknown Object (File)
Mon, Oct 28, 3:02 AM
Unknown Object (File)
Mon, Oct 28, 2:49 AM
Unknown Object (File)
Sat, Oct 26, 7:34 PM
Unknown Object (File)
Fri, Oct 25, 8:39 AM
Unknown Object (File)
Fri, Oct 25, 8:38 AM
Unknown Object (File)
Oct 5 2024, 1:40 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!