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 +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +2 -2
- data/bin/opdotenv +2 -0
- data/lib/opdotenv/anyway_loader.rb +2 -2
- data/lib/opdotenv/connect_api_client.rb +12 -5
- data/lib/opdotenv/op_client.rb +7 -1
- data/lib/opdotenv/railtie.rb +3 -1
- data/lib/opdotenv/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ab16f9144c5c1ce14ba72552fb42fabdfa649be3fd30888cf9778cb85a107dca
|
|
4
|
+
data.tar.gz: 93da9bbea0c621726e3d9df051efeeb1dc3e9647653d11cb28501aa1bda3f901
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
[](https://badge.fury.io/rb/opdotenv) [](https://github.com/amkisko/opdotenv.rb/actions/workflows/ci.yml) [](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="
|
|
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
|
-
|
|
122
|
-
warn "[opdotenv]
|
|
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}):
|
|
264
|
+
raise ConnectApiError, "API error (#{code}): Server error"
|
|
265
265
|
else
|
|
266
|
-
|
|
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
|
|
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
|
-
|
|
277
|
+
# Only return known safe fields that are typically error messages
|
|
278
|
+
parsed["message"] || parsed["error"] || "Request failed"
|
|
273
279
|
rescue JSON::ParserError
|
|
274
|
-
|
|
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)
|
data/lib/opdotenv/op_client.rb
CHANGED
|
@@ -88,7 +88,13 @@ module Opdotenv
|
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
90
|
|
|
91
|
-
|
|
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
|
data/lib/opdotenv/railtie.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
data/lib/opdotenv/version.rb
CHANGED