-
-
Notifications
You must be signed in to change notification settings - Fork 14k
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
[21.05] hedgedoc: 1.8.2 -> 1.9.0, fixes CVE-2021-39175 #139238
Conversation
ChangeLog: https://github.com/hedgedoc/hedgedoc/releases/tag/1.9.0 As documented in the Nix expression, I unfortunately had to patch `yarn.lock` manually (the `yarn.nix` result isn't affected by this). By adding a `git+https`-prefix to `midi "https://github.com/paulrosen/MIDI.js.git#abcjs"` in the lock-file I ensured that `yarn` actually uses the `MIDI.js` from the offline-cache from `yarn2nix` rather than trying to download a tarball from GitHub. Also, this release contains a fix for CVE-2021-39175 which doesn't seem to be backported to 1.8. To quote NVD[1]: > In versions prior to 1.9.0, an unauthenticated attacker can inject > arbitrary JavaScript into the speaker-notes of the slide-mode feature > by embedding an iframe hosting the malicious code into the slides or by > embedding the HedgeDoc instance into another page. Even though it "only" has a medium rating by NVD (6.1), this seems rather problematic to me (also, GitHub rates this as "High"), so it's actually a candidate for a backport. [1] https://nvd.nist.gov/vuln/detail/CVE-2021-39175 (cherry picked from commit 0a10c17)
Result of 1 package failed to build:1 package built successfully:
Note that build failures may predate this PR, and could be nondeterministic or hardware dependent. Result of 1 package failed to build:1 package built successfully:
4 suggestions:
Note that build failures may predate this PR, and could be nondeterministic or hardware dependent. |
Meh. Gonna regenerate the lockfiles tomorrow. |
@ofborg build hedgedoc Rebuilding now. I could reproduce the hash-mismatch, but it's gone now. If I had to guess, it's GitHub where something got screwed up badly. |
Now this is weird. Can anybody please check the result of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried to build your PR and it fails with
mak@build-worker-01:~/nixpkgs $ nix build -f . hedgedoc
hash mismatch in fixed-output derivation '/nix/store/2j7bifz3c5spf838gkxz6lhv3406rzjq-js-sequence-diagrams-bda0e49':
wanted: sha256:0rl29jmhv7vhadzb6d08hi9g64227r9j10fh3d0lbgxinrib5gma
got: sha256:0d2zf62fmad760rg9hrkyhp03k5apms3fm0mf64yy8q6p3iw7jvw
cannot build derivation '/nix/store/rq2mnls3gdql1z2xlc8lwl8dgf2jccgf-js-sequence-diagrams.git.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/qwwn2ip9w232is822vkz0gnblhaxwzrj-offline.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/716sxkd1gbbac8kzl0v0shn9csfn4a4z-HedgeDoc-modules-1.9.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/rnyg66ir8py1lvih5p9xk7x8f3pcxqm8-HedgeDoc-1.9.0.drv': 1 dependencies couldn't be built
[38 built (1 failed), 907 copied (108.7 MiB), 91.7 MiB DL]
error: build of '/nix/store/rnyg66ir8py1lvih5p9xk7x8f3pcxqm8-HedgeDoc-1.9.0.drv' failed
mak@build-worker-01:~/nixpkgs $ nix-build /nix/store/zr0dr0cczfgbdyl3y08mipv90wz8xl52-js-sequence-diagrams-bda0e49.drv --check
these derivations will be built:
/nix/store/zr0dr0cczfgbdyl3y08mipv90wz8xl52-js-sequence-diagrams-bda0e49.drv
error: some outputs of '/nix/store/zr0dr0cczfgbdyl3y08mipv90wz8xl52-js-sequence-diagrams-bda0e49.drv' are not valid, so checking is not possible
mak@build-worker-01:~/nixpkgs $
Yeah, as mentioned above, I'm aware of that (also, ofborg already failed with the same issue) :) Will try to investigate what's wrong at some point. |
OK, the overall cause is that the store-path with the new hash (i.e. the store-path that doesn't mismatch) is missing a submodule while the problematic store-path doesn't. However, both stem from the same derivation ( |
OK, found the problem (and with this explanation,
|
`pkgs.fetchgit` uses `fetchSubmodules = true;` by default, however `nix-prefetch-git` doesn't. This means that hashes for a Git repository with fetched submodules will be wrong in `yarn.nix`. Considering that this got unnoticed before, it seems as if this case is an exception to a certain degree. An exemplary problem is the last `hedgedoc` update[1] where `js-sequence-diagrams` - a Git repo with submodules - from upstream's package.json caused a hash mismatch. This got unnoticed because `nix-build --check` doesn't seem to reveal these issues for fixed-output derivations. [1] NixOS#139238
`pkgs.fetchgit` uses `fetchSubmodules = true;` by default, however `nix-prefetch-git` doesn't. This means that hashes for a Git repository with fetched submodules will be wrong in `yarn.nix`. Considering that this got unnoticed before, it seems as if this case is an exception to a certain degree. An exemplary problem is the last `hedgedoc` update[1] where `js-sequence-diagrams` - a Git repo with submodules - from upstream's package.json caused a hash mismatch. This got unnoticed because `nix-build --check` doesn't seem to reveal these issues for fixed-output derivations. [1] NixOS#139238 (cherry picked from commit 46c98ae)
Failing Hydra build: https://hydra.nixos.org/build/154209534 (cherry picked from commit 0a2615f)
This now contains the changes from #139489 as well, so we should wait until this is also merged :) |
That sentence led me to believe the issue had been fixed at that point. |
Oh I only gave an update that it wasn't gone in Matrix, but not here, sorry for that! :) |
This actually bit me quite recently in `nixpkgs` because I assumed that `nix-build --check` would also error out if hashes don't match anymore[1] and so I wrongly assumed that I couldn't reproduce the mismatch error. The fix is rather simple, during the output registration a so-called `delayedException` is instantiated e.g. if a FOD hash-mismatch occurs. However, in case of `nix-build --check` (or `--rebuild` in case of `nix build`), the code-path where this exception is thrown will never be reached. By adding that check to the if-clause that causes an early exit in case of `bmCheck`, the issue is gone. Also added a (previously failing) test-case to demonstrate the problem. [1] NixOS/nixpkgs#139238, the underlying issue was that `nix-prefetch-git` returns different hashes than `fetchgit` because the latter one fetches submodules by default.
`pkgs.fetchgit` uses `fetchSubmodules = true;` by default, however `nix-prefetch-git` doesn't. This means that hashes for a Git repository with fetched submodules will be wrong in `yarn.nix`. Considering that this got unnoticed before, it seems as if this case is an exception to a certain degree. An exemplary problem is the last `hedgedoc` update[1] where `js-sequence-diagrams` - a Git repo with submodules - from upstream's package.json caused a hash mismatch. This got unnoticed because `nix-build --check` doesn't seem to reveal these issues for fixed-output derivations. [1] #139238
This actually bit me quite recently in `nixpkgs` because I assumed that `nix-build --check` would also error out if hashes don't match anymore[1] and so I wrongly assumed that I couldn't reproduce the mismatch error. The fix is rather simple, during the output registration a so-called `delayedException` is instantiated e.g. if a FOD hash-mismatch occurs. However, in case of `nix-build --check` (or `--rebuild` in case of `nix build`), the code-path where this exception is thrown will never be reached. By adding that check to the if-clause that causes an early exit in case of `bmCheck`, the issue is gone. Also added a (previously failing) test-case to demonstrate the problem. [1] NixOS/nixpkgs#139238, the underlying issue was that `nix-prefetch-git` returns different hashes than `fetchgit` because the latter one fetches submodules by default.
This actually bit me quite recently in `nixpkgs` because I assumed that `nix-build --check` would also error out if hashes don't match anymore[1] and so I wrongly assumed that I couldn't reproduce the mismatch error. The fix is rather simple, during the output registration a so-called `delayedException` is instantiated e.g. if a FOD hash-mismatch occurs. However, in case of `nix-build --check` (or `--rebuild` in case of `nix build`), the code-path where this exception is thrown will never be reached. By adding that check to the if-clause that causes an early exit in case of `bmCheck`, the issue is gone. Also added a (previously failing) test-case to demonstrate the problem. [1] NixOS/nixpkgs#139238, the underlying issue was that `nix-prefetch-git` returns different hashes than `fetchgit` because the latter one fetches submodules by default.
Motivation for this change
Backport of #138468.
ChangeLog: https://github.com/hedgedoc/hedgedoc/releases/tag/1.9.0
As documented in the Nix expression, I unfortunately had to patch
yarn.lock
manually (theyarn.nix
result isn't affected by this). Byadding a
git+https
-prefix tomidi "https://github.com/paulrosen/MIDI.js.git#abcjs"
in the lock-fileI ensured that
yarn
actually uses theMIDI.js
from the offline-cachefrom
yarn2nix
rather than trying to download a tarball from GitHub.Also, this release contains a fix for CVE-2021-39175 which doesn't seem
to be backported to 1.8. To quote NVD[1]:
Even though it "only" has a medium rating by NVD (6.1), this seems
rather problematic to me (also, GitHub rates this as "High"), so it's
actually a candidate for a backport.
[1] https://nvd.nist.gov/vuln/detail/CVE-2021-39175
(cherry picked from commit 0a10c17)
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)