Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/gatekeeper-google/src/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,15 @@ export class GatekeeperUserImpl extends WorkerEntrypoint<Env, GatekeeperUserImpl
};
}

// Reject URLs that don't belong to Gmail before falling through to the default.
// Without this check, any URL that doesn't match Docs/Sheets/Calendar/BigQuery
// silently receives a Gmail capability, which weakens the resource-URL boundary.
if (parsed.hostname !== "mail.google.com") {
throw new Error(
`Unsupported Google resource URL: ${parsed.hostname}${parsed.pathname}. ` +
"Supported resources are Google Docs, Sheets, Calendar, BigQuery, and Gmail.");
}

// Default: Gmail
let props: GmailGatekeeperImplProps = {...this.ctx.props};

Expand Down
Loading