From d72acba22c6e3fab0c64f99c2dc603aca34dfadd Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Fri, 8 Apr 2022 17:35:56 +0300 Subject: [PATCH] check file permissions --- HISTORY.md | 3 ++- src/pmng.cr | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index b04484f..bb19684 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -7,7 +7,7 @@ - ♻️ - Edited ## 0.2.2 - [08/04/2022] -- 🐛 - Before label emoji not insert space symbol (temponary change emoji) +- ➕ - Added password file check permissions - ➕ - Added title by start program - ➕ - Added clear terminal by new search - ➕ - Added by start&close program clear terminal @@ -15,6 +15,7 @@ - ➕ - Added emoji to output - ✔️ - Fixed BYE emoji color - ♻️ - Edited URL color & style output +- 🐛 - Before label emoji not insert space symbol (temponary change emoji) ## 0.2.1 - [14/03/2022] - ➕ - prompt '>' set color green diff --git a/src/pmng.cr b/src/pmng.cr index 3288dd7..d637af6 100644 --- a/src/pmng.cr +++ b/src/pmng.cr @@ -80,6 +80,15 @@ while count < yaml.size count += 1 end +# check file ppermissions +password_file_permissions = File.info(password_file_path).permissions.to_s + +if /\d{3}/.match(password_file_permissions).try &.[0] != "600" + puts "Password file permissions is not RW for you.".colorize(:red) + + exit(1) +end + # pmng title system "clear" puts "The very simple password manager for humans".colorize(:yellow).mode(:bold) @@ -142,7 +151,8 @@ while loop puts item.email.colorize(:red) end if !item.login.blank? - print "🏷️ " + # print "🏷️ " # Bug + print "🗿 " puts item.login.colorize(:yellow) end if !item.password.blank?