Remove SSR related configuration from client app#5107
Remove SSR related configuration from client app#5107strawburster wants to merge 2 commits intoDSpace:mainfrom
Conversation
|
I thought of a better way to do this on the train... |
2290c31 to
cd79319
Compare
|
It turns out the way I was thinking was a lot more involved, so I moved it to another PR: #5114 . The idea is that if the config definitions were converted to classes, they could have decorators which declare metadata about each property. I think it's a great long-term solution, however this PR does the bare minimum of removing the sensitive details already. I believe this PR is ready to merge as a short-term solution, and the other needs to be reviewed more. |
45dbe9c to
bcd10e5
Compare
|
I realized that the config was being added to the production ssr server, I've tested manually in production as well now and can't find the sensitive config properties in the html. |
2b0bb89 to
9ca164f
Compare
9ca164f to
955b524
Compare
artlowel
left a comment
There was a problem hiding this comment.
Thanks @strawburster!
I can verify that this works as described.
However, looking at the code, I'm wondering if it really differs from the approach in #5045. If I add a new config property using this PR, it looks like it will still be exposed to the client automatically. Based on your response on #5045, I was expecting an allowlist-style approach where only properties marked explicitly as client-safe are returned. Was that not your goal?
References
config.json#5030Description
Split the configuration. config.server.ts now filters sensitive keys (rest.ssrBaseUrl, cache.serverSide, ui.rateLimiter, ui.useProxies) before writing to assets/config.json. The server process retains the full configuration via the return value of buildAppConfig
This PR is provided (cage-free) by The Library Code
Instructions for Reviewers
Build and run the angular app, look at the network inspector for the download of the config.json. Verify that the sensitive keys like
rest.ssrBaseUrlorui.useProxiesare not included in the json response.List of changes in this PR:
Checklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lintnpm run check-circ-deps)My PR aligns with Accessibility guidelines if it makes changes to the user interface.My PR uses i18n (internationalization) keys instead of hardcoded English text, to allow for translations.If my PR includes new libraries/dependencies (inpackage.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.