private static void verifySymlinkTarget(String entryName, String linkTarget, Path outputDir, Path outputFile) throws IOException {
    try {
      Path outputTarget = Paths.get(linkTarget);
      if (outputTarget.isAbsolute()) {
        throw new IOException("Invalid symlink (absolute path): " + entryName + " -> " + linkTarget);
      }
      Path linkTargetNormalized = outputFile.getParent().resolve(outputTarget).normalize();
      if (!linkTargetNormalized.startsWith(outputDir.normalize())) {
        throw new IOException("Invalid symlink (points outside of output directory): " + entryName + " -> " + linkTarget);
      }
    }
    catch (InvalidPathException e) {
      throw new IOException("Failed to verify symlink entry scope: " + entryName + " -> " + linkTarget, e);
    }
  }
private static void verifySymlinkTarget(String entryName, String linkTarget, Path outputDir, Path outputFile)