-
Notifications
You must be signed in to change notification settings - Fork 512
Limit configuration available publicly in config.json #5045
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| ].join(''); | ||
| }; | ||
|
|
||
| const removeServerSideConfig = (config: AppConfig): any => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aryakoste : Please add an inline comment above this to describe why we're doing this. It could be something like this:
/**
* Removes all server-side specific settings from the application configuration.
* This method is used to ensure the "assets/config.json" that provides runtime
* configuration to CSR (client side rendering) excludes these server-side keys.
*
* @param config the application configuration
*/
| const clientConfig = JSON.parse(JSON.stringify(config)); | ||
| delete clientConfig.rest.ssrBaseUrl; | ||
| delete clientConfig.rest.hasSsrBaseUrl; | ||
| delete clientConfig.cache.serverSide; | ||
| delete clientConfig.ui.rateLimiter; | ||
| delete clientConfig.ui.useProxies; | ||
| return clientConfig; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be inverted to only return client config properties (instead of deleting server properties)? In the case that a config property is added in the future without someone knowing about this vulnerability, it should default to not being in the client config.
References
config.json#5030Description
Successfully 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
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)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.