summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtool/sync_default_gems.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb
index 1cd6771bcd..fc5112c499 100755
--- a/tool/sync_default_gems.rb
+++ b/tool/sync_default_gems.rb
@@ -471,6 +471,12 @@ module SyncDefaultGems
end
def message_filter(repo, sha, input: ARGF)
+ unless repo.count("/") == 1 and /\A\S+\z/ =~ repo
+ raise ArgumentError, "invalid repository: #{repo}"
+ end
+ unless /\A\h{10,40}\z/ =~ sha
+ raise ArgumentError, "invalid commit-hash: #{sha}"
+ end
log = input.read
log.delete!("\r")
log << "\n" if !log.end_with?("\n")