fixup! implement CSP, remove commercial supporters from about section
Some checks failed
Publish Docker image / Build (push) Successful in 4m39s
Lint / pnpm_install (push) Successful in 1m36s
Test (production install and build) / production (20.16.0) (push) Successful in 1m12s
Test (backend) / unit (20.16.0) (push) Successful in 6m53s
Test (backend) / e2e (20.16.0) (push) Failing after 12m11s
Lint / lint (backend) (push) Successful in 2m34s
Lint / lint (frontend) (push) Successful in 2m30s
Lint / lint (frontend-embed) (push) Successful in 2m30s
Lint / lint (frontend-shared) (push) Successful in 2m34s
Lint / lint (misskey-bubble-game) (push) Successful in 2m30s
Lint / lint (misskey-js) (push) Successful in 2m25s
Lint / lint (misskey-reversi) (push) Successful in 2m28s
Lint / lint (sw) (push) Successful in 2m31s
Lint / typecheck (backend) (push) Successful in 2m8s
Lint / typecheck (misskey-js) (push) Has been cancelled
Lint / typecheck (sw) (push) Has been cancelled
Some checks failed
Publish Docker image / Build (push) Successful in 4m39s
Lint / pnpm_install (push) Successful in 1m36s
Test (production install and build) / production (20.16.0) (push) Successful in 1m12s
Test (backend) / unit (20.16.0) (push) Successful in 6m53s
Test (backend) / e2e (20.16.0) (push) Failing after 12m11s
Lint / lint (backend) (push) Successful in 2m34s
Lint / lint (frontend) (push) Successful in 2m30s
Lint / lint (frontend-embed) (push) Successful in 2m30s
Lint / lint (frontend-shared) (push) Successful in 2m34s
Lint / lint (misskey-bubble-game) (push) Successful in 2m30s
Lint / lint (misskey-js) (push) Successful in 2m25s
Lint / lint (misskey-reversi) (push) Successful in 2m28s
Lint / lint (sw) (push) Successful in 2m31s
Lint / typecheck (backend) (push) Successful in 2m8s
Lint / typecheck (misskey-js) (push) Has been cancelled
Lint / typecheck (sw) (push) Has been cancelled
Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
parent
3fcea3eeb6
commit
2419a9f740
6 changed files with 27 additions and 21 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "misskey",
|
||||
"version": "2024.11.0-yumechinokuni.3",
|
||||
"version": "2024.11.0-yumechinokuni.3p2",
|
||||
"codename": "nasubi",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -34,6 +34,7 @@ import Logger from '@/logger.js';
|
|||
import { StatusError } from '@/misc/status-error.js';
|
||||
import type { ServerResponse } from 'node:http';
|
||||
import type { FastifyInstance } from 'fastify';
|
||||
import { commonPugFilters } from '../pug-filters.js';
|
||||
|
||||
// TODO: Consider migrating to @node-oauth/oauth2-server once
|
||||
// https://github.com/node-oauth/node-oauth2-server/issues/180 is figured out.
|
||||
|
@ -391,6 +392,9 @@ export class OAuth2ProviderService {
|
|||
version: this.config.version,
|
||||
config: this.config,
|
||||
},
|
||||
options: {
|
||||
filters: commonPugFilters,
|
||||
},
|
||||
});
|
||||
|
||||
await fastify.register(fastifyExpress);
|
||||
|
|
12
packages/backend/src/server/pug-filters.ts
Normal file
12
packages/backend/src/server/pug-filters.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
export const commonPugFilters = {
|
||||
dataTag: (data: string, options: { tagName: string, mimeType: string }) => {
|
||||
if (!/^[a-z]+$/.test(options.tagName)) {
|
||||
throw new Error('Invalid tagName');
|
||||
}
|
||||
if (/[;'"]/.test(options.mimeType)) {
|
||||
throw new Error('Invalid mimeType');
|
||||
}
|
||||
const dataURI = `data:${options.mimeType};base64,${Buffer.from(data).toString('base64')}`;
|
||||
return `<${options.tagName} data="${dataURI}"></${options.tagName}>`;
|
||||
}
|
||||
} as const;
|
|
@ -69,6 +69,7 @@ import type { FastifyInstance, FastifyPluginOptions, FastifyReply } from 'fastif
|
|||
import { makeHstsHook } from '../hsts.js';
|
||||
import { generateCSP } from '../csp.js';
|
||||
import { appendQuery, query } from '@/misc/prelude/url.js';
|
||||
import { commonPugFilters } from '../pug-filters.js';
|
||||
|
||||
const _filename = fileURLToPath(import.meta.url);
|
||||
const _dirname = dirname(_filename);
|
||||
|
@ -322,19 +323,8 @@ export class ClientServerService {
|
|||
config: this.config,
|
||||
},
|
||||
options: {
|
||||
filters: {
|
||||
dataTag: (data: string, options: { tagName: string, mimeType: string }) => {
|
||||
if (!/^[a-z]+$/.test(options.tagName)) {
|
||||
throw new Error('Invalid tagName');
|
||||
}
|
||||
if (/[;'"]/.test(options.mimeType)) {
|
||||
throw new Error('Invalid mimeType');
|
||||
}
|
||||
const dataURI = `data:${options.mimeType};base64,${Buffer.from(data).toString('base64')}`;
|
||||
return `<${options.tagName} data="${dataURI}"></${options.tagName}>`;
|
||||
}
|
||||
}
|
||||
}
|
||||
filters: commonPugFilters,
|
||||
},
|
||||
});
|
||||
|
||||
fastify.addHook('onRequest', (request, reply, done) => {
|
||||
|
|
|
@ -2,9 +2,9 @@ block vars
|
|||
|
||||
block loadClientEntry
|
||||
- const entry = config.frontendEntry
|
||||
- const styleCSS = config.cspPrerenderedContent['style.embed.css']
|
||||
- const bootJS = config.cspPrerenderedContent['boot.embed.js']
|
||||
- const jsPrelude = config.cspPrerenderedContent['baseHtmlJSPrelude']
|
||||
- const styleCSS = config.cspPrerenderedContent.get('style.css');
|
||||
- const jsPrelude = config.cspPrerenderedContent.get('.prelude.js');
|
||||
- const bootJS = config.cspPrerenderedContent.get('boot.js');
|
||||
|
||||
doctype html
|
||||
|
||||
|
|
Loading…
Reference in a new issue