-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
FIPS Compatibility Issue #10963
Comments
Afaik we only use hashing for generating unique static file names based on their content, to avoid filename conflicts and enable immutable caching. I don't remember any cryptographic usage.
That would be helpful to share these experiments and the issues you encountered. The stacktrace you shared seems related to the usage of Jiti to load our config file, that apparently uses md5 internally. See also unjs/jiti#340 |
I've been running into this as well and am the last comment in that jiti issue ticket. My hope is that they will make that update soon and then it would be a simple upgrade on the Docusaurus side. In the mean time, this was the best (it's not good) workaround I could come up with:
|
You are correct. In my haste to raise the issue I’ve pasted one of the traces that is caused by Jiti. There is another cause by Docusaurus’ HashUtils module. It’s a shame Node’s crypto lib doesn’t have the same Used for Security mechanism. @tuckergordon thanks for this workaround. I’ve used something similar on a different project. Will give this a go. |
Great, let us know how it works. We might expose a Docusaurus Node.js API to make this kind of things easier in the future. Apart from monkey patching, there are other possible solutions. None are ideal but still worth being aware of them.
const Module = require("module");
const originalLoad = Module._load;
Module._load = function (request, parent, isMain) {
if (request === "crypto") {
return require(path.join(__dirname, "custom-crypto.js"));
}
return originalLoad(request, parent, isMain);
};
const path = require("path");
require.cache[require.resolve("crypto")] = {
exports: require(path.join(__dirname, "custom-crypto.js")),
};
|
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
I have a requirement to build my Docusaurus website in a FIPS compliant container. Currently it is not possible as Docusaurus hardcodes the use of the md5 algorithm .
Could it be possible to use another hashing algorithm that is compliant to FIPS 140-2 (or a customisable one) like sha256?
Are you only using md5 a hashing function or does it have some cryptographic use also?
I attempted to use patch-package to modify my node_modules & replace md5 with sha256 in the hashUtils module. This wasn't successful and resulted in further issues i was unable to debug.
Reproducible demo
https://github.com/bendudz/docusaurus/tree/fips-repro/examples/classic
Steps to reproduce
The repro uses a publicly available .FIPS image. If you have access to Chainguard there are images available from them that could be substituted into the dockerfile FROM clause.
Clone the repro & navigate to the example.
cd examples/classic
Build the dockerfile
docker build -t fips-repro --no-cache=true .
Expected behavior
I would like to think Docusaurus could be built in a FIPS compliant manner with either an applicable algorthim used or a customisable option to replace md5.
Actual behavior
Attempting to build the site in the FIPS enabled container ends up with a long stacktrace.
Your environment
Self-service
The text was updated successfully, but these errors were encountered: