Skip to content

Commit

Permalink
OS Customisation: Regex to match ssh public keys
Browse files Browse the repository at this point in the history
Fixes raspberrypi#956

Previously we would just trust that users would include a correct SSH public key. Unfortunately, this isn't a viable stategy.

So, let's introduce a regex to perform some light validation of the ssh-key, to avoid having boot failures.
  • Loading branch information
tdewey-rpi committed Nov 8, 2024
1 parent 2f0a5c3 commit 9baa90e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/OptionsPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ Window {
color: radioPubKeyAuthentication.checked ? "black" : "grey"
// textFormat: Text.PlainText
Layout.leftMargin: 40
validator: RegularExpressionValidator { regularExpression: /^ssh-(ed25519|rsa|dss|ecdsa) AAAA(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{4})( [^@]+@[^@]+)?/ }
}
TextArea {
id: fieldPublicKey
Expand Down

0 comments on commit 9baa90e

Please sign in to comment.