Skip to content

Fix security issues: headers, replay protection, CSP, and permissions - #156

Merged
Busiii-adetiba merged 4 commits into
SynapsVault:mainfrom
deborahamoni0-prog:fix/security-issues-30-32-35-36
Oct 20, 2026
Merged

Busiii-adetiba merged 4 commits into
SynapsVault:mainfrom
deborahamoni0-prog:fix/security-issues-30-32-35-36

Conversation

@deborahamoni0-prog

Copy link
Copy Markdown
Contributor

Summary

Fix four security issues identified in the SynapsVault frontend:

Testing

  • Four separate commits, one per issue
  • No new tests added (per requirements)
  • Code changes are compatible with existing CSP and security headers

Closes #30
Closes #32
Closes #35
Closes #36

When init.headers is passed as an array (e.g., [["key", "value"]]), it must be
normalized before reading from it. The previous code had duplicate variable
definitions that would skip normalization for non-Headers instances.

Fix: Consistently use new Headers(init.headers) to normalize all header formats
before reading Idempotency-Key. This ensures array-form headers are properly
converted to the Headers API before lookup.
The signature scheme includes a timestamp but no nonce, making requests vulnerable
to replay attacks within the timestamp window. Replay protection must be enforced
server-side using:

1. Timestamp window validation (e.g., ±5 minutes)
2. Idempotency-Key deduplication to track and reject replayed requests
3. Optional nonce requirement for higher security

Update documentation to clearly specify these requirements and explain how they
work together to prevent replays. Also document that nonces are compatible with
the signing scheme if the server wants to add them in the future.
…e script

The index.html had an inline <script> block applying theme and language
preferences before first paint. This violates the CSP which sets
script-src 'self', allowing only external scripts.

Fix: Move the inline script into the external public/theme-init.js file,
which is already being loaded. This maintains the same functionality
(avoiding flash of unstyled/wrong-language content on first paint) while
complying with the CSP.

The script now runs from an external source and is allowed by script-src 'self'.
The nginx.conf sets Permissions-Policy to restrict camera, microphone,
geolocation, and USB access: camera=(), microphone=(), geolocation=(),
usb=().

Vercel deployments were missing this header, creating an inconsistency
between the two deployment targets. Now both nginx and Vercel enforce
the same security headers.
@vercel

vercel Bot commented Oct 20, 2026

Copy link
Copy Markdown

@deborahamoni0-prog is attempting to deploy a commit to the work Team on Vercel.

A member of the Team first needs to authorize it.

@Busiii-adetiba
Busiii-adetiba merged commit e262ec3 into SynapsVault:main Oct 20, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants