-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge upstream #839
base: io
Are you sure you want to change the base?
Merge upstream #839
Conversation
* fix(backend): 連合限定先が間違って連合しない先に代入されているのを修正 * build: fix property typo
* feat: サーバー初期設定時専用の初期パスワードを設定できるように * 無いのに入力された場合もエラーにする * 🎨 * 🎨 * cypress-devcontainerにもpassを設定(テストが失敗するため) * [ci skip] 🎨 * ✌️ * test: please revert this commit before merge * Revert "test: please revert this commit before merge" This reverts commit 66b2b48. * Update locales/ja-JP.yml Co-authored-by: syuilo <[email protected]> * build assets * Update Changelog * fix condition * fix condition * add comment * change error code * 他のエラーコードと合わせる * Update CHANGELOG.md --------- Co-authored-by: syuilo <[email protected]>
* fix: 初期パスワードをコメントアウト * 🎨 * fix indent
* wip * Update MkSignin.vue * Update MkSignin.vue * wip * Update CHANGELOG.md * enhance(frontend): サインイン画面の改善 * Update Changelog * 14655の変更取り込み * spdx * fix * fix * fix * 🎨 * 🎨 * 🎨 * 🎨 * Captchaがリセットされない問題を修正 * 次の処理をsignin apiから読み取るように * Add Comments * fix * fix test * attempt to fix test * fix test * fix test * fix test * fix * fix test * fix: 一部のエラーがちゃんと出るように * Update Changelog * 🎨 * 🎨 * remove border --------- Co-authored-by: syuilo <[email protected]>
* New translations ja-jp.yml (Chinese Traditional) * New translations ja-jp.yml (Korean) * New translations ja-jp.yml (Chinese Simplified) * New translations ja-jp.yml (English) * New translations ja-jp.yml (Chinese Traditional) * New translations ja-jp.yml (Korean) * New translations ja-jp.yml (Chinese Simplified) * New translations ja-jp.yml (Chinese Simplified)
* fix(frontend): ログイン画面でキャプチャが表示されない問題を修正 * rename
* fix: signin の資格情報が足りないだけの場合はエラーにせず200を返すように * run api extractor * fix * fix * fix test * /signin -> /signin-flow * fix * fix lint * rename * fix * fix
…dev#14698) * feat(backend): 通報および通報解決時に送出されるSystemWebhookにユーザ情報を含めるようにする * テスト送信もペイロード形式を合わせる * add spaces * fix test
* fix(frontend): 画面サイズが変わった際にnavbarが自動で折りたたまれない問題を修正 * Update Changelog * fix
…dev#15033) * fix(backend): アドレス入力で直接ユーザのプロフィールページを表示した際、前提データが足りず描画に失敗する * fix CHANGELOG.md
…sskey-dev#15044) * fix(frontend): サーバードキュメントとMisskey関連リソースとの間にdividerが入らないことがある問題を修正 * Update Changelog
* check harder for connectibility `allSettled` does not throw if a promise is rejected, so `check_connect` never actually failed * Update Changelog --------- Co-authored-by: dakkar <[email protected]>
* Resolve frontend/backend contradiction for home visibility embeds This now uses the same check from `packages/frontend/src/scripts/get-note-menu.ts` * Update Changelog --------- Co-authored-by: CenTdemeern1 <[email protected]>
misskey-dev#15101) * fix(frontend): ノートがログインしているユーザーしか見れない場合にログインをキャンセルすると一切の処理が停止する問題を修正 * Update Changelog --------- Co-authored-by: syuilo <[email protected]>
* チャンネル一覧の列を最大3列にした (Otaku-Social#13) * fix * fix * fix * 🎨 * fix * 🎨 * Update Changelog * Update Changelog * 要らない_marginを消す --------- Co-authored-by: tmorio <[email protected]>
* fix(frontend): 絵文字管理画面で絵文字が表示されないことがある問題を修正 * Update Changelog * optimize
* fix(frontend): serverContextの型エラーを修正 * add comment
* enhance: 照会の失敗理由を表示するように * Update Changelog * fix * fix test * lookupErrors-> remoteLookupErrors
|
name: randomString(), | ||
on: ['abuseReport'], | ||
url: WEBHOOK_HOST, | ||
secret: randomString(), |
Check failure
Code scanning / CodeQL
Insecure randomness High test
Math.random()
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we need to replace the use of Math.random()
with a cryptographically secure random number generator. In Node.js, we can use the crypto
module's randomBytes
function to generate secure random values. We will modify the randomString
function to use crypto.randomBytes
instead of Math.random()
.
- Import the
crypto
module in theutils.ts
file. - Modify the
randomString
function to usecrypto.randomBytes
to generate random values.
-
Copy modified line R9 -
Copy modified line R123 -
Copy modified line R126
@@ -8,3 +8,3 @@ | ||
import { basename, isAbsolute } from 'node:path'; | ||
import { randomUUID } from 'node:crypto'; | ||
import { randomUUID, randomBytes } from 'node:crypto'; | ||
import { inspect } from 'node:util'; | ||
@@ -122,5 +122,6 @@ | ||
export function randomString(chars = 'abcdefghijklmnopqrstuvwxyz0123456789', length = 16) { | ||
const randomBytes = crypto.randomBytes(length); | ||
let randomString = ''; | ||
for (let i = 0; i < length; i++) { | ||
randomString += chars[Math.floor(Math.random() * chars.length)]; | ||
randomString += chars[randomBytes[i] % chars.length]; | ||
} |
name: randomString(), | ||
on: ['userCreated'], | ||
url: WEBHOOK_HOST, | ||
secret: randomString(), |
Check failure
Code scanning / CodeQL
Insecure randomness High test
Math.random()
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we need to replace the use of Math.random()
with a cryptographically secure random number generator. In Node.js, we can use the crypto
module's randomBytes
function to generate secure random values. We will update the randomString
function to use crypto.randomBytes
instead of Math.random()
.
- Update the
randomString
function inpackages/backend/test/utils.ts
to usecrypto.randomBytes
. - Import the
crypto
module inpackages/backend/test/utils.ts
.
-
Copy modified lines R122-R123 -
Copy modified line R126 -
Copy modified line R128
@@ -121,6 +121,9 @@ | ||
|
||
import { randomBytes } from 'node:crypto'; | ||
|
||
export function randomString(chars = 'abcdefghijklmnopqrstuvwxyz0123456789', length = 16) { | ||
let randomString = ''; | ||
const bytes = randomBytes(length); | ||
for (let i = 0; i < length; i++) { | ||
randomString += chars[Math.floor(Math.random() * chars.length)]; | ||
randomString += chars[bytes[i] % chars.length]; | ||
} |
name: randomString(), | ||
on: ['abuseReport'], | ||
url: 'https://example.com', | ||
secret: randomString(), |
Check failure
Code scanning / CodeQL
Insecure randomness High test
Math.random()
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we need to replace the use of Math.random()
with a cryptographically secure random number generator. In Node.js, we can use the crypto
module's randomBytes
function to generate secure random values. We will modify the randomString
function to use crypto.randomBytes
instead of Math.random()
.
-
Copy modified lines R122-R123 -
Copy modified line R126 -
Copy modified line R128
@@ -121,6 +121,9 @@ | ||
|
||
import { randomBytes } from 'crypto'; | ||
|
||
export function randomString(chars = 'abcdefghijklmnopqrstuvwxyz0123456789', length = 16) { | ||
let randomString = ''; | ||
const bytes = randomBytes(length); | ||
for (let i = 0; i < length; i++) { | ||
randomString += chars[Math.floor(Math.random() * chars.length)]; | ||
randomString += chars[bytes[i] % chars.length]; | ||
} |
}); | ||
|
||
beforeEach(async () => { | ||
const uid = idService.gen(); |
Check failure
Code scanning / CodeQL
Insecure randomness High test
Math.random()
This uses a cryptographically insecure random number generated at
Math.random()
This uses a cryptographically insecure random number generated at
Math.random()
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we need to replace the use of Math.random()
with a cryptographically secure random number generator. In Node.js, we can use the crypto
module's randomBytes
function to generate secure random values. We will modify the getRandom()
function in packages/backend/src/misc/id/meid.ts
to use crypto.randomBytes
instead of Math.random()
.
-
Copy modified lines R6-R7 -
Copy modified line R26 -
Copy modified line R29
@@ -5,2 +5,4 @@ | ||
|
||
import { randomBytes } from 'crypto'; | ||
|
||
const CHARS = '0123456789abcdef'; | ||
@@ -23,5 +25,6 @@ | ||
let str = ''; | ||
const randomValues = randomBytes(12); | ||
|
||
for (let i = 0; i < 12; i++) { | ||
str += CHARS[Math.floor(Math.random() * CHARS.length)]; | ||
str += CHARS[randomValues[i] % CHARS.length]; | ||
} |
name: randomString(), | ||
on: ['abuseReport'], | ||
url: 'https://example.com', | ||
secret: randomString(), |
Check failure
Code scanning / CodeQL
Insecure randomness High test
Math.random()
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we need to replace the use of Math.random()
in the randomString
function with a cryptographically secure random number generator. In Node.js, we can use the crypto
module's randomBytes
function to generate secure random values. We will update the randomString
function to use crypto.randomBytes
instead of Math.random()
.
-
Copy modified lines R122-R123 -
Copy modified line R126 -
Copy modified line R128
@@ -121,6 +121,9 @@ | ||
|
||
import { randomBytes } from 'crypto'; | ||
|
||
export function randomString(chars = 'abcdefghijklmnopqrstuvwxyz0123456789', length = 16) { | ||
let randomString = ''; | ||
const bytes = randomBytes(length); | ||
for (let i = 0; i < length; i++) { | ||
randomString += chars[Math.floor(Math.random() * chars.length)]; | ||
randomString += chars[bytes[i] % chars.length]; | ||
} |
name: randomString(), | ||
on: ['abuseReport'], | ||
url: 'https://example.com', | ||
secret: randomString(), |
Check failure
Code scanning / CodeQL
Insecure randomness High test
Math.random()
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we need to replace the use of Math.random()
in the randomString
function with a cryptographically secure random number generator. In Node.js, we can use the crypto
module's randomBytes
function to achieve this. This change will ensure that the generated random strings are not predictable.
- Modify the
randomString
function inpackages/backend/test/utils.ts
to usecrypto.randomBytes
instead ofMath.random()
. - Import the
crypto
module in the same file.
-
Copy modified line R9 -
Copy modified line R123 -
Copy modified line R126
@@ -8,3 +8,3 @@ | ||
import { basename, isAbsolute } from 'node:path'; | ||
import { randomUUID } from 'node:crypto'; | ||
import { randomUUID, randomBytes } from 'node:crypto'; | ||
import { inspect } from 'node:util'; | ||
@@ -122,5 +122,6 @@ | ||
export function randomString(chars = 'abcdefghijklmnopqrstuvwxyz0123456789', length = 16) { | ||
const randomBytes = crypto.randomBytes(length); | ||
let randomString = ''; | ||
for (let i = 0; i < length; i++) { | ||
randomString += chars[Math.floor(Math.random() * chars.length)]; | ||
randomString += chars[randomBytes[i] % chars.length]; | ||
} |
name: randomString(), | ||
on: ['abuseReport'], | ||
url: 'https://example.com', | ||
secret: randomString(), |
Check failure
Code scanning / CodeQL
Insecure randomness High test
Math.random()
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we need to replace the use of Math.random()
in the randomString
function with a cryptographically secure random number generator. In Node.js, we can use the crypto
module's randomBytes
function to achieve this. This change will ensure that the generated strings are not predictable and are suitable for use in security-sensitive contexts.
-
Copy modified lines R122-R123 -
Copy modified line R126 -
Copy modified line R128
@@ -121,6 +121,9 @@ | ||
|
||
import { randomBytes } from 'node:crypto'; | ||
|
||
export function randomString(chars = 'abcdefghijklmnopqrstuvwxyz0123456789', length = 16) { | ||
let randomString = ''; | ||
const bytes = randomBytes(length); | ||
for (let i = 0; i < length; i++) { | ||
randomString += chars[Math.floor(Math.random() * chars.length)]; | ||
randomString += chars[bytes[i] % chars.length]; | ||
} |
name: randomString(), | ||
on: ['mention'], | ||
url: 'https://example.com', | ||
secret: randomString(), |
Check failure
Code scanning / CodeQL
Insecure randomness High test
Math.random()
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we need to replace the use of Math.random()
in the randomString
function with a cryptographically secure random number generator. In Node.js, we can use the crypto
module's randomBytes
function to generate secure random values. We will modify the randomString
function to use crypto.randomBytes
instead of Math.random()
.
-
Copy modified lines R122-R123 -
Copy modified line R126 -
Copy modified line R128
@@ -121,6 +121,9 @@ | ||
|
||
import { randomBytes } from 'crypto'; | ||
|
||
export function randomString(chars = 'abcdefghijklmnopqrstuvwxyz0123456789', length = 16) { | ||
let randomString = ''; | ||
const bytes = randomBytes(length); | ||
for (let i = 0; i < length; i++) { | ||
randomString += chars[Math.floor(Math.random() * chars.length)]; | ||
randomString += chars[bytes[i] % chars.length]; | ||
} |
const user = await usersRepository | ||
.insert({ | ||
id: id, | ||
username: `user_${id}`, |
Check failure
Code scanning / CodeQL
Insecure randomness High test
Math.random()
This uses a cryptographically insecure random number generated at
Math.random()
This uses a cryptographically insecure random number generated at
Math.random()
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we need to replace the use of Math.random()
with a cryptographically secure pseudo-random number generator. In Node.js, we can use the crypto
module's randomBytes
function to generate secure random values. We will modify the getRandom
function in packages/backend/src/misc/id/meid.ts
to use crypto.randomBytes
instead of Math.random()
. This change will ensure that the generated IDs are not predictable and are suitable for use in security-sensitive contexts.
-
Copy modified line R7 -
Copy modified line R24 -
Copy modified line R28
@@ -6,2 +6,3 @@ | ||
const CHARS = '0123456789abcdef'; | ||
import { randomBytes } from 'crypto'; | ||
|
||
@@ -22,2 +23,3 @@ | ||
function getRandom() { | ||
const bytes = randomBytes(12); | ||
let str = ''; | ||
@@ -25,3 +27,3 @@ | ||
for (let i = 0; i < 12; i++) { | ||
str += CHARS[Math.floor(Math.random() * CHARS.length)]; | ||
str += CHARS[bytes[i] % CHARS.length]; | ||
} |
.insert({ | ||
id: id, | ||
username: `user_${id}`, | ||
usernameLower: `user_${id}`.toLowerCase(), |
Check failure
Code scanning / CodeQL
Insecure randomness High test
Math.random()
This uses a cryptographically insecure random number generated at
Math.random()
This uses a cryptographically insecure random number generated at
Math.random()
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we need to replace the use of Math.random()
with a cryptographically secure random number generator. In Node.js, we can use the crypto
module's randomBytes
function to generate secure random values. This change will ensure that the generated IDs are not predictable.
- Replace the
getRandom
function inpackages/backend/src/misc/id/meid.ts
to usecrypto.randomBytes
instead ofMath.random()
. - Update the import statements to include the
crypto
module.
-
Copy modified lines R22-R23 -
Copy modified line R26 -
Copy modified line R29
@@ -21,7 +21,10 @@ | ||
|
||
import { randomBytes } from 'crypto'; | ||
|
||
function getRandom() { | ||
let str = ''; | ||
const bytes = randomBytes(12); | ||
|
||
for (let i = 0; i < 12; i++) { | ||
str += CHARS[Math.floor(Math.random() * CHARS.length)]; | ||
str += CHARS[bytes[i] % CHARS.length]; | ||
} |
What
Why
Additional info (optional)
Checklist