opdotenv 1.0.1 → 1.0.2

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: 010e15bce13dd6d38d5c1d05871fe4a395cda0b9a68e0057045aec4f0bed6a15
4
- data.tar.gz: 46bf2e43e4b2df72bf1fbb739751dc170e16262a306b6a2373f1098571e00457
3
+ metadata.gz: ab16f9144c5c1ce14ba72552fb42fabdfa649be3fd30888cf9778cb85a107dca
4
+ data.tar.gz: 93da9bbea0c621726e3d9df051efeeb1dc3e9647653d11cb28501aa1bda3f901
5
5
  SHA512:
6
- metadata.gz: 9334e5fc25e01fee0fd7d9ffda74e8df98e598a6275a8ea740790e3dbabde7614eb17bc2f4afddeb37bb29ce10b65f94e63475e46e9f64552fc9699aa6309ffa
7
- data.tar.gz: 57d4a520a562d583e8fff85e3d9bf3944429d3442339dbbf44e75731a5f5abad819029606179d8667627836aa730b8424eac3fe21f39ddf81060e0bf36f44e12
6
+ metadata.gz: 82046c290a5d56508f7c51b49481d8c0442d41093da3a8fac56edc65361a58070ec629d8c3d52c866bab1fff93f7f04c953b54ef5cf999222f94f1b050aeca36
7
+ data.tar.gz: d8f041eaf6f2f309b9c2a5f7fda1dc50b5295c7d54f51c7897d1f96410a5667cc9b6a3a1ff700e06b8b05944cc8797ce88b9b0dc43d684ff927a042629161120
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.0.2 (2025-11-05)
4
+
5
+ - Enhance error handling and security measures across the codebase
6
+ - Improved error logging to avoid leaking sensitive information (uses exception class names instead of messages)
7
+ - Enhanced API error handling with generic messages for server errors to prevent sensitive data exposure
8
+ - Updated CLI output to clarify that secrets may be displayed intentionally for command-line usage
9
+ - Update Rails appraisals: remove support for Rails 6.0, 7.0, 7.1, 8.0; maintain support for Rails 6.1, 7.2, 8.1
10
+
3
11
  ## 1.0.1 (2025-11-05)
4
12
 
5
13
  - Add configurable op CLI path support
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # opdotenv
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/opdotenv.svg?v=1.0.0)](https://badge.fury.io/rb/opdotenv) [![Test Status](https://github.com/amkisko/opdotenv.rb/actions/workflows/ci.yml/badge.svg)](https://github.com/amkisko/opdotenv.rb/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/amkisko/opdotenv.rb/graph/badge.svg?token=U4FMVZGO8R)](https://codecov.io/gh/amkisko/opdotenv.rb)
3
+ [![Gem Version](https://badge.fury.io/rb/opdotenv.svg?v=1.0.2)](https://badge.fury.io/rb/opdotenv) [![Test Status](https://github.com/amkisko/opdotenv.rb/actions/workflows/ci.yml/badge.svg)](https://github.com/amkisko/opdotenv.rb/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/amkisko/opdotenv.rb/graph/badge.svg?token=U4FMVZGO8R)](https://codecov.io/gh/amkisko/opdotenv.rb)
4
4
 
5
5
  Load environment variables from 1Password using the `op` CLI or 1Password Connect Server API. Supports dotenv, JSON, and YAML formats.
6
6
 
7
7
  Sponsored by [Kisko Labs](https://www.kiskolabs.com).
8
8
 
9
9
  <a href="https://www.kiskolabs.com">
10
- <img src="https://brand.kiskolabs.com/images/logos/Kisko_Logo_Black_Horizontal-7249a361.svg" width="200" style="display: block; background: white; border-radius: 10px;" />
10
+ <img src="kisko.svg" width="200" alt="Sponsored by Kisko Labs" />
11
11
  </a>
12
12
 
13
13
  ## Installation
data/bin/opdotenv CHANGED
@@ -15,6 +15,8 @@ when "read"
15
15
  end.parse!(ARGV)
16
16
  abort("--path required") unless path
17
17
  data = Opdotenv::Loader.load(path)
18
+ # Note: This CLI intentionally outputs secrets to stdout for CLI usage
19
+ # This is expected behavior for the command-line tool
18
20
  puts Opdotenv::Exporter.serialize_by_format(data, :dotenv)
19
21
  when "export"
20
22
  path = file = nil
@@ -118,8 +118,8 @@ begin
118
118
  rescue => e
119
119
  # Only warn if debugging is enabled, as this is expected when Anyway Config isn't used
120
120
  if ENV["OPDOTENV_DEBUG"] == "true"
121
- warn "[opdotenv] Failed to register Anyway loader: #{e.message}"
122
- warn "[opdotenv] Error details: #{e.class}: #{e.message}"
121
+ # Avoid leaking exception messages
122
+ warn "[opdotenv] Failed to register Anyway loader: #{e.class}"
123
123
  warn "[opdotenv] Backtrace: #{e.backtrace.first(3).join("\n")}" if e.backtrace
124
124
  end
125
125
  end
@@ -261,17 +261,24 @@ module Opdotenv
261
261
  when 404
262
262
  raise ConnectApiError, "Not found: #{path}"
263
263
  when 500..599
264
- raise ConnectApiError, "API error (#{code}): #{extract_error_message(response)}"
264
+ raise ConnectApiError, "API error (#{code}): Server error"
265
265
  else
266
- raise ConnectApiError, "API error (#{code}): #{extract_error_message(response)}"
266
+ # Extract safe error message without leaking response body
267
+ safe_message = extract_safe_error_message(response)
268
+ raise ConnectApiError, "API error (#{code}): #{safe_message}"
267
269
  end
268
270
  end
269
271
 
270
- def extract_error_message(response)
272
+ def extract_safe_error_message(response)
273
+ # Only extract structured error messages from JSON responses
274
+ # Never include raw response body to avoid leaking secrets
275
+
271
276
  parsed = JSON.parse(response.body)
272
- parsed["message"] || parsed["error"] || response.body
277
+ # Only return known safe fields that are typically error messages
278
+ parsed["message"] || parsed["error"] || "Request failed"
273
279
  rescue JSON::ParserError
274
- response.body
280
+ # For non-JSON responses, return generic message to avoid leaking body
281
+ "Request failed"
275
282
  end
276
283
 
277
284
  def validate_url(url)
@@ -88,7 +88,13 @@ module Opdotenv
88
88
  end
89
89
  end
90
90
 
91
- raise OpError, out if status.nil? || !status.success?
91
+ if status.nil? || !status.success?
92
+ # Never leak command output in error messages for security
93
+ # Extract safe error information without exposing secrets
94
+ exit_code = status&.exitstatus || "unknown"
95
+ command_name = args.first || "op"
96
+ raise OpError, "Command failed: #{command_name} (exit code: #{exit_code})"
97
+ end
92
98
  out
93
99
  end
94
100
  end
@@ -54,7 +54,9 @@ module Opdotenv
54
54
  )
55
55
  rescue => e
56
56
  # Only log errors, not warnings, to avoid noise in production
57
- Rails.logger&.error("Opdotenv: Failed to load #{parsed[:path]}: #{e.message}")
57
+ # Never log exception messages that might contain secrets from command output
58
+ # Use exception class name instead of message for security
59
+ Rails.logger&.error("Opdotenv: Failed to load #{parsed[:path]}: #{e.class.name}")
58
60
  end
59
61
  end
60
62
  end
@@ -1,3 +1,3 @@
1
1
  module Opdotenv
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opdotenv
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - amkisko