bundler_audit_notifier 0.0.5 → 0.0.10
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/app/controllers/bundler_audit_issues_controller.rb +17 -0
- data/app/views/bundler_audit_issues_mailer/vulnerability_email.html.erb +1 -1
- data/lib/bundler_audit_notifier.rb +3 -2
- data/lib/generators/bundler_audit_notifier/bundler_audit_notifier_generator.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: c11cf7a1bf0dc41b9f3e971910236a64827ed596c1f17ea97f1751332cf7f083
|
4
|
+
data.tar.gz: 7ca9600278e512fbbe1339109e7d55b35df4cb60939cc7d196ccd0ba10a5529d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6b296635417383f6909b330faa1b110898deeff596df6a54ff14fe643c51f7a1d2e6e85f0d4a13fb01ba3453b426d13dbf18af95eb3b448beed4ef0f5dddda8
|
7
|
+
data.tar.gz: a62eefcc8c3ace178916dfc72d6756a992ee44ca59aaae083aa956542495a2d366492265172c990a1d4a887548e4949bda1939cb8a0eef574b0725bec260f31c
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class BundlerAuditIssuesController < ActionController::Base
|
2
|
+
before_action :authenticate, only: [:ignore]
|
3
|
+
|
2
4
|
def ignore
|
3
5
|
@bundler_audit_issue = BundlerAuditIssue.where(token: params[:token]).first
|
4
6
|
@bundler_audit_issue.ignore = true
|
@@ -6,8 +8,23 @@ class BundlerAuditIssuesController < ActionController::Base
|
|
6
8
|
render :ignore
|
7
9
|
end
|
8
10
|
end
|
11
|
+
|
9
12
|
private
|
10
13
|
|
14
|
+
def authenticate
|
15
|
+
if params[:token].present?
|
16
|
+
bundler_audit_issue = BundlerAuditIssue.where(token: params[:token]).first
|
17
|
+
if bundler_audit_issue
|
18
|
+
::Rails.logger.info("Authorized accesss to api for bundler audit issue: #{params[:token]}")
|
19
|
+
return true
|
20
|
+
else
|
21
|
+
::Rails.logger.warn("Unauthorized accesss to api for bundler audit issue: #{params[:token]}")
|
22
|
+
head :unauthorized
|
23
|
+
return false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
11
28
|
def bundler_audit_issue_params
|
12
29
|
params.require(:bundler_audit_issue).permit(:name, :version, :advisory, :token, :criticality, :url, :title, :solution, :ignore)
|
13
30
|
end
|
@@ -2,15 +2,16 @@
|
|
2
2
|
require "active_support"
|
3
3
|
require 'rake'
|
4
4
|
require "bundler_audit_notifier/engine"
|
5
|
-
require "auditer_script"
|
6
5
|
|
7
6
|
module BundlerAuditNotifier
|
8
7
|
def self.audit_parse
|
9
8
|
r, w = IO.pipe
|
9
|
+
audit_script_file = File.join(File.dirname(__FILE__), 'auditer_script.rb')
|
10
10
|
# Spawn executes specified command and return its pid
|
11
11
|
# This line will execute code that runs bundler-audit and then write the output into the IO pipe
|
12
12
|
# Spawning a process to read the output of bundler-audit update and check because after the commands finish running exit 1 is called and the output can no longer be read.
|
13
|
-
pid = spawn(RbConfig.ruby,
|
13
|
+
pid = spawn(RbConfig.ruby, audit_script_file, :out => w, :err => [:child, :out])
|
14
|
+
|
14
15
|
Process.wait2(pid)
|
15
16
|
w.close
|
16
17
|
# At this point, the results of the bundler-audit check command are written in the IO pipe
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Run this command to generate migration: rails generate bundler_audit_notifier
|
1
|
+
# Run this command to generate migration: rails generate bundler_audit_notifier:bundler_audit_notifier
|
2
2
|
require "rails/generators/active_record"
|
3
3
|
require "rails/generators"
|
4
4
|
module BundlerAuditNotifier
|