Cached flags collide between two client instances on different environments (cache not namespaced per environment)

オープン
#105 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
58/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
swift
領域
mobile

調査の方向性

まず、2つのFlagsmithクライアントがflagsを取得するときに使用されるキャッシュパスを追跡します。これには、リクエストURLとX-Environment-Keyヘッダーがキャッシュキーにどのように寄与するかも含まれます。同じベースURLに対して異なる環境キーを使用し、Flagsmith.sharedシングルトンの場合も含めて、issueの2クライアントシーケンスを再現します。完了の条件は、各クライアントが他のインスタンスの値を上書きすることなく、一貫して自身のキャッシュ済みflagsを受け取ることです。

索引モデルが issue の本文から書いたものです。

説明

When two Flagsmith client instances run in the same app on different environment keys with caching enabled, they can serve or overwrite each other's cached flags.

Use case: a host app uses the Flagsmith iOS SDK, and a third-party SDK embedded in the same app also uses the Flagsmith SDK, each configured with its own environment key against the same base URL.

Observed behaviour: with caching on, flags from one environment can be returned for the other, or the two instances overwrite each other's cached values.

Likely cause (to validate): the cache appears keyed on request URL only. The environment is sent as the X-Environment-Key header and the flags path is fixed, so two instances on the same base URL share a cache entry. On iOS this is compounded by Flagsmith.shared being a singleton.

Steps to reproduce:

  1. Create two Flagsmith clients in one app, each with a different environment key, same API base URL, caching enabled.
  2. Fetch flags on client A, then client B.
  3. Observe client B serving client A's cached flags, or the two overwriting each other.

Proposed direction: namespace the cache per environment key so instances don't collide

主要言語
Swift
スター
17
フォーク
18
平均マージ
2日 23時間
マージ済み PR(30日)
8

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Flagsmith/flagsmith-ios-client のほかの issue

Flagsmith/flagsmith-ios-client の issue をすべて見る

似ている issue

Swift の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。