提交 faffde45 编写于 作者: M Mislav Marohnić

mode for ~/.config/hub is 0600 now

Fixes #120
上级 c936a261
...@@ -22,6 +22,7 @@ Feature: OAuth authentication ...@@ -22,6 +22,7 @@ Feature: OAuth authentication
And the output should contain "github.com password for mislav (never stored):" And the output should contain "github.com password for mislav (never stored):"
And the exit status should be 0 And the exit status should be 0
And the file "../home/.config/hub" should contain "oauth_token: OTOKEN" And the file "../home/.config/hub" should contain "oauth_token: OTOKEN"
And the file "../home/.config/hub" should have mode "0600"
Scenario: Ask for username & password, re-use existing authorization Scenario: Ask for username & password, re-use existing authorization
Given the GitHub API server: Given the GitHub API server:
......
...@@ -124,3 +124,10 @@ Then /^there should be no "([^"]*)" remote$/ do |remote_name| ...@@ -124,3 +124,10 @@ Then /^there should be no "([^"]*)" remote$/ do |remote_name|
remotes = run_silent('git remote').split("\n") remotes = run_silent('git remote').split("\n")
remotes.should_not include(remote_name) remotes.should_not include(remote_name)
end end
Then /^the file "([^"]*)" should have mode "([^"]*)"$/ do |file, expected_mode|
prep_for_fs_check do
mode = File.stat(file).mode
mode.to_s(8).should =~ /#{expected_mode}$/
end
end
...@@ -297,7 +297,7 @@ module Hub ...@@ -297,7 +297,7 @@ module Hub
def save def save
FileUtils.mkdir_p File.dirname(@filename) FileUtils.mkdir_p File.dirname(@filename)
File.open(@filename, 'w') {|f| f << YAML.dump(@data) } File.open(@filename, 'w', 0600) {|f| f << YAML.dump(@data) }
end end
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册