bundler_audit_notifier 0.0.6 → 0.0.7

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: 02e1b895bd9b372142235bb973c3df0e0551f1857ef5cd7991b93431a929d533
4
- data.tar.gz: 1f9fa7a4d41567e5eaa1d93210acc58aaf3bbf0f2dbd961de7bf1a72b3d4ba94
3
+ metadata.gz: b03380d456fbced6f980ed440aba6dab76c1ff64df758c9c01a027b853dba4fe
4
+ data.tar.gz: d217dcd33669a7a8c4bf137d41fb7bbc9885dcf37af7f7b3b0c6c86d74d5db1f
5
5
  SHA512:
6
- metadata.gz: 87efd7b317c0dfd7971b455a8eaaa42170cb7716d9028559c2653ed52e02c2ffaf3a5c9faafe5c46c30250404e9d7f39d98ac490970176527a86b61471bafac3
7
- data.tar.gz: e02e9546b44ed147dc8017618e5dcec962dcdd144792068e9ec6d372b6eef166b94544fd4534b666a5f64483555a8850e6221db52f7752bf07e3f47a6c18c3c1
6
+ metadata.gz: 0b1f9056a5307b5e519ffa0356cabc9846362167dcff090859c788752cb2efc782b99aaa5f8a2ea6a6cf906d5ef385d2581d5bc6d9bd8642f55123999e4f9091
7
+ data.tar.gz: 0e49a1985f9728f9da180045a481b91910f9ed9fb1bd78bc5f73f741e928f565e159845da5ae6d11029d7ceec5f13519064f0539f57204a7933eddce5e0adf4d
@@ -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
@@ -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.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marley Stipich