From 32d9747c072cb170c84c2ff6936715737b98273f Mon Sep 17 00:00:00 2001 From: weizman Date: Wed, 6 Mar 2024 15:23:00 +0200 Subject: [PATCH] Improve demos (#34) --- packages/core/demo/index.html | 4 +- packages/javascript/demo/index.html | 2 +- packages/javascript/test/basic.mjs | 2 +- packages/react/demo/App.jsx | 11 ++-- packages/react/demo/index.html | 90 +++++++++++++++++++++++++---- packages/react/test/basic.mjs | 2 +- 6 files changed, 91 insertions(+), 20 deletions(-) diff --git a/packages/core/demo/index.html b/packages/core/demo/index.html index ecc1d17..a9ec8ec 100644 --- a/packages/core/demo/index.html +++ b/packages/core/demo/index.html @@ -33,7 +33,7 @@
-

LavaDome 🌋

+

LavaDome (Core) 🌋

Display sensitive information to the user only you two can access - @@ -67,7 +67,7 @@

~ Can you bypass LavaDome?

This is not a secret:

- PUBLIC_CONTENT_NOT_ONLY_ACCESSIBLE_TO_LAVADOME + PUBLIC_CONTENT_ACCESSIBLE_TO_ALL

diff --git a/packages/javascript/demo/index.html b/packages/javascript/demo/index.html index 6ff56a6..9ab2ade 100644 --- a/packages/javascript/demo/index.html +++ b/packages/javascript/demo/index.html @@ -9,7 +9,7 @@
This is not a secret:

- PUBLIC_CONTENT_NOT_ONLY_ACCESSIBLE_TO_LAVADOME + PUBLIC_CONTENT_ACCESSIBLE_TO_ALL

diff --git a/packages/javascript/test/basic.mjs b/packages/javascript/test/basic.mjs index 1db7e41..d9c1690 100644 --- a/packages/javascript/test/basic.mjs +++ b/packages/javascript/test/basic.mjs @@ -7,7 +7,7 @@ describe('test javascript mode', async function () { const result = await browser.executeAsync(function(done) { done(document.documentElement.innerText) }); - expect(result.includes('PUBLIC_CONTENT_NOT_ONLY_ACCESSIBLE_TO_LAVADOME')).toBeTruthy(); + expect(result.includes('PUBLIC_CONTENT_ACCESSIBLE_TO_ALL')).toBeTruthy(); expect(result.includes('TO BE REPLACED')).toBeFalsy(); expect(result.includes('SECRET_CONTENT_ONLY_ACCESSIBLE_TO_LAVADOME')).toBeFalsy(); }); diff --git a/packages/react/demo/App.jsx b/packages/react/demo/App.jsx index 9fb0483..af94971 100644 --- a/packages/react/demo/App.jsx +++ b/packages/react/demo/App.jsx @@ -3,18 +3,21 @@ import { LavaDome as LavaDomeReact, toLavaDomeToken } from '../src/index'; const unsafeOpenModeShadow = location.href.includes('unsafeOpenModeShadow'); +const blobURL = URL.createObjectURL(new Blob()); +const secret = blobURL.split('/')[3].split('-').join(''); +URL.revokeObjectURL(blobURL); + export default function App() { const [count, setCount] = useState(0); console.info('render marked', count); return ( -
setCount(count+1)} - style={{ borderStyle: 'solid', margin: '10px', padding: '10px' }} > +
setCount(count+1)} >
This is not a secret:

- PUBLIC_CONTENT_NOT_ONLY_ACCESSIBLE_TO_LAVADOME + PUBLIC_CONTENT_ACCESSIBLE_TO_ALL

@@ -22,7 +25,7 @@ export default function App() {

diff --git a/packages/react/demo/index.html b/packages/react/demo/index.html index ee6f442..7a7f499 100644 --- a/packages/react/demo/index.html +++ b/packages/react/demo/index.html @@ -1,16 +1,84 @@ - - + LavaDome (React) Demo - - - - + - -
+ + +
+

LavaDome (React) 🌋

+
+

+ Display sensitive information to the user only you two can access - + learn more +

+
+

Demo

+
+

~ Can you bypass LavaDome?

+
    +
  • Open the devtools and run whatever code you want
  • +
  • Use that code to get to the secret part and prove you can access it via JavaScript
  • +
      +
    • Do not test the randomness security of the secret - it's not what this is about
    • +
    • You may however assume you know all possible characters the secret may contain
    • +
    +
  • + Remember: +
      +
    • This is a very new project and is at experimental stage ⚠️
    • +
    • It is not unlikely to find ways to bypass it at this point
    • +
    • USE AT YOUR OWN RISK!
    • +
    • If you found a way around LavaDome, please open an issue
    • +
    +
  • +
+
+
+ +
+ TO BE REPLACED +
+ +
+ + ~ By + LavaMoat 🌋 @ + MetaMask 🦊 @ + Consensys 💙 + +
- \ No newline at end of file + diff --git a/packages/react/test/basic.mjs b/packages/react/test/basic.mjs index 1db7e41..d9c1690 100644 --- a/packages/react/test/basic.mjs +++ b/packages/react/test/basic.mjs @@ -7,7 +7,7 @@ describe('test javascript mode', async function () { const result = await browser.executeAsync(function(done) { done(document.documentElement.innerText) }); - expect(result.includes('PUBLIC_CONTENT_NOT_ONLY_ACCESSIBLE_TO_LAVADOME')).toBeTruthy(); + expect(result.includes('PUBLIC_CONTENT_ACCESSIBLE_TO_ALL')).toBeTruthy(); expect(result.includes('TO BE REPLACED')).toBeFalsy(); expect(result.includes('SECRET_CONTENT_ONLY_ACCESSIBLE_TO_LAVADOME')).toBeFalsy(); });