Skip to content

Add Angular and React examples - #70

Open
svenzik wants to merge 14 commits into
mainfrom
WE2-968-examples
Open

svenzik wants to merge 14 commits into
mainfrom
WE2-968-examples

Conversation

@svenzik

@svenzik svenzik commented Feb 14, 2026 •

Copy link
Copy Markdown
Contributor

WE2-968

  • Add Angular example
  • Add React example
  • build(deps): migrate from Angular 19 to 20
  • build(deps): migrate from Angular 20 to 21
  • build: Angular example version bump to 2.1.0-beta.0

Supersedes #58
Closes #58

event.waitUntil(self.clients.claim())
})

self.addEventListener('message', async function (event) {

Check warning

Code scanning / CodeQL

Missing origin verification in `postMessage` handler Medium

Postmessage handler has no origin check.

Copilot Autofix

AI 1 day ago

Add an early allowlist check for event.origin in the message event listener before any command processing.
Best minimal fix (without changing existing functionality): compare event.origin against self.location.origin and return early when it does not match. This preserves current behavior for same-origin clients and rejects unexpected cross-origin message events.

Change required in:

  • examples/web-eid-angular-example/public/mockServiceWorker.js
    • Inside the self.addEventListener('message', async function (event) { ... }) block, immediately after entering the handler (before using event.source.id), add:
      • Guard for missing/invalid event.origin
      • Equality check to self.location.origin
      • Early return on mismatch

No new imports or dependencies are needed.

Suggested changeset 1
examples/web-eid-angular-example/public/mockServiceWorker.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/examples/web-eid-angular-example/public/mockServiceWorker.js b/examples/web-eid-angular-example/public/mockServiceWorker.js
--- a/examples/web-eid-angular-example/public/mockServiceWorker.js
+++ b/examples/web-eid-angular-example/public/mockServiceWorker.js
@@ -24,6 +24,10 @@
 })
 
 self.addEventListener('message', async function (event) {
+  if (!event.origin || event.origin !== self.location.origin) {
+    return
+  }
+
   const clientId = event.source.id
 
   if (!clientId || !self.clients) {
EOF
@@ -24,6 +24,10 @@
})

self.addEventListener('message', async function (event) {
if (!event.origin || event.origin !== self.location.origin) {
return
}

const clientId = event.source.id

if (!clientId || !self.clients) {
Copilot is powered by AI and may make mistakes. Always verify output.
event.waitUntil(self.clients.claim())
})

self.addEventListener('message', async function (event) {

Check warning

Code scanning / CodeQL

Missing origin verification in `postMessage` handler Medium

Postmessage handler has no origin check.

Copilot Autofix

AI 1 day ago

Add an explicit origin verification at the start of the "message" event handler, before using event.source/event.data.
Best fix here: compare event.origin against the service worker’s own origin (self.location.origin) and return early if it does not match.

Edit in:

  • examples/web-eid-react-example/public/mockServiceWorker.js
  • Region around line 26 (self.addEventListener('message', async function (event) { ... })

No new imports or dependencies are required.

Suggested changeset 1
examples/web-eid-react-example/public/mockServiceWorker.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/examples/web-eid-react-example/public/mockServiceWorker.js b/examples/web-eid-react-example/public/mockServiceWorker.js
--- a/examples/web-eid-react-example/public/mockServiceWorker.js
+++ b/examples/web-eid-react-example/public/mockServiceWorker.js
@@ -24,6 +24,10 @@
 })
 
 self.addEventListener('message', async function (event) {
+  if (event.origin !== self.location.origin) {
+    return
+  }
+
   const clientId = event.source.id
 
   if (!clientId || !self.clients) {
EOF
@@ -24,6 +24,10 @@
})

self.addEventListener('message', async function (event) {
if (event.origin !== self.location.origin) {
return
}

const clientId = event.source.id

if (!clientId || !self.clients) {
Copilot is powered by AI and may make mistakes. Always verify output.
@svenzik svenzik changed the title WE2 968 examples WE2-968: Add Angular and React examples Feb 14, 2026
@mrts mrts changed the title WE2-968: Add Angular and React examples Add Angular and React examples Feb 19, 2026
@svenzik
svenzik force-pushed the WE2-968-examples branch 2 times, most recently from c55532a to 9f20112 Compare April 1, 2026 09:43
taneltm and others added 13 commits September 27, 2026 23:36
WE2-968

Signed-off-by: Tanel Metsar <taneltm@users.noreply.github.com>
WE2-968

Signed-off-by: Tanel Metsar <taneltm@users.noreply.github.com>
WE2-1179

Signed-off-by: Sven Mitt <svenzik@users.noreply.github.com>
WE2-1179

Signed-off-by: Sven Mitt <svenzik@users.noreply.github.com>
WE2-1179

Signed-off-by: Sven Mitt <svenzik@users.noreply.github.com>
WE2-1179

Signed-off-by: Sven Mitt <svenzik@users.noreply.github.com>
Co-authored-by: TanelTM <taneltm@users.noreply.github.com>
WE2-1179

Signed-off-by: Sven Mitt <svenzik@users.noreply.github.com>
WE2-1179

Signed-off-by: Sven Mitt <svenzik@users.noreply.github.com>
WE2-1179

Signed-off-by: Sven Mitt <svenzik@users.noreply.github.com>
WE2-968

Signed-off-by: Sven Mitt <svenzik@users.noreply.github.com>
WE2-968

Signed-off-by: Sven Mitt <svenzik@users.noreply.github.com>
WE2-1240

Signed-off-by: Sven Mitt <svenzik@users.noreply.github.com>
WE2-1240

Signed-off-by: Sven Mitt <svenzik@users.noreply.github.com>
@svenzik
svenzik force-pushed the WE2-968-examples branch 3 times, most recently from 45409fa to ea6d72c Compare September 28, 2026 08:26
WE2-1240

Signed-off-by: Sven Mitt <svenzik@users.noreply.github.com>
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.

3 participants