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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b22d8ee331af638ddaff9a0eb524360616f6268a5308f090a36dc467af47924f
4
- data.tar.gz: 6d518e6ee22e631e35032c51b9099227ea0119b180656a12467332290836ad98
3
+ metadata.gz: c11cf7a1bf0dc41b9f3e971910236a64827ed596c1f17ea97f1751332cf7f083
4
+ data.tar.gz: 7ca9600278e512fbbe1339109e7d55b35df4cb60939cc7d196ccd0ba10a5529d
5
5
  SHA512:
6
- metadata.gz: 8d22a850752966bac3ae2025769045708107afb2c7fc8221cc617853828964569f83c5d5347c827dd06d3fff9fdd563777a600e6499aeef33af6f0a7a61a12c2
7
- data.tar.gz: f6a8086ad4d45e971151c50c8a1df9e103de75931b1f5c414e315fcd0f861fae9be637aee12e5365b5b89fea9432ba150e884cfc9ddebc085a3833e2b3bf63b8
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
@@ -5,7 +5,7 @@
5
5
  </head>
6
6
  <body>
7
7
  <h1>Vulnerabilities: </h1>
8
- <%= @vulnerabilities.each do |line| %>
8
+ <% @vulnerabilities.each do |line| %>
9
9
  <ul>
10
10
  <li> Name: <%= line[:name].to_s.html_safe %></li>
11
11
  <li> Version: <%= line[:version].to_s.html_safe %></li>
@@ -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, "lib/auditer_script.rb", :out => w, :err => [:child, :out])
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.5
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marley Stipich