-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(adding_signature_validation): Adding Validation for signatures.
- Loading branch information
Showing
6 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/ruby | ||
require 'pre-commit-sign' | ||
if ARGV.length >= 1 | ||
puts 'Validating signature' | ||
commit_message = ARGV[0] | ||
message_body = commit_message.split("\n").select { |l| l.start_with?(' ') }.join("\n").gsub(/^ /, '') | ||
pcs = PrecommitSign.from_message(message_body) | ||
pcs.date = DateTime.strptime(/^Date:\s+(.*)$/.match(commit_message).captures.first, '%a %b %d %T %Y %z').to_time | ||
puts "Commit Message: #{message_body}" | ||
if pcs.valid_signature? | ||
puts 'Perfect' | ||
else | ||
puts 'Not valid' | ||
exit 1 | ||
end | ||
else | ||
puts "Need a commit message to validate signature from. Try pre-commit install -f && pre-commit install --install-hooks -t commit-msg -f before commiting your code." | ||
exit 1 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# autopep8'd | ||
import os | ||
|
||
from pyVmomi import vmodl | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters