addons icon indicating copy to clipboard operation
addons copied to clipboard

Ensure that secrets cannot be leaked into client-side bundles.

Open muffinresearch opened this issue 8 years ago • 4 comments

We currently split out client keys by virtue of a client-only config [1] which is a stand-in for the config module used under node this relies on the webpack define plugin.

Whilst we have tests for how that it setup we don't have anything that can provide a cast-iron guarantee that secrets exposed via the config in [2] (Most likely overriden via env vars through [3] ) that they wouldn't end up in client-side code.

One solution would be to add tests to make sure no code from config is found in the built bundles.

A better solution might be to never configure secrets via the general config modules since they are shared (albeit to a limited degree) and to instead rely on some kind of config which will only run on the server?

[1] https://github.com/mozilla/addons-frontend/blob/master/src/core/client/config.js [2] https://github.com/mozilla/addons-frontend/tree/master/config [3] https://github.com/mozilla/addons-frontend/blob/master/config/custom-environment-variables.json

┆Issue is synchronized with this Jira Task

muffinresearch avatar Nov 21 '16 10:11 muffinresearch

Yeah, maybe we could make a literal serverConfig object which is isolated from any other config. If some value is only needed on the server then it doesn't need to be available elsewhere. For example, serverPort and serverHost don't need to be in any shared config.

kumar303 avatar Nov 21 '16 15:11 kumar303

Here is a lint rule that will help achieve this goal: https://github.com/mozilla/addons/issues/2017

kumar303 avatar Mar 21 '17 14:03 kumar303

Maybe superceded by https://github.com/mozilla/addons/issues/10396

muffinresearch avatar Feb 06 '18 20:02 muffinresearch

Old Jira Ticket: https://mozilla-hub.atlassian.net/browse/ADDFRNT-113

KevinMind avatar May 03 '24 18:05 KevinMind