From c152086fad713d7367b990531600ee428399a95c Mon Sep 17 00:00:00 2001 From: Brendan McDevitt Date: Wed, 6 Apr 2022 02:21:18 -0500 Subject: [PATCH] small adjustment to the way the inthewild_cve_exploits earliest_report data is stored --- app/controllers/inthewild_cve_exploits_controller.rb | 5 +++-- config/routes.rb | 3 ++- db/migrate/20220406064613_inthewild_cve_exploits.rb | 4 +++- db/schema.rb | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/controllers/inthewild_cve_exploits_controller.rb b/app/controllers/inthewild_cve_exploits_controller.rb index 6ed6ef4..c4ac4a3 100644 --- a/app/controllers/inthewild_cve_exploits_controller.rb +++ b/app/controllers/inthewild_cve_exploits_controller.rb @@ -1,10 +1,11 @@ class InthewildCveExploitsController < ApplicationController def index @cves = InthewildCveExploit.all + render json: @cves.to_json end def show - @cve = InthewildCveExploit.find_by(:id => params[:cve_id]) - render json: @poc.to_json + @cve = InthewildCveExploit.find_by(:cve_id => params[:cve_id]) + render json: @cve.to_json end end diff --git a/config/routes.rb b/config/routes.rb index f29951e..0ed9775 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -11,5 +11,6 @@ Rails.application.routes.draw do get "/github_pocs/:id", to: "github_pocs#show" get "/github_pocs/cve/:cve_id", to: "github_pocs#show_for_cve" - get "inthewild/cve/:cve_id", to: "inthewild_exploitations#show" + get "/inthewild_cve_exploits", to: "inthewild_cve_exploits#index" + get "/inthewild_cve_exploits/:cve_id", to: "inthewild_cve_exploits#show" end diff --git a/db/migrate/20220406064613_inthewild_cve_exploits.rb b/db/migrate/20220406064613_inthewild_cve_exploits.rb index 773f13e..2bcf49a 100644 --- a/db/migrate/20220406064613_inthewild_cve_exploits.rb +++ b/db/migrate/20220406064613_inthewild_cve_exploits.rb @@ -2,7 +2,9 @@ class InthewildCveExploits < ActiveRecord::Migration[7.0] def change create_table :inthewild_cve_exploits do |t| t.string :cve_id - t.date :earliest_report + # i think maybe making a string is better for now for the earliestReport data + t.string :earliest_report + #t.date :earliest_report end end end diff --git a/db/schema.rb b/db/schema.rb index 8a6816a..972c76e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -66,7 +66,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_04_06_064613) do create_table "inthewild_cve_exploits", force: :cascade do |t| t.string "cve_id" - t.date "earliest_report" + t.string "earliest_report" end end