timet 1.5.8 → 1.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0426dff5bb0b43529afe26f4f3f9f751a43c8ce59a76add257c4da1dceda91e
4
- data.tar.gz: 5bb737c4d928d378997df4e40543e52dd7c2eb631beea39f1c3e8dc3c0231b9b
3
+ metadata.gz: 9e5079b49daa5deed838350e66235ce5301518e928a478f405423f268e431390
4
+ data.tar.gz: e7ef91dd990022437605bdfe406387e1499b9d08de5f6c233211332d9cb5ea0d
5
5
  SHA512:
6
- metadata.gz: 900a95c16f624f45c314af3edacefd58902c5225a0cde0010350ed9b57a83ed69345a7c3744935f082793a8f010efe0d87c5d81d7bee2c621542746a19bb2f96
7
- data.tar.gz: 34c77eb47e0f443f33930cb037febdd0b0d298370f56f3553b861b9aff321edc6aed632df055359a924db5a77d86c3cbf967249cc66e308a3fcc8e94eef58626
6
+ metadata.gz: a6f4a1db83a82e0a0e53787a1b8847b7ceaa2694e0e4fbe318271bfc00a33c078d525d832f3be0b136d11c9b4a580ff3648ef9a1064e8921be6d7e79cb59c910
7
+ data.tar.gz: 7cd3c8513a161e3864501cec96317b833bdda14d937779b97d0feb680a894284f34d7427ba1197ad8ca0a721ede075b13b549489e5beaaa1cbfb751fa71f927f
data/.deepsource.toml ADDED
@@ -0,0 +1,13 @@
1
+ version = 1
2
+
3
+ [[analyzers]]
4
+ name = "ruby"
5
+ enabled = true
6
+
7
+ [[analyzers]]
8
+ name = "test-coverage"
9
+ enabled = true
10
+
11
+ [coverage]
12
+ reporter = "simplecov"
13
+ paths = ["coverage/.resultset.json"]
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## [1.5.9] - 2025-07-30
2
+
3
+ **Improvements:**
4
+
5
+ - Replaced Code Climate with DeepSource for static analysis and test coverage reporting.
6
+ - Updated the CI workflow by removing Code Climate steps and adding a .deepsource.toml configuration file.
7
+ - Updated gem dependencies, including rubocop, thor, and various aws-sdk gems.
8
+ - Refactored application.rb to use abort for more idiomatic error handling on invalid arguments.
9
+ - Updated the README to replace the old Code Climate badges with a new DeepSource badge.
10
+
11
+ **Bug fixes:**
12
+
13
+ - Fixed a shell injection vulnerability in application_helper.rb by properly escaping notification messages using Shellwords.shellescape.
14
+ - Corrected a timezone-related issue in time_validation_helper.rb by using Time.now.getlocal for future date validation.
15
+
1
16
  ## [1.5.8] - 2025-06-28
2
17
 
3
18
  **Improvements:**
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/timet.svg)](https://badge.fury.io/rb/timet)
2
2
  ![timet workflow](https://github.com/frankvielma/timet/actions/workflows/ci.yml/badge.svg)
3
- [![Maintainability](https://api.codeclimate.com/v1/badges/44d57b6c561b9be717f5/maintainability)](https://codeclimate.com/github/frankvielma/timet/maintainability)
4
- [![Test Coverage](https://api.codeclimate.com/v1/badges/44d57b6c561b9be717f5/test_coverage)](https://codeclimate.com/github/frankvielma/timet/test_coverage)
5
-
3
+ [![DeepSource](https://app.deepsource.com/gh/frankvielma/timet.svg/?label=active+issues&show_trend=true&token=RV8_VCNrXIfEU7NL9mk9MSuP)](https://app.deepsource.com/gh/frankvielma/timet/)
6
4
  # Timet
7
5
 
8
6
  ![Timet](timet.webp)
@@ -85,8 +85,7 @@ module Timet
85
85
  if VALID_ARGUMENTS.include?(command_name)
86
86
  @db = Database.new
87
87
  else
88
- warn 'Invalid arguments provided. Please check your input.'
89
- exit(1)
88
+ abort 'Invalid arguments provided. Please check your input.'
90
89
  end
91
90
  end
92
91
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'shellwords'
4
+
3
5
  module Timet
4
6
  # Provides helper methods for the Timet application.
5
7
  module ApplicationHelper
@@ -109,7 +111,8 @@ module Timet
109
111
  # @param tag [String] A tag or label for the session, used in the notification message.
110
112
  # @return [void]
111
113
  def run_linux_session(time, tag)
112
- notification_command = "notify-send --icon=clock '#{show_message(tag)}'"
114
+ escaped_message = Shellwords.shellescape(show_message(tag))
115
+ notification_command = "notify-send --icon=clock #{escaped_message}"
113
116
  command = "sleep #{time} && tput bel && tt stop 0 && #{notification_command} &"
114
117
  pid = Kernel.spawn(command)
115
118
  Process.detach(pid)
@@ -121,7 +124,10 @@ module Timet
121
124
  # @param _tag [String] A tag or label for the session, not used in the notification message on macOS.
122
125
  # @return [void]
123
126
  def run_mac_session(time, tag)
124
- notification_command = "osascript -e 'display notification \"#{show_message(tag)}\"'"
127
+ # Escape double quotes and backslashes for AppleScript, then shell-escape the entire AppleScript command
128
+ escaped_message_for_applescript = show_message(tag).gsub('\\', '\\\\').gsub('"', '\"')
129
+ escaped_applescript_command = Shellwords.shellescape("display notification \"#{escaped_message_for_applescript}\"")
130
+ notification_command = "osascript -e #{escaped_applescript_command}"
125
131
  command = "sleep #{time} && afplay /System/Library/Sounds/Basso.aiff && tt stop 0 && #{notification_command} &"
126
132
  pid = Kernel.spawn(command)
127
133
  Process.detach(pid)
@@ -103,9 +103,10 @@ module Timet
103
103
  #
104
104
  # @raise [ArgumentError] If the new datetime is in the future.
105
105
  def validate_future_date(new_datetime)
106
- return unless new_datetime > Time.now
106
+ # Ensure the new datetime is not in the future relative to the current time.
107
+ return unless new_datetime > Time.now.getlocal
107
108
 
108
- raise ArgumentError, "Cannot set time to a future date: #{new_datetime.strftime('%Y-%m-%d %H:%M:%S')}"
109
+ raise ArgumentError, "Cannot set time to a future date or time: #{new_datetime.strftime('%Y-%m-%d %H:%M:%S')}"
109
110
  end
110
111
 
111
112
  # Validates that the difference between two timestamps is less than 24 hours.
data/lib/timet/version.rb CHANGED
@@ -6,6 +6,6 @@ module Timet
6
6
  # @return [String] The version number in the format 'major.minor.patch'.
7
7
  #
8
8
  # @example Get the version of the Timet application
9
- # Timet::VERSION # => '1.5.8'
10
- VERSION = '1.5.8'
9
+ # Timet::VERSION # => '1.5.9'
10
+ VERSION = '1.5.9'
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.8
4
+ version: 1.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Vielma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-28 00:00:00.000000000 Z
11
+ date: 2025-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -123,6 +123,7 @@ executables:
123
123
  extensions: []
124
124
  extra_rdoc_files: []
125
125
  files:
126
+ - ".deepsource.toml"
126
127
  - ".reek.yml"
127
128
  - ".rspec"
128
129
  - ".rubocop.yml"