Skip to content
This repository was archived by the owner on Apr 2, 2026. It is now read-only.
This repository was archived by the owner on Apr 2, 2026. It is now read-only.

Storage API: Inappropriate caching and re-use of differently-authenticated filesystem providers #698

@cjllanwarne

Description

@cjllanwarne

We recently updated to the latest version of the java-storage-nio library but almost immediately ran into issues with threads handling requests from different users having their filesystem providers and authentication mixed up. This resulted - luckily - in only “access denied” exceptions before we noticed and reverted the update but might have been much worse.

The problem seems to be coming from the changes made in #168 whereby the CloudStorageFileSystem is now caching providers in its CONFIG_TO_PROVIDERS_MAP (see: get, put) but not recognizing that differently authenticated providers might nevertheless be sharing a single value of config.

We believe that this would not be the case if the CONFIG_TO_PROVIDERS_MAP were to be keyed on the combination of config (which might be a single global value, as in our case) AND storageOptions (which contains the authentication information).

Side note: As Brian also mentioned in #691, the HashSets in that file seem to be storing objects whose hashes can mutate (and indeed, would be expected to mutate when their auth state is changed), which might also be causing unexpected behavior on lookup (which might actually have saved us from even more unexpected filesystem provider re-use).

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the googleapis/java-storage-nio API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions