Default to 8-char slugs for public-internet-safe entropy
5-char slugs over a 32-char alphabet are ~25 bits; brute-forceable at HTTP speeds once the endpoint is public. 8 chars = 40 bits (~10^12 combinations), infeasible to scan within useful timescales. Existing 5-char slugs still resolve; only new artifacts use the longer form.
This commit is contained in:
@@ -38,7 +38,7 @@ type CreateOptions struct {
|
|||||||
func (s *Store) CreateArtifact(opts CreateOptions) (*Artifact, error) {
|
func (s *Store) CreateArtifact(opts CreateOptions) (*Artifact, error) {
|
||||||
slug := strings.ToLower(strings.TrimSpace(opts.Slug))
|
slug := strings.ToLower(strings.TrimSpace(opts.Slug))
|
||||||
if slug == "" {
|
if slug == "" {
|
||||||
g, err := s.generateSlug(5)
|
g, err := s.generateSlug(8)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user