Monorepo for Tangled tangled.org
11

Configure Feed

Select the types of activity you want to include in your feed.

keyfetch: ignore invalid ssh keys and strip out remaining bytes

Signed-off-by: Seongmin Lee <git@boltless.me>

author
Seongmin Lee
date (May 18, 2026, 3:44 PM +0900) commit f9c85351 parent a5b209c2 change-id uvqsponn
+8 -1
+8 -1
keyfetch/keyfetch.go
··· 10 10 "strings" 11 11 12 12 "github.com/urfave/cli/v3" 13 + "golang.org/x/crypto/ssh" 13 14 "tangled.org/core/log" 14 15 ) 15 16 ··· 113 114 func formatKeyData(executablePath, gitDir, logPath, endpoint string, data []map[string]any) string { 114 115 var result string 115 116 for _, entry := range data { 117 + raw, _ := entry["key"].(string) 118 + key, _, _, _, err := ssh.ParseAuthorizedKey([]byte(raw)) 119 + if err != nil { 120 + continue 121 + } 116 122 result += fmt.Sprintf( 117 123 `command="%s guard -git-dir %s -user %s -log-path %s -internal-api %s",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s`+"\n", 118 - executablePath, gitDir, entry["did"], logPath, endpoint, entry["key"]) 124 + executablePath, gitDir, entry["did"], logPath, endpoint, ssh.MarshalAuthorizedKey(key)) 119 125 } 120 126 return result 121 127 } 128 +