Merge branch 'trunk' into 9904-gh-repo-create-to-work-on-bare-repos
This commit is contained in:
commit
04e2a5dd63
3 changed files with 16 additions and 1 deletions
4
.github/workflows/triage.yml
vendored
4
.github/workflows/triage.yml
vendored
|
|
@ -35,6 +35,8 @@ jobs:
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
cc: @github/cli
|
||||||
|
|
||||||
> $BODY
|
> $BODY
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
@ -63,5 +65,7 @@ jobs:
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
cc: @github/cli
|
||||||
|
|
||||||
> $BODY
|
> $BODY
|
||||||
EOF
|
EOF
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -241,6 +242,9 @@ func (i *invoker) StartSSHServerWithOptions(ctx context.Context, options StartSS
|
||||||
return 0, "", fmt.Errorf("failed to parse SSH server port: %w", err)
|
return 0, "", fmt.Errorf("failed to parse SSH server port: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !isUsernameValid(response.User) {
|
||||||
|
return 0, "", fmt.Errorf("invalid username: %s", response.User)
|
||||||
|
}
|
||||||
return port, response.User, nil
|
return port, response.User, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -300,3 +304,10 @@ func (i *invoker) notifyCodespaceOfClientActivity(ctx context.Context, activity
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isUsernameValid(username string) bool {
|
||||||
|
// assuming valid usernames are alphanumeric, with these special characters allowed: . _ -
|
||||||
|
var validUsernamePattern = `^[a-zA-Z0-9_][-.a-zA-Z0-9_]*$`
|
||||||
|
re := regexp.MustCompile(validUsernamePattern)
|
||||||
|
return re.MatchString(username)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ func NewCmdExtension(io *iostreams.IOStreams, em extensions.ExtensionManager, ex
|
||||||
fmt.Fprintf(stderr, "%s\n\n",
|
fmt.Fprintf(stderr, "%s\n\n",
|
||||||
cs.Yellow(releaseInfo.URL))
|
cs.Yellow(releaseInfo.URL))
|
||||||
}
|
}
|
||||||
case <-time.After(3 * time.Second):
|
case <-time.After(1 * time.Second):
|
||||||
// Bail on checking for new extension update as its taking too long
|
// Bail on checking for new extension update as its taking too long
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue