Skip to content

Conversation

@BrianRaymond800
Copy link

Description

This PR contains work completed by @pogoco26 and @CamClendenon, which added a Content Security Policy to OED. Information about their work can be found in PR #1484. Since then, the code from that PR has been updated by @BrianRaymond800 to contain more comments, clarification, and general cleanup.

Type of change

  • Note merging this changes the database configuration.
  • This change requires a documentation update

Checklist

(Note what you have done by placing an "x" instead of the space in the [ ] so it becomes [x]. It is hoped you do all of them.)

  • I have followed the OED pull request ideas
  • I have removed text in ( ) from the issue request
  • You acknowledge that every person contributing to this work has signed the OED Contributing License Agreement and each author is listed in the Description section.

Limitations

I am not aware of any limitations, besides those that were listed in the original PR.

@huss huss mentioned this pull request Feb 2, 2026
5 tasks
Copy link
Member

@huss huss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks to @BrianRaymond800 for updating this work.

  • There is a merge conflict in a file. I also think the branch may be out of date. Please carefully merge in development.
  • When I run OED and look in the web browser console, I see a number of security content msgs. These need to be figured out. I don't know if it relates to the commented out code that was removed as noted in a comment.
  • I've added some comments to consider.

@@ -0,0 +1,13 @@
//imports the createSche function from React's Emotion library
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it createSche or createCache? However, OED does not usually put in import comments like this so okay for it to be removed.

import createCache from '@emotion/cache';

//creates the nonce for the script being run
//he nonce works alongside the webpack_nonce and plotly_nonce to protect against unwated scripts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

he -> The. unwated -> unwanted.

* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

//these lines take the nonce, and create the webpack and plotly nonces from it
//these are additional nonces that contribute to styling with webpacvk and plotly
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

webpacvk -> webpack.

throw err;
}
};
import 'bootstrap/dist/css/bootstrap.css';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OED normally puts all imports at the top of the file. What about moving these and the two below to the top?

<title>Open Energy Dashboard</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are extra spaces at the start of this line and some others. VSC command to format document should fix this up.

const conversions = require('./routes/conversions');
const ciks = require('./routes/ciks');

const crypto = require('node:crypto')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove blank link above this line and put a semicolon at the end of the line.

let htmlPlusData = html.toString().replace('SUBDIR', subdir);

//assigns a value to the nonce in order to check for authenticity
const nonce = crypto.randomBytes(16).toString('base64url')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and following lines should end with a semicolon.

rules: [
// All TypeScript ('.ts' or '.tsx') will be handled by 'awesome-typescript-loader'.
{ test: /\.[jt]sx?$/, exclude: /node_modules/, use: 'ts-loader' },
{ test: /\.[jt]sx?$/, exclude: /node_modules/, use: 'ts-loader'},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The space before the final } was removed but should be there. There are some other formatting issues so doing format document to fix (even though there before this wor) would be nice.

* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

//these lines take the nonce, and create the webpack and plotly nonces from it
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and next line have an extra space at the start.

multiple sites as an exceptions would be : img-src 'self' http://example.com https://site_example.net; becomes img-src 'self'
http://example.com https://site_example.net https://newException.com;
-->

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A number of commented out lines were removed here from the original PR. I wanted to check if they had any value or were examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants