more path sanitization
All checks were successful
Lint / pnpm_install (push) Successful in 2m10s
Publish Docker image / Build (push) Successful in 5m9s
Test (production install and build) / production (22.11.0) (push) Successful in 1m6s
Test (backend) / unit (22.11.0) (push) Successful in 8m54s
Publish Docker image / Build (pull_request) Successful in 4m37s
Lint / pnpm_install (pull_request) Successful in 1m45s
Test (backend) / e2e (22.11.0) (push) Successful in 11m52s
Test (production install and build) / production (22.11.0) (pull_request) Successful in 1m5s
Test (backend) / unit (22.11.0) (pull_request) Successful in 8m25s
Test (backend) / e2e (22.11.0) (pull_request) Successful in 12m16s
Lint / lint (backend) (push) Successful in 2m19s
Lint / lint (frontend) (push) Successful in 2m26s
Lint / lint (frontend-embed) (push) Successful in 2m27s
Lint / lint (frontend-shared) (push) Successful in 2m19s
Lint / lint (misskey-bubble-game) (push) Successful in 2m28s
Lint / lint (misskey-js) (push) Successful in 2m34s
Lint / lint (misskey-reversi) (push) Successful in 2m32s
Lint / lint (sw) (push) Successful in 2m31s
Lint / typecheck (backend) (push) Successful in 2m29s
Lint / typecheck (misskey-js) (push) Successful in 1m39s
Lint / typecheck (sw) (push) Successful in 1m42s
Lint / lint (backend) (pull_request) Successful in 2m33s
Lint / lint (frontend) (pull_request) Successful in 2m27s
Lint / lint (frontend-embed) (pull_request) Successful in 2m28s
Lint / lint (frontend-shared) (pull_request) Successful in 2m27s
Lint / lint (misskey-bubble-game) (pull_request) Successful in 2m28s
Lint / lint (misskey-js) (pull_request) Successful in 2m30s
Lint / lint (misskey-reversi) (pull_request) Successful in 2m30s
Lint / lint (sw) (pull_request) Successful in 2m31s
Lint / typecheck (backend) (pull_request) Successful in 2m28s
Lint / typecheck (misskey-js) (pull_request) Successful in 1m39s
Lint / typecheck (sw) (pull_request) Successful in 1m44s
All checks were successful
Lint / pnpm_install (push) Successful in 2m10s
Publish Docker image / Build (push) Successful in 5m9s
Test (production install and build) / production (22.11.0) (push) Successful in 1m6s
Test (backend) / unit (22.11.0) (push) Successful in 8m54s
Publish Docker image / Build (pull_request) Successful in 4m37s
Lint / pnpm_install (pull_request) Successful in 1m45s
Test (backend) / e2e (22.11.0) (push) Successful in 11m52s
Test (production install and build) / production (22.11.0) (pull_request) Successful in 1m5s
Test (backend) / unit (22.11.0) (pull_request) Successful in 8m25s
Test (backend) / e2e (22.11.0) (pull_request) Successful in 12m16s
Lint / lint (backend) (push) Successful in 2m19s
Lint / lint (frontend) (push) Successful in 2m26s
Lint / lint (frontend-embed) (push) Successful in 2m27s
Lint / lint (frontend-shared) (push) Successful in 2m19s
Lint / lint (misskey-bubble-game) (push) Successful in 2m28s
Lint / lint (misskey-js) (push) Successful in 2m34s
Lint / lint (misskey-reversi) (push) Successful in 2m32s
Lint / lint (sw) (push) Successful in 2m31s
Lint / typecheck (backend) (push) Successful in 2m29s
Lint / typecheck (misskey-js) (push) Successful in 1m39s
Lint / typecheck (sw) (push) Successful in 1m42s
Lint / lint (backend) (pull_request) Successful in 2m33s
Lint / lint (frontend) (pull_request) Successful in 2m27s
Lint / lint (frontend-embed) (pull_request) Successful in 2m28s
Lint / lint (frontend-shared) (pull_request) Successful in 2m27s
Lint / lint (misskey-bubble-game) (pull_request) Successful in 2m28s
Lint / lint (misskey-js) (pull_request) Successful in 2m30s
Lint / lint (misskey-reversi) (pull_request) Successful in 2m30s
Lint / lint (sw) (pull_request) Successful in 2m31s
Lint / typecheck (backend) (pull_request) Successful in 2m28s
Lint / typecheck (misskey-js) (pull_request) Successful in 1m39s
Lint / typecheck (sw) (pull_request) Successful in 1m44s
Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
parent
109d8f8008
commit
3906efa8d5
1 changed files with 36 additions and 6 deletions
|
@ -18,6 +18,42 @@ export function sanitizeRequestURI(uri: string): string {
|
||||||
return '[embed_vite]';
|
return '[embed_vite]';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (uri.startsWith('/emoji/')) {
|
||||||
|
return '/emoji/[emoji]';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uri.startsWith('/identicon/')) {
|
||||||
|
return '/identicon/[identicon]';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uri.startsWith('/tags/')) {
|
||||||
|
return '/tags/[tag]';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uri.startsWith('/user-tags/')) {
|
||||||
|
return '/user-tags/[tag]';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uri.startsWith('/page/')) {
|
||||||
|
return '/page/[page]';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uri.startsWith('/fluent-emoji/')) {
|
||||||
|
return '/fluent-emoji/[fluent-emoji]';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uri.startsWith('/twemoji/')) {
|
||||||
|
return '/twemoji/[twemoji]';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uri.startsWith('/twemoji-badge/')) {
|
||||||
|
return '/twemoji-badge/[twemoji-badge]';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!uri.startsWith('/api/')) {
|
||||||
|
return '[other]';
|
||||||
|
}
|
||||||
|
|
||||||
const uuid = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/g;
|
const uuid = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/g;
|
||||||
const username_local = /\/@\w+(\/|$)/;
|
const username_local = /\/@\w+(\/|$)/;
|
||||||
const username_remote = /\/@\w+@[a-zA-Z0-9-.]+\.[a-zA-Z]{2,4}(\/|$)/;
|
const username_remote = /\/@\w+@[a-zA-Z0-9-.]+\.[a-zA-Z]{2,4}(\/|$)/;
|
||||||
|
@ -26,12 +62,6 @@ export function sanitizeRequestURI(uri: string): string {
|
||||||
const aid = new RegExp(`/${aidRegExp.source.replace(/^\^/, '').replace(/\$$/, '')}(\/|$)`, 'g');
|
const aid = new RegExp(`/${aidRegExp.source.replace(/^\^/, '').replace(/\$$/, '')}(\/|$)`, 'g');
|
||||||
|
|
||||||
return uri
|
return uri
|
||||||
.replace(/\/tags\/[^/]+/g, '/tags/[tag]')
|
|
||||||
.replace(/\/user-tags\/[^/]+/g, '/user-tags/[tag]')
|
|
||||||
.replace(/\/page\/[\w-]+/g, '/page/[page]')
|
|
||||||
.replace(/\/fluent-emoji\/[^/]+/g, '/fluent-emoji/[fluent-emoji]')
|
|
||||||
.replace(/\/twemoji\/[^/]+/g, '/twemoji/[twemoji]')
|
|
||||||
.replace(/\/twemoji-badge\/[^/]+/g, '/twemoji-badge/[twemoji-badge]')
|
|
||||||
.replace(aidx, '/[aidx]/')
|
.replace(aidx, '/[aidx]/')
|
||||||
.replace(aid, '/[aid]/')
|
.replace(aid, '/[aid]/')
|
||||||
.replace(token, '=[token]')
|
.replace(token, '=[token]')
|
||||||
|
|
Loading…
Reference in a new issue