Skip to content

Commit fb67e54

Browse files
docs+ci: add docs/SECURITY.md
Signed-off-by: laurentketterle-hub <laurentketterle-hub@users.noreply.github.com>
1 parent 7c56f68 commit fb67e54

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

docs/SECURITY.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Security Considerations
2+
3+
This document outlines the security model of the platform backend and the
4+
practices contributors must follow.
5+
6+
## Secrets handling
7+
8+
- **Never commit secrets.** Supabase service-role keys, provider API tokens,
9+
and webhook secrets belong in Supabase's secret manager only.
10+
- **Least privilege.** The service-role key is server-side only. Client-facing
11+
code uses the anon key and never touches admin capabilities.
12+
- **Rotation.** Rotate keys on any suspected exposure. Use `supabase secrets
13+
set` to overwrite, then revoke the old value.
14+
15+
## Input validation
16+
17+
All data ingested from upstream providers is untrusted. Treat every field as
18+
potentially malformed:
19+
20+
- Validate and coerce types before persisting.
21+
- Length-limit free-text fields to avoid unbounded storage.
22+
- Reject or escape any value that will be rendered in a UI context.
23+
24+
## Output encoding
25+
26+
Any ingested value that is later rendered to users must be HTML-escaped at the
27+
rendering layer to prevent stored cross-site scripting. Do not trust upstream
28+
content to be safe.
29+
30+
## Network egress
31+
32+
- Only call allow-listed upstream hosts. A fetch to an arbitrary URL supplied
33+
by an upstream payload is forbidden.
34+
- Enforce timeouts on every outbound request so a slow provider cannot exhaust
35+
the function's resources.
36+
- Validate TLS: never disable certificate verification.
37+
38+
## Denial-of-service considerations
39+
40+
- The scout's schedule is rate-limited to avoid hammering upstream providers.
41+
- Idempotent writes (`task_id` keyed upserts) prevent duplicate records when a
42+
run is retried.
43+
- Functions should fail fast on upstream timeouts rather than retrying
44+
indefinitely.
45+
46+
## Logging
47+
48+
- Log only non-sensitive data. Never log full tokens, keys, or PII.
49+
- Include correlation IDs so a single run can be traced across logs.
50+
51+
## Reporting
52+
53+
If you discover a vulnerability, report it privately to the maintainers rather
54+
than opening a public issue with exploit details.

0 commit comments

Comments
 (0)