ic-ui-kit icon indicating copy to clipboard operation
ic-ui-kit copied to clipboard

Generate hash during the build chain to verify content is unchanged

Open mi6-577 opened this issue 1 year ago • 8 comments

Summary

In order to provide some assurance that downloads of the ICDS are 'untampered', we should provide a hash number at the point of releasing a new build.

💬 Description

A hash number is unique to the build and can be used by customers to verify that their download has been untouched.

Why do we need it?

Further reading on why hashes are important for open source code can be found here; https://proprivacy.com/guides/how-why-and-when-you-should-hash-check

mi6-577 avatar Sep 17 '24 09:09 mi6-577

Do you need this to be on release/package distribution level? That makes sense.

If you release via github in addition to npm, they do validation.

evenstensberg avatar Sep 17 '24 13:09 evenstensberg

  • https://github.com/nasa/openmct/blob/de122b91c26900dacb4ffa51b2d264c97be9987a/.webpack/webpack.common.mjs#L24-L29
  • https://unix.stackexchange.com/a/460547
  • https://stackoverflow.com/a/26853049

evenstensberg avatar Sep 17 '24 18:09 evenstensberg

  • If Stencil provides an api to inject environment variables to the main build and the react+nextjs build targets, we can inject the environment variables to each target.
  • If that is impossible, we need to write a script and inject the env variables into each bundle ourselves

evenstensberg avatar Sep 30 '24 15:09 evenstensberg

possible implementation

Screenshot 2024-10-07 at 20 36 12

evenstensberg avatar Oct 07 '24 18:10 evenstensberg

I've managed to get the needed data available within the scope of the web components, but not added to the window object. It seems like that is removed on build.

@GCHQ-Developer-299 I have a suggestion:

Maybe you should add a stencil component named ic-stats where the customer can import that component to get version number, build time and hash themselves?

If so, I can set up a simple PR that shows you how to access the variables - it's pretty straight forward.

evenstensberg avatar Oct 11 '24 18:10 evenstensberg

The team that requested this have found a workaround so we're putting this in Future Release for now.

GCHQ-Developer-299 avatar Dec 19 '24 11:12 GCHQ-Developer-299

ok, thats good!

evenstensberg avatar Dec 19 '24 11:12 evenstensberg

Fixed and should be closed if you’re ok with the implementation.

evenstensberg avatar Apr 22 '25 19:04 evenstensberg

Thank you for the suggestion and contribution, we have decided not to move forward with this work as it is no longer needed.

MI6-255 avatar Aug 07 '25 09:08 MI6-255