-
Notifications
You must be signed in to change notification settings - Fork 213
[chore] refactor typescript directory #2087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
useEffect(() => { | ||
console.log('adding event listener'); | ||
const fn = ( | ||
event: MessageEvent< |
Check warning
Code scanning / CodeQL
Missing origin verification in `postMessage` handler Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 22 days ago
To fix the issue, we need to verify the origin
of the incoming MessageEvent
before processing the message. This involves:
- Defining a list of trusted origins (e.g.,
https://www.example.com
) that are allowed to send messages. - Adding a conditional check to ensure the
event.origin
matches one of the trusted origins. - If the
origin
is not trusted, the handler should ignore the message or log a warning.
The fix will be applied to the fn
function defined on line 189. The trusted origins can be defined as a constant array or a configuration variable.
-
Copy modified line R189 -
Copy modified lines R255-R258
@@ -188,2 +188,3 @@ | ||
console.log('adding event listener'); | ||
const trustedOrigins = ['https://www.example.com', 'https://trusted-origin.com']; | ||
const fn = ( | ||
@@ -253,2 +254,6 @@ | ||
) => { | ||
if (!trustedOrigins.includes(event.origin)) { | ||
console.warn(`Untrusted origin: ${event.origin}`); | ||
return; | ||
} | ||
const { command, content } = event.data; |
typescript/packages/playground-common/src/shared/baml-project-panel/vscode.ts
Fixed
Show fixed
Hide fixed
e372c19
to
58a06e7
Compare
Generated with ❤️ by ellipsis.dev |
70ecadf
to
0b7b2a1
Compare
0b7b2a1
to
032ba5c
Compare
905911a
to
066f36f
Compare
066f36f
to
ca8ec19
Compare
fix: issue with manturin codegen fix: release fix: wasm build fix genreate fix python final
08c6398
to
1e9d8e7
Compare
Major TypeScript Directory Refactor
Overview
This PR introduces a major refactor of the TypeScript codebase. The primary goal is to modernize, modularize, and clarify the structure of our TypeScript projects, making it easier to maintain, extend, and onboard new contributors. This is a breaking, high-impact change that affects nearly every TypeScript-related file and package.
What Changed
1. Monorepo Structure: All TypeScript Packages Moved to
/packages
fiddle-frontend
,vscode-ext
,playground-common
,common
, etc.) were scattered directly undertypescript/
or in ad-hoc subfolders.typescript/packages/
. This includes:baml-schema-wasm-node
baml-schema-wasm-web
codemirror-lang-baml
common
fiddle-proxy
language-server
nextjs-plugin
playground-common
ui
(new, see below)2. Apps Consolidated Under
/apps
fiddle-frontend
,vscode-ext/packages/vscode
, etc.).typescript/apps/
:fiddle-web-app
(formerlyfiddle-frontend
)vscode-ext
(formerlyvscode-ext/packages/vscode
andweb-panel
)3. New
ui
Packagetypescript/packages/ui/
.4. Shared Code and Utilities
common
andplayground-common
packages have been moved and refactored for clarity.5. Configuration and Tooling
typescript/workspace-tools/
.6. Removed/Deleted Files
Why This Matters
Impact for Contributors
Migration Guide
typescript/apps/
for all runnable applications.typescript/packages/
for all libraries, shared code, and utilities.@boundaryml/ui
for all shared UI needs.typescript/workspace-tools/
for base configs and scripts.Summary Table
typescript/fiddle-frontend/
typescript/apps/fiddle-web-app/
typescript/vscode-ext/packages/vscode/
typescript/apps/vscode-ext/
typescript/vscode-ext/packages/web-panel/
typescript/apps/vscode-ext/src/web-panel/
typescript/playground-common/
typescript/packages/playground-common/
typescript/common/
typescript/packages/common/
typescript/fiddle-proxy/
typescript/packages/fiddle-proxy/
typescript/nextjs-plugin/
typescript/packages/nextjs-plugin/
typescript/codemirror-lang-baml/
typescript/packages/codemirror-lang-baml/
typescript/baml-schema-wasm-node/
typescript/packages/baml-schema-wasm-node/
typescript/baml-schema-wasm-web/
typescript/packages/baml-schema-wasm-web/
typescript/language-server/
typescript/packages/language-server/
Final Notes