summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2024-10-26 22:07:26 +0900
committerGitHub <noreply@github.com>2024-10-26 22:07:26 +0900
commita6a1e3d733e192504986e6e91b5aca9211c331ce (patch)
treee01a6b477b390449cdfdd91cf28611a235af5841
parentBump version to 2024.10.2-alpha.1 (diff)
downloadmisskey-a6a1e3d733e192504986e6e91b5aca9211c331ce.tar.gz
misskey-a6a1e3d733e192504986e6e91b5aca9211c331ce.tar.bz2
misskey-a6a1e3d733e192504986e6e91b5aca9211c331ce.zip
enhance(frontend): Self-XSS防止用のメッセージを追加 (#14839)
* enhance(frontend): Self-XSS防止用のメッセージを追加 * Update Changelog * embedにも同様の記述を追加
-rw-r--r--CHANGELOG.md1
-rw-r--r--locales/index.d.ts22
-rw-r--r--locales/ja-JP.yml7
-rw-r--r--packages/frontend-embed/src/boot.ts22
-rw-r--r--packages/frontend/src/boot/common.ts23
5 files changed, 74 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c35aa3679f..40ad0b639b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@
- Enhance: MiAuth, OAuthの認可画面の改善
- どのアカウントで認証しようとしているのかがわかるように
- 認証するアカウントを切り替えられるように
+- Enhance: Self-XSS防止用の警告を追加
- Fix: 通知の範囲指定の設定項目が必要ない通知設定でも範囲指定の設定がでている問題を修正
- Fix: Turnstileが失敗・期限切れした際にも成功扱いとなってしまう問題を修正
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/768)
diff --git a/locales/index.d.ts b/locales/index.d.ts
index 80adf69232..9058c70496 100644
--- a/locales/index.d.ts
+++ b/locales/index.d.ts
@@ -10553,6 +10553,28 @@ export interface Locale extends ILocale {
*/
"codeGeneratedDescription": string;
};
+ "_selfXssPrevention": {
+ /**
+ * 警告
+ */
+ "warning": string;
+ /**
+ * 「この画面に何か貼り付けろ」はすべて詐欺です。
+ */
+ "title": string;
+ /**
+ * ここに何かを貼り付けると、悪意のあるユーザーにアカウントを乗っ取られたり、個人情報を盗まれたりする可能性があります。
+ */
+ "description1": string;
+ /**
+ * 貼り付けようとしているものが何なのかを正確に理解していない場合は、%c今すぐ作業を中止してこのウィンドウを閉じてください。
+ */
+ "description2": string;
+ /**
+ * 詳しくはこちらをご確認ください。 {link}
+ */
+ "description3": ParameterizedString<"link">;
+ };
}
declare const locales: {
[lang: string]: Locale;
diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml
index d545425cbd..1d426f1705 100644
--- a/locales/ja-JP.yml
+++ b/locales/ja-JP.yml
@@ -2811,3 +2811,10 @@ _embedCodeGen:
generateCode: "埋め込みコードを作成"
codeGenerated: "コードが生成されました"
codeGeneratedDescription: "生成されたコードをウェブサイトに貼り付けてご利用ください。"
+
+_selfXssPrevention:
+ warning: "警告"
+ title: "「この画面に何か貼り付けろ」はすべて詐欺です。"
+ description1: "ここに何かを貼り付けると、悪意のあるユーザーにアカウントを乗っ取られたり、個人情報を盗まれたりする可能性があります。"
+ description2: "貼り付けようとしているものが何なのかを正確に理解していない場合は、%c今すぐ作業を中止してこのウィンドウを閉じてください。"
+ description3: "詳しくはこちらをご確認ください。 {link}"
diff --git a/packages/frontend-embed/src/boot.ts b/packages/frontend-embed/src/boot.ts
index 00c7944eb3..8ab4ab32e6 100644
--- a/packages/frontend-embed/src/boot.ts
+++ b/packages/frontend-embed/src/boot.ts
@@ -21,6 +21,7 @@ import { url } from '@@/js/config.js';
import { parseEmbedParams } from '@@/js/embed-page.js';
import { postMessageToParentWindow, setIframeId } from '@/post-message.js';
import { serverContext } from '@/server-context.js';
+import { i18n } from '@/i18n.js';
import type { Theme } from '@/theme.js';
@@ -127,6 +128,27 @@ window.onunhandledrejection = null;
removeSplash();
+//#region Self-XSS 対策メッセージ
+console.log(
+ `%c${i18n.ts._selfXssPrevention.warning}`,
+ 'color: #f00; background-color: #ff0; font-size: 36px; padding: 4px;',
+);
+console.log(
+ `%c${i18n.ts._selfXssPrevention.title}`,
+ 'color: #f00; font-weight: 900; font-family: "Hiragino Sans W9", "Hiragino Kaku Gothic ProN", sans-serif; font-size: 24px;',
+);
+console.log(
+ `%c${i18n.ts._selfXssPrevention.description1}`,
+ 'font-size: 16px; font-weight: 700;',
+);
+console.log(
+ `%c${i18n.ts._selfXssPrevention.description2}`,
+ 'font-size: 16px;',
+ 'font-size: 20px; font-weight: 700; color: #f00;',
+);
+console.log(i18n.tsx._selfXssPrevention.description3({ link: 'https://misskey-hub.net/docs/for-users/resources/self-xss/' }));
+//#endregion
+
function removeSplash() {
const splash = document.getElementById('splash');
if (splash) {
diff --git a/packages/frontend/src/boot/common.ts b/packages/frontend/src/boot/common.ts
index 1145891b71..90ae49ee59 100644
--- a/packages/frontend/src/boot/common.ts
+++ b/packages/frontend/src/boot/common.ts
@@ -11,7 +11,7 @@ import directives from '@/directives/index.js';
import components from '@/components/index.js';
import { applyTheme } from '@/scripts/theme.js';
import { isDeviceDarkmode } from '@/scripts/is-device-darkmode.js';
-import { updateI18n } from '@/i18n.js';
+import { updateI18n, i18n } from '@/i18n.js';
import { $i, refreshAccount, login } from '@/account.js';
import { defaultStore, ColdDeviceStorage } from '@/store.js';
import { fetchInstance, instance } from '@/instance.js';
@@ -269,6 +269,27 @@ export async function common(createVue: () => App<Element>) {
removeSplash();
+ //#region Self-XSS 対策メッセージ
+ console.log(
+ `%c${i18n.ts._selfXssPrevention.warning}`,
+ 'color: #f00; background-color: #ff0; font-size: 36px; padding: 4px;',
+ );
+ console.log(
+ `%c${i18n.ts._selfXssPrevention.title}`,
+ 'color: #f00; font-weight: 900; font-family: "Hiragino Sans W9", "Hiragino Kaku Gothic ProN", sans-serif; font-size: 24px;',
+ );
+ console.log(
+ `%c${i18n.ts._selfXssPrevention.description1}`,
+ 'font-size: 16px; font-weight: 700;',
+ );
+ console.log(
+ `%c${i18n.ts._selfXssPrevention.description2}`,
+ 'font-size: 16px;',
+ 'font-size: 20px; font-weight: 700; color: #f00;',
+ );
+ console.log(i18n.tsx._selfXssPrevention.description3({ link: 'https://misskey-hub.net/docs/for-users/resources/self-xss/' }));
+ //#endregion
+
return {
isClientUpdated,
app,