summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2022-12-19 22:45:10 +0900
committerNobuyoshi Nakada <[email protected]>2025-01-13 09:56:22 +0900
commit4180036f48160ecabf09ba7a51abda9becc93d2d (patch)
treef96313373be9692e8464a37c95aa6b6d4ffed82b
parent060ae17c806f0ba955b1c5d825b890b6de6c47e3 (diff)
sync_default_gems.rb: check message_filter arguments
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12563
-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")