(t *testing.T)
| 283 | } |
| 284 | |
| 285 | func TestSharedState_KeyNamespacingWithOverlappingPrefixes(t *testing.T) { |
| 286 | t.Parallel() |
| 287 | |
| 288 | store := newSharedStateMemoryStorage(t) |
| 289 | shortPrefixApp := New(Config{AppName: "app", SharedStorage: store}) |
| 290 | longPrefixApp := New(Config{AppName: "app-one", SharedStorage: store}) |
| 291 | |
| 292 | err := longPrefixApp.SharedState().Set("session:123", []byte("victim-secret"), time.Minute) |
| 293 | require.NoError(t, err) |
| 294 | |
| 295 | err = shortPrefixApp.SharedState().Set("one-session:123", []byte("attacker-value"), time.Minute) |
| 296 | require.NoError(t, err) |
| 297 | |
| 298 | data, found, err := longPrefixApp.SharedState().Get("session:123") |
| 299 | require.NoError(t, err) |
| 300 | require.True(t, found) |
| 301 | require.Equal(t, []byte("victim-secret"), data) |
| 302 | } |
| 303 | |
| 304 | func TestSharedState_StorageErrorsArePropagated(t *testing.T) { |
| 305 | t.Parallel() |
nothing calls this directly
no test coverage detected