Skip to content

Finalized Content Security Policy Fix#1567

Open
BrianRaymond800 wants to merge 18 commits intoOpenEnergyDashboard:developmentfrom
BrianRaymond800:pr-update
Open

Finalized Content Security Policy Fix#1567
BrianRaymond800 wants to merge 18 commits intoOpenEnergyDashboard:developmentfrom
BrianRaymond800:pr-update

Conversation

@BrianRaymond800
Copy link
Copy Markdown

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
Copy Markdown
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.

Comment thread src/client/app/emotionCache.ts Outdated
@@ -0,0 +1,13 @@
//imports the createSche function from React's Emotion library
Copy link
Copy Markdown
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.

Comment thread src/client/app/emotionCache.ts Outdated
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
Copy Markdown
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.

Comment thread src/client/app/index.tsx Outdated
* 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
Copy Markdown
Member

Choose a reason for hiding this comment

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

webpacvk -> webpack.

Comment thread src/client/app/index.tsx Outdated
throw err;
}
};
import 'bootstrap/dist/css/bootstrap.css';
Copy link
Copy Markdown
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?

Comment thread src/client/index.html
<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
Copy Markdown
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.

Comment thread src/server/app.js Outdated
const conversions = require('./routes/conversions');
const ciks = require('./routes/ciks');

const crypto = require('node:crypto')
Copy link
Copy Markdown
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.

Comment thread src/server/app.js Outdated
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
Copy Markdown
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.

Comment thread webpack.config.js
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
Copy Markdown
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.

Comment thread src/client/app/index.tsx Outdated
* 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
Copy Markdown
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.

Comment thread src/client/index.html
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
Copy Markdown
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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

From what I can tell, those lines were an alternate implementation of the CSP that was rejected and replaced with the current one, but never fully removed. That is why I chose to remove it.

BrianRaymond800 pushed a commit to BrianRaymond800/OED that referenced this pull request Apr 5, 2026
…us with owners and upstream PR evidence

• Added Owner column identifying responsible team members for each finding
• Added upstream OpenEnergyDashboard PR references where fixes or work exist
• Corrected Issue OpenEnergyDashboard#6 status to In Progress based on open PR OpenEnergyDashboard#1567
• Clarified findings with no assigned owner or implementation work started
• Improved overall clarity and traceability of security remediation progress
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