Forum Discussion
CSP Hash Incorrect Despite Correct Script and Hash (CSP Lab Issue?)
Hello all!
I'm working on Introduction to Content Security Policy (CSP) Lab: Content Security Policy: Hashes exercise that requires generating the correct hash for an inline script like:
<script>document.body.style.backgroundColor = "#ADDADE";</script>
I’ve used both CyberChef and the SHA-256 JavaScript snippet to generate hashes like:
sha256-+BWzTX+GJrse8ifajvHg6QFPdmE+JjXYmrYBn+kLITo=
sha256-Msn/9dD1zBN7LGZyQyglKL9JMVyCsVqvZ7MAkmm/BpU=
I've accounted for trailing newlines and whitespaces (CRLF, LF), used View Source (not dev tools), and verified that I'm hashing the exact script content. However, the lab continues to mark the answer as “incorrect.”
Is this likely a glitch in the lab setup, or is there a common mistake I might be overlooking? Would appreciate any help or confirmation from someone who’s completed this lab or run into a similar problem
1 Reply
- SamDickison
Community Manager
Hey anressh, apologies for missing this, as it looks like you asked it a while ago. I can see that BigChungus and steven have completed this lab. I wonder if they could help you... Otherwise, I can see if one of our team can help.