Skip to content

Commit 5142d30

Browse files
committed
Disallow webFetch if sharing is prohibited.
1 parent 257e642 commit 5142d30

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

packages/workshop-backend/src/overseer.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,16 @@ class OverseerImpl implements AgentHooks {
10581058
// Provides web-fetch with the Workers AI binding and AI Gateway config it needs to call
10591059
// `env.WORKERS_AI.toMarkdown()`. The initiator is needed for AI Gateway metadata.
10601060
getWebFetchEnv(): WebFetchEnv {
1061+
if (this.storage.prohibitAllSharing.get()) {
1062+
// TODO: Disallwing fetches is a bit draconian. Ideally, we would have some way to detect
1063+
// if a URL is well-known, and therefore not a leak problem. E.g. if the URL is already in
1064+
// a search index, then it's not leaking anything. If we had a search provider we could
1065+
// trust... for now though, we will be extra-careful specifically when prohibiting sharing.
1066+
throw new Error(
1067+
"This gadget has observed sensitive data. To prevent leaks, the Gadget is prohibited " +
1068+
"from fetching from public web sites.");
1069+
}
1070+
10611071
return {
10621072
ai: this.env.WORKERS_AI,
10631073
gateway: getAiGatewayConfig(this.env),

0 commit comments

Comments
 (0)