Bug Fix: slugifyLikeString skips sanitization due to unassigned replace() result
メンテナーはふだん 4 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 65/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- typescript
- 領域
- databases
調査の方向性
app/lib/database/utils.ts の slugifyLikeString から開始し、app/lib/methods/search.ts と app/lib/methods/helpers/mergeSubscriptionsRooms.ts にあるその呼び出し元を調べます。無視されている replace() の結果がスラッグ化にどのような影響を与えるかを確認し、続いて、slugify() に値が渡される前に特殊文字がサニタイズされていることと、影響を受ける呼び出し箇所が引き続き期待どおりに動作することを検証します。
索引モデルが issue の本文から書いたものです。
説明
Describe the Bug
The function slugifyLikeString in app/lib/database/utils.ts (around line 14) contains a bug where the replace() result is not assigned or returned.
Because of this, the string sanitization step is effectively skipped, and the unsanitized string (which may contain special characters) is passed directly to slugify().
Steps to Reproduce
Open app/lib/database/utils.ts.
Locate the slugifyLikeString function (lines 12–17).
Notice this line:
str?.replace(likeStringRegex, '_');
The result of replace() is not assigned back to str or returned.
This means the sanitization step does not take effect before the string is passed to slugify().
Expected Behavior
The line should assign the result of replace() back to the variable:
str = str?.replace(likeStringRegex, '_') ?? str;
OR
chain the operation like this:
const sanitized = str.replace(likeStringRegex, '_');
const slugified = slugify(sanitized);
return slugified;
The string should always be sanitized before being passed to slugify().
Actual Behavior
The replace() on line 14 does nothing because its result is ignored.
The raw string with special characters is passed directly to slugify().
The sanitization step is effectively skipped.
Rocket.Chat Server Version
N/A (Code bug fix)
Rocket.Chat App Version
4.67.0
Device Name
N/A
OS Version
N/A
Additional Context
File: app/lib/database/utils.ts
Impact: The slugifyLikeString function is used in:
app/lib/methods/search.tsapp/lib/methods/helpers/mergeSubscriptionsRooms.ts
Note: This bug means special characters may not be properly sanitized before slugification, which could lead to unexpected behavior in search and room merging functionality.
- 主要言語
- TypeScript
- スター
- 2.4k
- フォーク
- 1.5k
- 平均マージ
- 5日 16時間
- マージ済み PR(30日)
- 38
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
RocketChat/Rocket.Chat.ReactNative のほかの issue
-
🐛 bug type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
RocketChat/Rocket.Chat.ReactNative#7982 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
Release network security config allows plain HTTP to 10.0.2.2 and localhost対応中かも @samarkumar4355 が 2 日前に担当しました。 オープンtype: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
RocketChat/Rocket.Chat.ReactNative#7941 · コメント 2 件 ·
メンテナーはふだん 4 日以内に返信
-
[IMPROVEMENT] Remove redundant `await` on synchronous `userPreferences.getBool` in `getUsersPresence`対応中かも @sandeepannandi が 2 日前に担当しました。 オープンtype: feature
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
RocketChat/Rocket.Chat.ReactNative#7737 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
✅ tests 👷 ci type: feature
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
RocketChat/Rocket.Chat.ReactNative#7247 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
bug: goRoom navigates to broken RoomView after failed DM creation from search対応中かも @deepak0x が 235 日前に担当しました。 オープンtype: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
RocketChat/Rocket.Chat.ReactNative#7098 ·
メンテナーはふだん 4 日以内に返信
RocketChat/Rocket.Chat.ReactNative の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
zabuton-app/meguri#875 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
iruzen-dono/workless#117 ·
メンテナーはふだん 1 日以内に返信
-
area:api area:web wave wave:trivial
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
vetro-protocol/vetro-monorepo#1321 ·
メンテナーはふだん 1 日以内に返信