From 232b3ac5b3e45c7f2205c9478ee1f9df4a2180a2 Mon Sep 17 00:00:00 2001 From: Alexandre de Souza Date: Mon, 22 Sep 2025 11:21:00 -0300 Subject: [PATCH] Keys from the user input still needs normalization --- lib/livebook/file_system/git.ex | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/livebook/file_system/git.ex b/lib/livebook/file_system/git.ex index 77c234afc..518d6262a 100644 --- a/lib/livebook/file_system/git.ex +++ b/lib/livebook/file_system/git.ex @@ -38,6 +38,17 @@ defmodule Livebook.FileSystem.Git do message: "must be a valid repo URL" ) |> validate_required([:repo_url, :branch, :key, :hub_id]) + |> update_change(:key, fn key -> + if key =~ "\n" do + key + else + String.replace( + key, + ~r/ (?!(?:OPENSSH |RSA |EC |DSA |PRIVATE )?(?:PRIVATE )?KEY-----)/, + "\n" + ) + end + end) |> put_id() end