Keys from the user input still needs normalization

This commit is contained in:
Alexandre de Souza 2025-09-22 11:21:00 -03:00
parent bd86dff865
commit 232b3ac5b3
No known key found for this signature in database
GPG key ID: E39228FFBA346545

View file

@ -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