Skip to content

Commit 3b9c01e

Browse files
committed
fix: ensure relative avatars keep small scope
1 parent e035f1f commit 3b9c01e

File tree

1 file changed

+12
-1
lines changed
  • scripts/validate-contributor-readmes

1 file changed

+12
-1
lines changed

scripts/validate-contributor-readmes/main.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ func parseContributorFiles(readmeEntries []readme) (
414414
contributorProfileFrontmatter: yml,
415415
}
416416

417-
if prev, conflict := frontmatterByUsername[processed.GithubUsername]; conflict {
417+
if prev, isConflict := frontmatterByUsername[processed.GithubUsername]; isConflict {
418418
yamlParsingErrors.Errors = append(
419419
yamlParsingErrors.Errors,
420420
fmt.Errorf(
@@ -534,6 +534,17 @@ func validateRelativeUrls(
534534
continue
535535
}
536536

537+
if strings.HasPrefix(*con.AvatarUrl, "..") {
538+
problems = append(
539+
problems,
540+
fmt.Errorf(
541+
"%q: relative avatar URLs cannot be placed outside a user's namespaced directory",
542+
con.FilePath,
543+
),
544+
)
545+
continue
546+
}
547+
537548
absolutePath := strings.TrimSuffix(con.FilePath, "README.md") +
538549
*con.AvatarUrl
539550
_, err := os.ReadFile(absolutePath)

0 commit comments

Comments
 (0)