bundler_audit_notifier 0.0.6 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8824f8dc78d31f52f2067355a468651f905312d8dde249c503408b3e7314e2d4
|
4
|
+
data.tar.gz: d4ac54af68ffbab771b7203d814c323f0697b58d8d092acc653f9625a3538055
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d7a275d972a7ee96aebe564f4432d1e8aed27d7a5a70c9e3508b632f0179c7456bbed0de694b275c62473e5b0e1e04dac124af6faacdb71840c2f19cdcbbd41
|
7
|
+
data.tar.gz: e05db70c969a51a956ce39453e6686cf1ca291dc3da729ba1feec5fb5c57ceef7663545122806e2014d88ef6997e8ef4961695a5b863d85166b824d72ca93b7b
|
@@ -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
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bundler_audit_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marley Stipich
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: sqlite3
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: rails
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,6 +134,20 @@ dependencies:
|
|
148
134
|
- - ">="
|
149
135
|
- !ruby/object:Gem::Version
|
150
136
|
version: '0'
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: sqlite3
|
139
|
+
requirement: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
type: :development
|
145
|
+
prerelease: false
|
146
|
+
version_requirements: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
151
|
description:
|
152
152
|
email:
|
153
153
|
executables: []
|