Skip to content

Commit 4180036

Browse files
committed
sync_default_gems.rb: check message_filter arguments
1 parent 060ae17 commit 4180036

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tool/sync_default_gems.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,12 @@ def ignore_file_pattern_for(gem)
471471
end
472472

473473
def message_filter(repo, sha, input: ARGF)
474+
unless repo.count("/") == 1 and /\A\S+\z/ =~ repo
475+
raise ArgumentError, "invalid repository: #{repo}"
476+
end
477+
unless /\A\h{10,40}\z/ =~ sha
478+
raise ArgumentError, "invalid commit-hash: #{sha}"
479+
end
474480
log = input.read
475481
log.delete!("\r")
476482
log << "\n" if !log.end_with?("\n")

0 commit comments

Comments
 (0)