You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Storage emulator authorizes object names with '..' segments as one path but stores them under another (path.join) #11301
firebase-tools: 15.8.0 (the same code is in 15.34.0, lib/emulator/storage/files.js lines 296-297)
Platform: Windows 11, Node 24
[REQUIRED] Test case
The Storage emulator evaluates security rules against the object name as requested, but stores and reads the bytes under a key built with path.join(bucket, object). path.join collapses . and .. segments, so two different object names that Cloud Storage keeps distinct (object names are literal, dot segments included) end up as one key in the emulator.
With a common ownership rule:
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /users/{userId}/{allPaths=**} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
}
}
[REQUIRED] Steps to reproduce
Start the Storage and Auth emulators with the rules above.
As user B, upload users/B/photo.png.
As user A, upload to the object name users/A/../B/photo.png (for example with the Web SDK, uploadBytes(ref(storage, 'users/A/../B/photo.png'), bytes)).
As user B, download users/B/photo.png.
[REQUIRED] Expected behavior
Step 3 creates a separate object literally named users/A/../B/photo.png (as Cloud Storage does), and user B's users/B/photo.png is unchanged. Rules decide on the same name that is stored.
[REQUIRED] Actual behavior
The rule matches userId == "A" for step 3, so the write is allowed, but the emulator stores it at users/B/photo.png. Step 4 returns user A's bytes. Reads and deletes behave the same way: a name with .. is authorized as one path and applied to another.
The result is that rules tests run against the emulator can pass or fail for the wrong reason around dot segments, so the emulator is not a reliable check for path rules. Suggested fix: key stored objects by the literal (encoded) object name instead of path.join, or reject object names whose segments are . or .. the same way for both rule evaluation and storage.
Thanks for the report @DirtyBeann! I am working on reproducing the reported behavior but I am encountering a different issue. I created this repro and when I tried reproducing the issue - instead of overwriting the contents of uses/B/photo.png, if user A uploads users/A/../B/photo.png it will instead remove uses/B/photo.png, but still create users/A/../B/photo.png.
I do think the issue I encountered is a bug, however since it looks like we're encountering 2 different behaviors, I'd like to ask if you could check the repro to let me know in case I missed anything? By any chance if you could provide an mcve to help us accurately reproduce the issue, it would be highly appreciated.
Hey @DirtyBeann. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Activity
aalej commentedon Oct 20, 2026
Thanks for the report @DirtyBeann! I am working on reproducing the reported behavior but I am encountering a different issue. I created this repro and when I tried reproducing the issue - instead of overwriting the contents of
uses/B/photo.png, if user A uploadsusers/A/../B/photo.pngit will instead removeuses/B/photo.png, but still createusers/A/../B/photo.png.I do think the issue I encountered is a bug, however since it looks like we're encountering 2 different behaviors, I'd like to ask if you could check the repro to let me know in case I missed anything? By any chance if you could provide an mcve to help us accurately reproduce the issue, it would be highly appreciated.
google-oss-bot commentedon Oct 28, 2026
Hey @DirtyBeann. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!