Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow this package to help with populating the integrity attribute #8

Open
advdv opened this issue Jul 29, 2024 · 0 comments
Open

Allow this package to help with populating the integrity attribute #8

advdv opened this issue Jul 29, 2024 · 0 comments

Comments

@advdv
Copy link

advdv commented Jul 29, 2024

Thank you for this open source project, nice and focussed! Though, I would argue that package is in the perfect position to help developers to populate the "integrity" attribute: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity. But currently it doesn't seem possible to get access to the raw hash to format a string in the way the integrity attribute expects.

If there is interest in this I can contribute an implementation for this, the following approaches would be possible

  1. Create a method fs.Integrity(name) that simply returns a value for the integrity attribute. It might be too closely tied to this specific use case
  2. Create a method that allows arbitrary formatting something like Sprintf(name, format, ...args), "format" argument could be a string with formatting directives and args would always include the hash. But ordering could be awkward, and this seems to magical
  3. Simply have a method that returns the raw hash: fs.HashOf(name), the caller can use the hash in whatever way they like.

Let me know what you think

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

No branches or pull requests

1 participant