Skip to content

Commit 60924f0

Browse files
authored
fix: Revert "feat: Enable CSP with nonce for Helix 5 (#773)" (#815)
This reverts commit faa5e78.
1 parent e6d2c13 commit 60924f0

36 files changed

+3
-1236
lines changed

package-lock.json

Lines changed: 1 addition & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"mdast-util-to-string": "4.0.0",
5858
"micromark-util-subtokenize": "2.0.4",
5959
"mime": "4.0.6",
60-
"parse5-html-rewriting-stream": "7.0.0",
6160
"rehype-format": "5.0.1",
6261
"rehype-parse": "9.0.1",
6362
"remark-parse": "11.0.0",

src/html-pipe.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ export async function htmlPipe(state, req) {
149149

150150
if (state.content.sourceBus === 'code' || state.info.originalExtension === '.md') {
151151
state.timer?.update('serialize');
152-
await setCustomResponseHeaders(state, req, res);
153152
await renderCode(state, req, res);
154153
} else {
155154
state.timer?.update('parse');
@@ -166,14 +165,14 @@ export async function htmlPipe(state, req) {
166165
await createPictures(state);
167166
await extractMetaData(state, req);
168167
await addHeadingIds(state);
169-
await setCustomResponseHeaders(state, req, res);
170168
await render(state, req, res);
171169
state.timer?.update('serialize');
172170
await tohtml(state, req, res);
173171
await applyMetaLastModified(state, res);
174172
}
175173

176174
setLastModified(state, res);
175+
await setCustomResponseHeaders(state, req, res);
177176
await setXSurrogateKeyHeader(state, req, res);
178177
} catch (e) {
179178
res.error = e.message;

src/steps/csp.js

Lines changed: 0 additions & 214 deletions
This file was deleted.

src/steps/fetch-404.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212
import { extractLastModified, recordLastModified } from '../utils/last-modified.js';
13-
import { contentSecurityPolicyOnCode } from './csp.js';
1413
import { computeContentPathKey, computeCodePathKey } from './set-x-surrogate-key-header.js';
1514

1615
/**
@@ -35,7 +34,6 @@ export default async function fetch404(state, req, res) {
3534

3635
// keep 404 response status
3736
res.body = ret.body;
38-
contentSecurityPolicyOnCode(state, res);
3937
res.headers.set('last-modified', ret.headers.get('last-modified'));
4038
res.headers.set('content-type', 'text/html; charset=utf-8');
4139
}

src/steps/render-code.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212
import mime from 'mime';
13-
import {
14-
contentSecurityPolicyOnCode,
15-
} from './csp.js';
1613

1714
const CHARSET_RE = /charset=([^()<>@,;:"/[\]?.=\s]*)/i;
1815

@@ -35,6 +32,4 @@ export default async function renderCode(state, req, res) {
3532
}
3633
}
3734
res.headers.set('content-type', contentType);
38-
39-
contentSecurityPolicyOnCode(state, res);
4035
}

src/steps/render.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { h } from 'hastscript';
1515
import { unified } from 'unified';
1616
import rehypeParse from 'rehype-parse';
1717
import { cleanupHeaderValue } from '@adobe/helix-shared-utils';
18-
import { contentSecurityPolicyOnAST } from './csp.js';
1918

2019
function appendElement($parent, $el) {
2120
if ($el) {
@@ -103,7 +102,6 @@ export default async function render(state, req, res) {
103102
const $headHtml = await unified()
104103
.use(rehypeParse, { fragment: true })
105104
.parse(headHtml);
106-
contentSecurityPolicyOnAST(res, $headHtml);
107105
$head.children.push(...$headHtml.children);
108106
}
109107

0 commit comments

Comments
 (0)