Script tags with integrity attributes

Sdílet
Vložit
  • čas přidán 19. 07. 2024
  • This tutorial explains what the integrity attribute of a script tag is and how it works. Also covered is how you can integrate your integrity values into your Content Security Policy meta tags.
    HTML Code GIST: gist.github.com/prof3ssorSt3v...
    integrity.js Code GIST: gist.github.com/prof3ssorSt3v...
    other-integrity.js Code GIST: gist.github.com/prof3ssorSt3v...
    Content-Security-Policy video: • Content Security Polic...
    SRI Hash Generator - www.srihash.org/
    Content-Security-Policy reference: content-security-policy.com/

Komentáře • 28

  • @nelsyeung
    @nelsyeung Před 4 lety +9

    Seriously?! This is only 1k views? This video is the only resource I've found on these two concepts that is quick and easy to understand without jargons.

  • @ApteacherNetTelanganaTeachers

    Super Steve Bro... Nice explained.. Thq.... I searched on internet.. i got ur video....Thx a lot ...

  • @jonmultimedia
    @jonmultimedia Před 11 měsíci

    Really good video. Just got a security hotspot with Sonar Cube in the pipeline complaining about missing integrity. This explains it really well. Thank you :)

  • @20smiran
    @20smiran Před 3 lety +1

    This is a great video. Also, when you get the sha384 of the SRI Hash generator, make sure to add the crossorigin="anonymous"; otherwise, you will still get an error.

  • @ritaahmed989
    @ritaahmed989 Před rokem

    Thanks. You made my task easy to understand!

  • @justingilley5017
    @justingilley5017 Před 3 lety

    Please keep making videos; you should have more subscribers because your content is actually useful. Unfortunately, content creators without substance get the most attention.

  • @nathaliasouz.a
    @nathaliasouz.a Před 2 lety

    Thank you so much for your videos !!!

  • @netanel8897
    @netanel8897 Před 5 lety

    amazing video! thank you very much sir

  • @widibaka7058
    @widibaka7058 Před 4 lety

    thankyou very much

  • @m12652
    @m12652 Před rokem

    Great stuff as usual… just wondering if you’d need a modified approach for a site developed with something like Svelte and Sveltekit?

  • @victorpinasarnault9135

    I try copy and paste the sha384 of the SRI Hash generator and not just didn't work as screw up my website design. What happened?

  • @mazheradvise7916
    @mazheradvise7916 Před rokem

    Can you please share it for nonce i am able to generate the unique nonce value but couldn't able to call in my html and jsp page

  • @somebody3014
    @somebody3014 Před 8 měsíci

    Amazing video, can we use the script-src 'hash' for inline scripts?

  • @makeitbollywood
    @makeitbollywood Před 2 lety

    Can we use it for any cdn which is not providing the integrity attributes. ??

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  Před 2 lety

      If you are willing to download the current version of the script and run the hashing algorithm with openssl or the online tool, then you have the hash and can add it to your integrity attribute in the script tag.
      Bear in mind that if they change the file that you are pointing to the integrity value will no longer be valid.
      The integrity value is really just giving the browser a way to validate the contents of the script.

    • @makeitbollywood
      @makeitbollywood Před 2 lety

      @@SteveGriffith-Prof3ssorSt3v3 can we also add the integrity attribute to internal js and internal style/css. ??

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  Před 2 lety

      @@makeitbollywood yes. Any file

  • @meghrajsingh3086
    @meghrajsingh3086 Před rokem

    Hi Steve, I might be late for it but my page have many inline scripts and styles that's an old code and making all the script as a link is not easy and also adding so many hash code in every script is also not that easy is there any solution for it

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  Před rokem

      Sounds like it is time to refactor.
      Rebuild the code into one script or into actual modules that are imported.
      Not easy but the time you take to fix things will make everything run better and be more secure in the long run.
      Just because it is hard to update do not avoid making the changes and improving things

    • @meghrajsingh3086
      @meghrajsingh3086 Před rokem

      Hey Steve, thanks for reply it's fine for the script which we find in the code but what about some script got dynamically create means we don't have control on it like webform_onSubmit etc for different elements we are getting different script in the page. Do you have any solution for this kind of situation

  • @koros9992
    @koros9992 Před 3 lety

    how to reverse it ?

  • @victorpinasarnault9135

    Like 90º

  • @rajastylez
    @rajastylez Před 3 lety

    How do you stop a chicken and egg problem of knowing when you MAKE the tag that it's not malicious lol?

  • @koro2829
    @koro2829 Před 3 lety

    Anyway to skip the integrity attribute