Skip to content

Security

Roi Horowitz edited this page Dec 2, 2026 · 2 revisions

Security

Never run the bot inside Foundry's Data folder

Foundry serves every file inside a module folder over HTTP. If the bot runs from Data/modules/squire/bot, its .env (your Discord bot token and FOUNDRY_TOKEN) and data/store.json can be downloaded by anyone who can reach your Foundry.

The bot refuses to start inside a Foundry module folder. Copy it elsewhere (Installation). ALLOW_INSIDE_FOUNDRY=1 overrides the check; don't use it on a Foundry server anyone else can reach.

Tokens

  • DISCORD_TOKEN controls your bot. Never share or commit it. If it leaks, click Reset Token in the Discord developer portal.
  • FOUNDRY_TOKEN is the shared secret between the module and the bot. Use a long random string. In Foundry it's stored only in the GM's browser, not in the world, so players can't read it.
  • .env and data/ are git-ignored. Keep them that way.

Who can do what

  • Only users in GM_DISCORD_IDS can set DCs, reveal, request, target, roll as PCs or creatures, apply results, or give Hero Points.
  • Players can roll only as their own linked character, and only in linked channels. ALLOWED_CHANNEL_IDS narrows that further.
  • The bot's HTTP API requires FOUNDRY_TOKEN for everything except /api/health, and only accepts browser requests from FOUNDRY_ORIGIN.

Discord permissions

The bot needs only View Channel, Send Messages, Send Messages in Threads and Read Message History (permissions integer 274877975552). Avoid giving it Administrator.

Clone this wiki locally