Skip to content

Commit

Permalink
Upgrade java-diff-utils 4.0 -> 4.12
Browse files Browse the repository at this point in the history
This drops the indirect dependency on `org.eclipse.jgit`, guaranteeing
that CVE-2023-4759 is mitigated.

Resolves #4081.

See:
- https://nvd.nist.gov/vuln/detail/CVE-2023-4759
- https://github.com/java-diff-utils/java-diff-utils/releases/tag/java-diff-utils-parent-4.12
- java-diff-utils/java-diff-utils@java-diff-utils-4.0...java-diff-utils-parent-4.12

Fixes #4085

FUTURE_COPYBARA_INTEGRATE_REVIEW=#4085 from PicnicSupermarket:sschroevers/upgrade-java-diff-utils bf4e906
PiperOrigin-RevId: 565083922
  • Loading branch information
Stephan202 authored and Error Prone Team committed Sep 13, 2023
1 parent 35e51f3 commit 84c7705
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion check_api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<!-- Apache 2.0 -->
<groupId>io.github.java-diff-utils</groupId>
<artifactId>java-diff-utils</artifactId>
<version>4.0</version>
<version>4.12</version>
</dependency>
<dependency>
<!-- Apache 2.0 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import com.github.difflib.DiffUtils;
import com.github.difflib.UnifiedDiffUtils;
import com.github.difflib.algorithm.DiffException;
import com.github.difflib.patch.Patch;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
Expand Down Expand Up @@ -60,12 +59,7 @@ public void writeFile(SourceFile update) throws IOException {
if (!oldSource.equals(newSource)) {
List<String> originalLines = LINE_SPLITTER.splitToList(oldSource);

Patch<String> diff = null;
try {
diff = DiffUtils.diff(originalLines, LINE_SPLITTER.splitToList(newSource));
} catch (DiffException e) {
throw new AssertionError("DiffUtils.diff should not fail", e);
}
Patch<String> diff = DiffUtils.diff(originalLines, LINE_SPLITTER.splitToList(newSource));
String relativePath = baseDir.relativize(sourceFilePath).toString();
List<String> unifiedDiff =
UnifiedDiffUtils.generateUnifiedDiff(relativePath, relativePath, originalLines, diff, 2);
Expand Down

0 comments on commit 84c7705

Please sign in to comment.