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
F2138421: D4171.id13280.diff
Fri, Jun 28, 10:36 PM
Unknown Object (File)
Wed, Jun 26, 11:15 PM
Unknown Object (File)
Wed, Jun 26, 4:07 PM
Unknown Object (File)
Tue, Jun 25, 12:27 AM
Unknown Object (File)
Sun, Jun 16, 3:18 PM
Unknown Object (File)
Sun, Jun 16, 3:17 PM
Unknown Object (File)
Sun, Jun 16, 3:14 PM
Unknown Object (File)
Sun, Jun 16, 2:32 PM

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!