newrelic_security 0.4.1 → 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/release.yml +44 -27
- data/CHANGELOG.md +4 -0
- data/Gemfile_test +1 -0
- 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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cb2b9eb9b3fa826a6ce2a115d67ee4eaa157e8afe902aecce040dace93d7ac51
|
|
4
|
+
data.tar.gz: 9cc4b2468a6d84423efd65909731357c1a9f34e628475c8fece4562460499ba3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e63de0976aa1266d76a67d7b47bd6d5199ec6984704676c1120d5353c379be0cef61dc2f606a26656950d7c9ce39385371281221feec3a065aeb73b5eb2f90a1
|
|
7
|
+
data.tar.gz: 24a02159c93530d038a81d4072e0aa33ab4dc68299f1e729599aeb69cf2c5096e23b439913127cd5c15aa38804fcfdf3a9b0139168198d0edb2c6ffdf202a39e
|
|
@@ -5,47 +5,64 @@ on:
|
|
|
5
5
|
branches:
|
|
6
6
|
- main
|
|
7
7
|
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
8
11
|
jobs:
|
|
9
|
-
|
|
10
|
-
runs-on: ubuntu-
|
|
12
|
+
publish:
|
|
13
|
+
runs-on: ubuntu-24.04 # pinned: setup-ruby v1.195.0 predates ubuntu-26.04
|
|
14
|
+
environment: release
|
|
11
15
|
permissions:
|
|
12
|
-
contents:
|
|
13
|
-
|
|
16
|
+
contents: read
|
|
17
|
+
id-token: write # RubyGems trusted publishing (OIDC)
|
|
18
|
+
outputs:
|
|
19
|
+
version: ${{ steps.version.outputs.VERSION }}
|
|
14
20
|
steps:
|
|
15
21
|
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # tag v4.1.2
|
|
16
22
|
with:
|
|
17
|
-
|
|
23
|
+
persist-credentials: false
|
|
18
24
|
|
|
19
25
|
- uses: ruby/setup-ruby@086ffb1a2090c870a3f881cc91ea83aa4243d408 # v1.195.0
|
|
20
26
|
with:
|
|
21
27
|
ruby-version: 3.2
|
|
22
28
|
|
|
23
|
-
- name:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- name: Configure gem credentials
|
|
27
|
-
run: |
|
|
28
|
-
echo "GEM_HOST_API_KEY=${{ secrets.RUBYGEMS_API_KEY }}" >> $GITHUB_ENV
|
|
29
|
-
echo "RUBYGEMS_MFA_KEY=${{ secrets.RUBYGEMS_MFA_KEY }}" >> $GITHUB_ENV
|
|
29
|
+
- name: Determine version
|
|
30
|
+
id: version
|
|
31
|
+
run: echo "VERSION=$(ruby -r ./lib/newrelic_security/version -e 'puts NewRelic::Security::VERSION')" >> "$GITHUB_OUTPUT"
|
|
30
32
|
|
|
31
33
|
- name: Build newrelic_security gem
|
|
32
34
|
run: gem build newrelic_security.gemspec
|
|
33
35
|
|
|
34
|
-
- name:
|
|
35
|
-
|
|
36
|
-
echo "VERSION=$(ls newrelic_security-*.gem | ruby -pe 'sub(/newrelic_security\-(.*).gem/, "\\1")')" >> $GITHUB_ENV
|
|
37
|
-
|
|
38
|
-
- name: Create github release
|
|
39
|
-
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # tag v0.1.15
|
|
40
|
-
if: $(git tag -l ${{ env.VERSION }}) == false
|
|
41
|
-
with:
|
|
42
|
-
tag_name: ${{ env.VERSION }}
|
|
43
|
-
env:
|
|
44
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
45
|
-
|
|
46
|
-
- name: Obtain OTP to publish newrelic_security to rubygems.org
|
|
47
|
-
run: echo "RUBYGEMS_OTP=$(python ./.github/workflows/scripts/rubygems-authenticate.py RUBYGEMS_MFA_KEY)" >> $GITHUB_ENV
|
|
36
|
+
- name: Configure RubyGems trusted publishing credentials
|
|
37
|
+
uses: rubygems/configure-rubygems-credentials@dc5a8d8553e6ee01fc26761a49e99e733d17954a # tag v2.1.0
|
|
48
38
|
|
|
49
39
|
- name: Publish newrelic_security to rubygems.org
|
|
50
|
-
run:
|
|
40
|
+
run: |
|
|
41
|
+
if ! output=$(gem push newrelic_security-*.gem 2>&1); then
|
|
42
|
+
echo "$output"
|
|
43
|
+
echo "$output" | grep -q 'Repushing of gem versions is not allowed' || exit 1
|
|
44
|
+
echo "Version already published, skipping"
|
|
45
|
+
else
|
|
46
|
+
echo "$output"
|
|
47
|
+
fi
|
|
51
48
|
|
|
49
|
+
github-release:
|
|
50
|
+
needs: [publish]
|
|
51
|
+
runs-on: ubuntu-latest
|
|
52
|
+
permissions:
|
|
53
|
+
contents: write
|
|
54
|
+
env:
|
|
55
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
56
|
+
VERSION: ${{ needs.publish.outputs.version }}
|
|
57
|
+
steps:
|
|
58
|
+
- name: Create github release
|
|
59
|
+
run: |
|
|
60
|
+
if gh release view "$VERSION" --repo "$GITHUB_REPOSITORY" > /dev/null 2>&1; then
|
|
61
|
+
echo "Release $VERSION already exists, skipping"
|
|
62
|
+
else
|
|
63
|
+
gh release create "$VERSION" \
|
|
64
|
+
--repo "$GITHUB_REPOSITORY" \
|
|
65
|
+
--target "$GITHUB_SHA" \
|
|
66
|
+
--title "$VERSION" \
|
|
67
|
+
--notes ''
|
|
68
|
+
fi
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
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
|
+
|
|
3
7
|
## v0.4.1
|
|
4
8
|
|
|
5
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)
|
data/Gemfile_test
CHANGED
|
@@ -14,6 +14,7 @@ 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'
|
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: 2026-
|
|
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
|