newrelic_security 0.4.0 → 0.4.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/.github/workflows/pr_ci.yml +2 -2
- data/.github/workflows/release.yml +44 -27
- data/.rubocop_todo.yml +165 -199
- data/CHANGELOG.md +8 -0
- data/Gemfile_test +2 -0
- data/lib/newrelic_security/instrumentation-security/pg/instrumentation.rb +1 -1
- data/lib/newrelic_security/version.rb +1 -1
- metadata +2 -4
- data/.github/workflows/scripts/rubygems-authenticate.py +0 -13
- data/.github/workflows/scripts/rubygems-publish.rb +0 -33
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# New Relic Ruby Security Agent Release Notes
|
|
2
2
|
|
|
3
|
+
## v0.4.2
|
|
4
|
+
|
|
5
|
+
- Chore: Publish gem via RubyGems Trusted Publishing, removing long-lived API key and MFA secrets [PR#170](https://github.com/newrelic/csec-ruby-agent/pull/170)
|
|
6
|
+
|
|
7
|
+
## v0.4.1
|
|
8
|
+
|
|
9
|
+
- Bugfix: Fix for potential SQL injection in the pg exec_prepared statement-name lookup, flagged by CodeQL as rb/shell-command-constructed-from-input [PR#167](https://github.com/newrelic/csec-ruby-agent/pull/167)
|
|
10
|
+
|
|
3
11
|
## v0.4.0
|
|
4
12
|
|
|
5
13
|
Version 0.4.0 introuduces Rack framework support, GraphQL support & CI/CD integration as part of security. Updated json_version: **1.2.9**
|
data/Gemfile_test
CHANGED
|
@@ -14,12 +14,14 @@ gem 'rubocop-minitest'
|
|
|
14
14
|
gem 'rubocop-rake'
|
|
15
15
|
gem 'simplecov'
|
|
16
16
|
gem 'concurrent-ruby', '1.3.4'
|
|
17
|
+
gem 'json', '< 3' # activesupport <= 8.0 passes quirks_mode: to JSON.generate, removed in json 3.0
|
|
17
18
|
gem 'railties'
|
|
18
19
|
gem 'ffi', '1.15.5' if RUBY_VERSION < '3.1.0'
|
|
19
20
|
if RUBY_VERSION >= '3.0.0'
|
|
20
21
|
gem 'rails', '~>6.0.0'
|
|
21
22
|
elsif RUBY_VERSION < '2.5.0'
|
|
22
23
|
gem 'rails', '~>4'
|
|
24
|
+
gem 'bigdecimal', '< 2.0' # rails ~>4's activesupport calls BigDecimal.new, removed in bigdecimal 2.0
|
|
23
25
|
else
|
|
24
26
|
gem 'rails'
|
|
25
27
|
end
|
|
@@ -75,7 +75,7 @@ module NewRelic::Security
|
|
|
75
75
|
NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
|
|
76
76
|
hash = {}
|
|
77
77
|
hash[:sql] = NewRelic::Security::Agent::Control::HTTPContext.get_context.cache[args[0].to_s] if NewRelic::Security::Agent::Control::HTTPContext.get_context
|
|
78
|
-
hash[:sql] = self.exec("select statement from pg_prepared_statements where name =
|
|
78
|
+
hash[:sql] = self.exec("select statement from pg_prepared_statements where name = #{escape_literal(args[0].to_s)}").getvalue(0,0) unless hash[:sql]
|
|
79
79
|
hash[:parameters] = args[1].map(&:to_s)
|
|
80
80
|
event = NewRelic::Security::Agent::Control::Collector.collect(SQL_DB_COMMAND, [hash], POSTGRES) unless NewRelic::Security::Instrumentation::InstrumentationUtils.sql_filter_events?(hash[:sql])
|
|
81
81
|
NewRelic::Security::Agent::Control::HTTPContext.get_context.cache.delete(args[0].to_s) if NewRelic::Security::Agent::Control::HTTPContext.get_context
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: newrelic_security
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Prateek Sen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-11-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: newrelic_rpm
|
|
@@ -126,8 +126,6 @@ files:
|
|
|
126
126
|
- ".github/workflows/release.yml"
|
|
127
127
|
- ".github/workflows/repolinter.yml"
|
|
128
128
|
- ".github/workflows/rubocop.yml"
|
|
129
|
-
- ".github/workflows/scripts/rubygems-authenticate.py"
|
|
130
|
-
- ".github/workflows/scripts/rubygems-publish.rb"
|
|
131
129
|
- ".gitignore"
|
|
132
130
|
- ".rubocop.yml"
|
|
133
131
|
- ".rubocop_todo.yml"
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
import argparse
|
|
4
|
-
import onetimepass
|
|
5
|
-
|
|
6
|
-
if __name__ == '__main__':
|
|
7
|
-
|
|
8
|
-
parser = argparse.ArgumentParser(
|
|
9
|
-
description='Generate a one-time password from a key'
|
|
10
|
-
)
|
|
11
|
-
parser.add_argument('env_var', type=str, help='The name of the environment variable from which to load the MFA key from the service')
|
|
12
|
-
args = parser.parse_args()
|
|
13
|
-
print(onetimepass.get_totp(os.getenv(args.env_var)))
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
gem_name = ARGV[0]
|
|
3
|
-
raise "gem name sans version must be supplied" if gem_name.to_s == ""
|
|
4
|
-
|
|
5
|
-
api_key = ENV["GEM_HOST_API_KEY"]
|
|
6
|
-
raise "GEM_HOST_API_KEY must be set" if api_key.to_s == ""
|
|
7
|
-
|
|
8
|
-
version = ENV["VERSION"]
|
|
9
|
-
raise "VERSION environment must be set" if version.to_s == ""
|
|
10
|
-
|
|
11
|
-
gem_filename = "#{gem_name}-#{version}.gem"
|
|
12
|
-
raise "#{gem_filename} is missing!" unless File.exist?(gem_filename)
|
|
13
|
-
|
|
14
|
-
otp = ENV["RUBYGEMS_OTP"]
|
|
15
|
-
raise "RUBYGEMS_OTP environment must be set" if otp.to_s == ""
|
|
16
|
-
|
|
17
|
-
puts "Publishing the #{gem_filename} file..."
|
|
18
|
-
cmd = "gem push --otp #{otp} #{gem_filename}"
|
|
19
|
-
puts "executing: #{cmd}"
|
|
20
|
-
|
|
21
|
-
result = `#{cmd}`
|
|
22
|
-
if $?.to_i.zero?
|
|
23
|
-
puts "#{gem_filename} successfully pushed to rubygems.org!"
|
|
24
|
-
else
|
|
25
|
-
if result.include?('Repushing of gem versions is not allowed')
|
|
26
|
-
puts "Pushing #{gem_filename} skipped because this version is already published to rubygems.org!"
|
|
27
|
-
exit 0
|
|
28
|
-
else
|
|
29
|
-
puts "#{gem_filename} failed to push to rubygems.org!"
|
|
30
|
-
puts result
|
|
31
|
-
exit 1
|
|
32
|
-
end
|
|
33
|
-
end
|