Skip to the page
Social CrawlDocs

Security notes

Updated
View as Markdown

What protects a Social Crawl install, how sign-in and tokens work, what saved pages cannot do, and what is not protected, so you can judge it for yourself.

On this page

Who can do what#

Social Crawl has one owner. There are three kinds of credential:

CredentialMade fromCan do
The web login (web token)Your password. Stored by the web app in an httpOnly cookie, valid 7 days.Everything in the web app.
The extension token (capture scope)Made in Settings. Valid 180 days.Save posts, look up a page, upload videos. It cannot read your library, delete anything or change settings.
A share linkA random secret in the address, valid for the time you chose.Read and download one post (or up to 50), nothing else. Notes and tags are never in it.

Optionally a second password opens the restricted part (see Restricted posts). It is hidden, not encrypted.

Passwords and tokens#

  • The password is stored only as a scrypt hash (N=32768, r=8, p=1, a random 16-byte salt, a 64-byte key) in ADMIN_PASSWORD_HASH. It must be at least 12 characters to make one with the supplied tool.
  • Tokens are HS256 JWTs signed with JWT_SECRET (32 characters or more). Changing the secret ends every login.
  • Failed logins are limited to 5 per minute per client address (LoginThrottle, in memory). The web app passes the real client address on.
  • Dangerous actions ask for the password again: deleting the old database's data, and removing a raw video. The same throttle applies.
  • A hash pasted wrong is described without being revealed (its start, length, line breaks, forbidden characters).

The web app#

  • The token never reaches browser JavaScript. The cookie is httpOnly, sameSite=lax, and secure in production.
  • Only an allowlist of API routes is reachable through /api/.... Everything else answers 404.
  • Anything that is not a GET must carry an Origin that matches the host (a CSRF guard).
  • Responses carry X-Content-Type-Options: nosniff, Referrer-Policy: same-origin and X-Frame-Options: SAMEORIGIN.

What the server fetches#

Every address the server fetches on its own (pictures, videos, link previews, layouts' pictures) goes through fetchPublic in apps/api/src/common/net.ts:

  • Only http and https.
  • Private, loopback, link-local and cloud-metadata addresses are refused at connect time, so a hostname that changes its answer (DNS rebinding) cannot sneak in. IPv4 addresses written as IPv6 are caught too.
  • Limits on size, time and redirects.

Saved pages cannot run code#

  • Saved pages are static HTML with a strict Content-Security-Policy (default-src 'none', no scripts).
  • All text is escaped. Links are limited to http(s), ftp(s), sftp, magnet, mailto and tel.
  • Media paths are checked to be inside the bundle.
  • The web app shows them in a sandboxed iframe.
  • Article bodies are plain data blocks, never HTML. A site rule or a layout holds selectors and tags only, and never runs code.

Secrets at rest#

  • The WebDAV password is encrypted with AES-256-GCM, with a key derived from JWT_SECRET (HKDF-SHA256). It is never sent back to the browser.
  • A share link's secret is 32 random bytes. The database keeps only its SHA-256, so it cannot be shown again.
  • Environment values such as JWT_SECRET and the S3 keys are in your deploy tool's environment. Treat that as a secret store.

The extension#

  • It reads a page when you click it. It can only talk to the one API origin you allow.
  • Its permissions: activeTab, scripting, storage, webRequest, declarativeNetRequestWithHostAccess and power, plus optional access to https://*/* and to localhost, which the browser asks for.
  • Video finding is off until you turn it on. It then notes the video files and playlists the pages you open load, and needs permission to see every site. Nothing is sent until you save.
  • Its token is capture only, so a stolen extension token cannot read your library.

Supply chain#

  • Only official, first-party packages are used, each checked before it is added.
  • yarn npm audit --all --recursive runs in CI and fails on any advisory.
  • No polyfills anywhere.
  • The speech packages are pinned in deploy/speech/requirements.txt and installed with --no-deps. The CI audit does not see them: after changing a version run python3 deploy/speech/pypi-audit.py. (The README also says the model is checked against a SHA-256 and loaded with weights_only=True. That is done by the openai-whisper package and was not verified in this repository.)

Not protected#

  • Anyone who can open your server's storage or database sees everything, including the restricted part.
  • A share link works for anyone who has it until it ends. Treat it like a password.
  • The lab (LAB_ENABLED) can write up to 12 GB per test to your WebDAV. Leave it off.