01-seguridad
Part of Spa sharepoint power automate. Install the skill and your agent reads this page when it needs the depth.
1 · Security model (read first)
This pipeline exposes a public, unauthenticated HTTP endpoint. Treat the security model as a first-class concern, not an afterthought.
VITE_* env vars are PUBLIC — they ship in the bundle
Anything prefixed VITE_ is inlined into the JavaScript bundle at build time and is fully visible to anyone who opens DevTools or reads the source on GitHub Pages.
VITE_POWER_AUTOMATE_URL— the trigger URL is public by design (it has to be — the browser calls it). The SAS-style signature in the URL is not a secret you can hide. Anyone can POST to it.VITE_APP_KEY(x-app-keyheader) — NOT a secret. It also ships in the bundle. It is light obfuscation / a speed bump against drive-by bots, nothing more. Do not treat it as authentication.
Never put a real secret (SP app password, Graph client secret, Outlook token) in a VITE_ var. Those belong only inside the Power Automate flow's connections, which run server-side.
Abuse surface and mitigations
The endpoint is open to the internet. Realistic mitigations, in order of effort:
- Validate
x-app-keyin the flow — first action after the trigger: a Condition comparingtriggerHeaders()?['x-app-key']to the expected value; on mismatch, Response 401 and Terminate. Stops casual bots even though the key is discoverable. - Payload-shape validation — reject requests missing required fields or with absurd sizes before doing SP work.
- Size cap — see Payload & attachment limits below; reject oversized bodies early with a Response 413.
- Rate awareness — Power Automate per-flow run limits exist but are generous; for real rate limiting put the flow behind Azure API Management or a Cloudflare Worker proxy. Usually overkill for an internal-tool checklist; document the decision either way.
- CAPTCHA / verification — the trigger URL and any shared key are readable in the public bundle, so neither is an abuse control. Beyond a low-value internal form, put rate limiting and bot verification (for example Cloudflare Turnstile) in a gateway in front of the flow from the start, not after abuse appears. A CAPTCHA adds friction: weigh it against spam records, quota exhaustion and outbound email.
The honest posture: this is an internal tool with a public URL, secured by obscurity + low value to attackers. Write that assumption down in the repo so nobody mistakes it for a hardened public API.
Don't leak internals in the public bundle / UI
The success screen of a public SPA must NOT show internal email addresses, account names, or operator handles. Anonymous visitors don't need to know who gets notified — exposing it leaks personnel structure.
❌ Don't:
Se notificó por correo a usuario@empresa.com ...✅ Do:Se notificó al sector correspondiente y la inspección quedó cargada en SharePoint.The actual recipient stays in the flow's
Send_email_V2Tofield — internal-only config, never in the bundle.