mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 15:14:56 -04:00
![]()
Some checks failed
Docker / build-and-push (backend) (push) Has been cancelled
Docker / build-and-push (frontend) (push) Has been cancelled
E2E Tests / backend-sqlite (push) Has been cancelled
E2E Tests / backend-mariadb (push) Has been cancelled
E2E Tests / backend-postgres (push) Has been cancelled
E2E Tests / Build test build of frontend (push) Has been cancelled
Lint and check format / Lint files and check formatting (push) Has been cancelled
REUSE Compliance Check / reuse (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Static Analysis / Njsscan code scanning (push) Has been cancelled
Static Analysis / CodeQL analysis (javascript) (push) Has been cancelled
Run tests & build / Test and build with NodeJS 20 (push) Has been cancelled
E2E Tests / frontend-cypress (1) (push) Has been cancelled
E2E Tests / frontend-cypress (2) (push) Has been cancelled
E2E Tests / frontend-cypress (3) (push) Has been cancelled
OWASP [1] recommends for password hashing the following algorithms in descending order: argon2id, scrypt, bcrypt. They state that bcrypt may be used in legacy systems or when required due to legal regulations. We're however not building any legacy application. Even HedgeDoc 1.x utilizes a more modern algorithm by using scrypt. While bcrypt is not insecure per se, our implementation had a major security flaw, leading to invalid passwords being accepted in certain cases. The bcrypt nodejs package - and the OWASP cheatsheet as well - point out, that the maximum input length of passwords is limited to 72 bytes with bcrypt. When some user has a password longer than 72 bytes in use, only the first 72 bytes are required to log in successfully. Depending on the encoding (which could be UTF-8 or UTF-16 depending on different circumstances) this could in worst-case be at 36 characters, which is not very unusual for a password. See also [2]. This commit changes the used algorithm to argon2id. Argon2id has been in use for several years now and seems to be a well-designed password hashing function that even won the 2015 Password Hashing Competition. Argon2 does not have any real-world max input length for passwords (it is at 4 GiB). The node-rs/argon2 implementation seems to be well maintained, widely used (more than 150k downloads per week) and is published with provenance, proving that the npm package was built on GitHub actions using the source code in the repository. The implementation is written in Rust, so it should be safe against memory leakages etc. [1]: https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Che at_Sheet.html#password-hashing-algorithms [2]: https://security.stackexchange.com/a/39851 Signed-off-by: Erik Michelson <github@erik.michelson.eu> |
||
---|---|---|
.. | ||
docker | ||
public | ||
src | ||
test | ||
.editorconfig | ||
.env | ||
.eslintrc.js | ||
.gitignore | ||
.prettierrc.json | ||
.prettierrc.json.license | ||
CHANGELOG.md | ||
eslint-local-rules.js | ||
jest-e2e.json | ||
jest-e2e.json.license | ||
nest-cli.json | ||
nest-cli.json.license | ||
package.json | ||
package.json.license | ||
tsconfig.build.json | ||
tsconfig.build.json.license | ||
tsconfig.json | ||
tsconfig.json.license |