Skip to content

Commit 068a2b0

Browse files
joehanyuchenshi
andauthoredApr 2, 2024··
Block web browser requests to export endpoint (#6944)
* Block web browser requests to export endpoint * Update src/emulator/hub.ts Co-authored-by: Yuchen Shi <yuchenshi@google.com> --------- Co-authored-by: Yuchen Shi <yuchenshi@google.com>
1 parent dbb8573 commit 068a2b0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎src/emulator/hub.ts

+5
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ export class EmulatorHub extends ExpressBasedEmulator {
9898
});
9999

100100
app.post(EmulatorHub.PATH_EXPORT, async (req, res) => {
101+
if (req.headers.origin) {
102+
res.status(403).json({
103+
message: `Export cannot be triggered by external callers.`,
104+
});
105+
}
101106
const path: string = req.body.path;
102107
const initiatedBy: string = req.body.initiatedBy || "unknown";
103108
utils.logLabeledBullet("emulators", `Received export request. Exporting data to ${path}.`);

0 commit comments

Comments
 (0)
Please sign in to comment.