Skip to content

[pull] main from hoppscotch:main#65

Merged
pull[bot] merged 31 commits into
Uncodedtech:mainfrom
hoppscotch:main
May 28, 2025
Merged

[pull] main from hoppscotch:main#65
pull[bot] merged 31 commits into
Uncodedtech:mainfrom
hoppscotch:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented May 28, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

anwarulislam and others added 30 commits May 2, 2025 20:52
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
Co-authored-by: mirarifhasan <arif.ishan05@gmail.com>
Co-authored-by: Anwarul Islam <anwaarulislaam@gmail.com>
…factoring (#5061)

* chore: prettier formatting applied

* chore: added some lint fixed

* fix: few lint errors

* chore: prisma and pubsub are now global module

* chore: add encapsulation consistency in service files

* chore: made a cast function private

* chore: cast function made private

* refactor: module imports

* refactor: posthog spelling
…ments (#4430)

Co-authored-by: mirarifhasan <arif.ishan05@gmail.com>
Co-authored-by: mirarifhasan <arif.ishan05@gmail.com>
chore: removed unused CollType GQL enum
…le messages (#5072)

Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
…on (#5067)

Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
…5090)

Co-authored-by: curiouscorrelation <curiouscorrelation@gmail.com>
)

Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
…#5081)

Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
To be revisited after addressing security implications.
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
- Flexible assertions avoiding flakiness.
- Update test fixtures conforming to the schema.
@pull pull Bot added the ⤵️ pull label May 28, 2025
@pull pull Bot merged commit 052dc17 into Uncodedtech:main May 28, 2025

self.addEventListener(
"message",
async (event: MessageEvent<IncomingSandboxWorkerMessage>) => {

Check warning

Code scanning / CodeQL

Missing origin verification in `postMessage` handler Medium

Postmessage handler has no origin check.

Copilot Autofix

AI about 1 year ago

To fix the issue, we need to verify the origin of the incoming message in the postMessage handler. This involves checking the event.origin property against a list of trusted origins before processing the message. If the origin is not trusted, the handler should ignore the message.

The fix involves:

  1. Defining a list of trusted origins (e.g., const TRUSTED_ORIGINS = ['https://www.example.com'];).
  2. Adding a conditional check at the start of the message event listener to ensure the event.origin matches one of the trusted origins.
  3. Ignoring messages from untrusted origins by returning early from the handler.

Suggested changeset 1
packages/hoppscotch-common/src/helpers/workers/sandbox.worker.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/hoppscotch-common/src/helpers/workers/sandbox.worker.ts b/packages/hoppscotch-common/src/helpers/workers/sandbox.worker.ts
--- a/packages/hoppscotch-common/src/helpers/workers/sandbox.worker.ts
+++ b/packages/hoppscotch-common/src/helpers/workers/sandbox.worker.ts
@@ -59,2 +59,4 @@
 
+const TRUSTED_ORIGINS = ['https://www.example.com'];
+
 self.addEventListener(
@@ -62,2 +64,6 @@
   async (event: MessageEvent<IncomingSandboxWorkerMessage>) => {
+    if (!TRUSTED_ORIGINS.includes(event.origin)) {
+      return; // Ignore messages from untrusted origins
+    }
+
     const { type, script, envs } = event.data
EOF
@@ -59,2 +59,4 @@

const TRUSTED_ORIGINS = ['https://www.example.com'];

self.addEventListener(
@@ -62,2 +64,6 @@
async (event: MessageEvent<IncomingSandboxWorkerMessage>) => {
if (!TRUSTED_ORIGINS.includes(event.origin)) {
return; // Ignore messages from untrusted origins
}

const { type, script, envs } = event.data
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.