Skip to content

Conversation

@Chaitu7032
Copy link
Contributor

@Chaitu7032 Chaitu7032 commented Dec 21, 2025

Summary

This PR improves security and cleans up dependencies without changing existing behavior.
All changes were tested and the full Jest test suite passes successfully.

What was changed

##Security fixes
1] Removed all uses of eval() and unsafe dynamic code execution.
2] Replaced them with safe lookups and explicit function calls.
3] Plugins are now treated as data, not executable code.
4] Only allow-listed plugin handlers can run.

Safe plugin handling

1] Added a safe handler registry (safeFunctionRegistry.js) and load it early.
2] Old plugin entries that contain code strings are ignored.
3] Only registered handlers are executed.

API key safety

1] Removed hardcoded API keys from the client.
2] Added a backend proxy route (/api/data) that injects API keys from environment variables.

API guardrails

1] Client sends x-mb-client: 1 header for /api/data.
2] Server checks this header and blocks requests if it’s missing.

Content Security Policy (CSP)

1] Added a CSP header to HTML responses.
2] unsafe-eval is disabled.
3] blob: is allowed for Tone.js workers.
4] cdnjs.cloudflare.com is allowed for highlight.js.
5] Inline scripts are still allowed for now to avoid breaking existing code.

Dependency cleanup

1] Upgraded jQuery from 2.1.4 to 3.7.1.
2] Removed Modernizr from runtime and updated vendor scripts.
3] Updated service worker precache list.
4] Removed invalid "node" dependency from package.json and regenerated the lockfile.

Stability fixes

1] Fixed a crash when recordingBuffer was missing.
2] Fixed a strict-mode issue in synthutils.js.

Testing

1] Jest: 70 test suites / 1549 tests passing
2] Latest test run completed successfully.

Screenshot 2025-12-21 105127

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@Chaitu7032
Copy link
Contributor Author

Chaitu7032 commented Dec 21, 2025

Hi @zealot-zew , @walterbender
issue - #4872
I’ve addressed the issues you mentioned and pushed the fixes in this PR.
Could you please check the current status and let me know if it’s ready for merge, or if any further improvements are needed? and i also request please check the pull request #4834 as it was still in hold .

Thank you for the guidance and review — I learned a lot while working on and fixing this issue.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant