csp_report 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -13
  3. data/app/controllers/csp_report/csp_reports_controller.rb +11 -3
  4. data/app/models/csp_report/csp_report.rb +2 -0
  5. data/app/views/csp_report/csp_reports/index.html.haml +11 -0
  6. data/config/routes.rb +4 -1
  7. data/db/migrate/20130630091108_create_csp_report_csp_reports.rb +3 -3
  8. data/db/migrate/20130712162922_add_incoming_ip_to_csp_report_csp_reports.rb +13 -0
  9. data/lib/csp_report/version.rb +1 -1
  10. data/lib/generators/csp_report/csp_declaration_generator.rb +23 -0
  11. data/spec/controllers/csp_report/csp_reports_controller_spec.rb +61 -2
  12. data/spec/dummy/config/routes.rb +1 -1
  13. data/spec/dummy/db/development.sqlite3 +0 -0
  14. data/spec/dummy/db/schema.rb +12 -1
  15. data/spec/dummy/db/test.sqlite3 +0 -0
  16. data/spec/dummy/log/development.log +134 -0
  17. data/spec/dummy/log/test.log +11806 -0
  18. data/spec/dummy/tmp/cache/assets/test/sass/745019acb880ec9412f97713489f02ba42209a06/csp_report.css.sassc +0 -0
  19. data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  20. data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  21. data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  22. data/spec/dummy/tmp/cache/assets/test/sprockets/4949b199f7a3f61704ee406dfc99e38c +0 -0
  23. data/spec/dummy/tmp/cache/assets/test/sprockets/9b94cd42c6d3c0778772d609a4d7006d +0 -0
  24. data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  25. data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  26. data/spec/dummy/tmp/cache/assets/test/sprockets/dc4c1ce2dc434402713320ef23981262 +0 -0
  27. data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  28. data/spec/factories/csp_report_csp_reports.rb +16 -8
  29. data/spec/features/csp_report/csp_reports_index_spec.rb +81 -0
  30. data/spec/generators/csp_report/install_generators_spec.rb +35 -5
  31. data/spec/models/csp_report/csp_report_spec.rb +111 -3
  32. data/spec/spec_helper.rb +39 -8
  33. metadata +45 -5
  34. data/lib/tasks/csp_report_tasks.rake +0 -4
  35. data/lib/tasks/install.thor +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 438b12fe66495e47c46a9950948fd74f8bdc18fa
4
- data.tar.gz: a6b5bf930f89cd10b4d5cf25d974b83c9bd19091
3
+ metadata.gz: ebd08245ed070e2fe95b8eef4524cbbf7dc2eef4
4
+ data.tar.gz: 96eb326064d28084640d97e2be95808e47236c1b
5
5
  SHA512:
6
- metadata.gz: efca6558189f2bf33beff60a2f8765ce797d7914a742a8108a400b65d64eba615bc206105a562651eab92f5c3074514a68697a980402388db83bc979340219b6
7
- data.tar.gz: 29c49b95580f86c5c338e2d8e85ca33905f34ef4679e4ccdcaaca8aa27381c0a9e73792081638d54fe71044d69ab0d491bfc5cb3ae8207f24623e04f0f19f1bf
6
+ metadata.gz: f4f67883694f41aa1442dfe5fbd42f79f75dcd03aa85b18fe63ecd5cd70925683981ce6674a2f273856c5bf9b1907030dfdbefe421ea4f2e317802ddf3318a03
7
+ data.tar.gz: 0181a83dc39ee702a79f5148c2cf0b273bd8b214db627beee84a805d4e471fa57a54235794da91cb9be6279254bb8c021ce504cf4f15b5b1cd87c62382472396
data/README.md CHANGED
@@ -10,6 +10,21 @@ This is a rough cut gem for the moment. It won't look like much in the report
10
10
  page. However, elements have a class so you can add some CSS style before I
11
11
  add some clean ones in the gem.
12
12
 
13
+ I promise something cleaner when I'll get to v1 and when the W3C will have
14
+ finalized the spec.
15
+
16
+ Upgrade from 0.1.x
17
+ ==================
18
+
19
+ CAREFUL, 0.2.0 comes with DB changes. I won't do that in a minor after we are at
20
+ v1, but for the moment, I thought it would not trouble too many people.
21
+
22
+ Make sure to run
23
+ + rake csp\_report:install:migrations
24
+ + rake db:migrate
25
+
26
+ before continuing
27
+
13
28
  What is CSP
14
29
  ===========
15
30
 
@@ -33,33 +48,37 @@ Features
33
48
  ========
34
49
 
35
50
  * Provides a *csp_report* resource that stores the reported violations.
51
+ * Displays the violation for analysis
52
+ * Future: provide visualization aids on the report data
36
53
 
37
54
  Install
38
55
  =======
39
56
 
40
57
  1. In your *Gemfile*, add the following
41
-
42
58
  ```
43
59
  gem csp_report
44
60
  ```
45
-
46
61
  Don't forget to run `bundle install` afterwards
47
62
 
48
- 2. Run the generator
49
-
63
+ 1. Run the generator
50
64
  ```shell
51
65
  rails generate csp_report:install
52
66
  ```
53
-
54
- It retrieve the db migration files from the gem and install them
55
- It mounts the gem routes in the application
56
-
67
+ It retrieve the db migration files from the gem and install them
68
+ It mounts the gem routes in the application
57
69
  *Don't forget to run the `rake db:migrate` command*
58
70
 
59
- 3. You need to configure a CSP on your server response, with the *report_uri*
71
+ 1. **EASY INSTALL**: use the helper generator to get your CSP directive skeleton.
72
+ Execute
73
+ ```shell
74
+ rails generate csp_report:csp_declaration
75
+ ```
76
+ You can then customize the directive in the ApplicationController.
77
+
78
+ 1. *(If you have not followed the previous step)* You need to configure a CSP on your
79
+ server response, with the *report_uri*
60
80
  parameters pointing to the configured REST resource above. Following the setup
61
81
  above, one solution is to find this in your application_controller.rb file:
62
-
63
82
  ```ruby
64
83
  class ApplicationController
65
84
  protect_from_forgery
@@ -72,7 +91,7 @@ above, one solution is to find this in your application_controller.rb file:
72
91
  end
73
92
  ```
74
93
 
75
- 4. You're all set. Accessing *application_root_url*/csp/csp_reports will display
94
+ 1. You're all set. Accessing *application_root_url*/csp/csp_reports will display
76
95
  a list of all the CSP violation that were reported.
77
96
 
78
97
  Trying it out
@@ -114,8 +133,7 @@ case you might gather stats and maybe warn them in one way or another).
114
133
  To come
115
134
  =======
116
135
 
117
- * Generators to ease the manual install process
118
- * Generators to help create the proper policies
136
+ * Eased data mining
119
137
 
120
138
  License
121
139
  =======
@@ -4,9 +4,6 @@ class CspReport::CspReportsController < ApplicationController
4
4
  # The browser submitting the report will not have any CSRF token
5
5
  skip_before_filter :verify_authenticity_token
6
6
 
7
- #Only provided as an API
8
- respond_to :json
9
-
10
7
  def index
11
8
  @reports = CspReport::CspReport.all
12
9
  end
@@ -19,8 +16,19 @@ class CspReport::CspReportsController < ApplicationController
19
16
  r.violated_directive = param['violated-directive']
20
17
  r.original_policy = param['original-policy']
21
18
  r.blocked_uri = param['blocked-uri']
19
+ r.incoming_ip = request.remote_ip
22
20
  end
23
21
  report.save!
24
22
  render status: 200, nothing: true
25
23
  end
24
+
25
+ def destroy
26
+ CspReport::CspReport.destroy(params[:id])
27
+ redirect_to csp_reports_path
28
+ end
29
+
30
+ def destroy_all
31
+ CspReport::CspReport.delete_all
32
+ redirect_to csp_reports_path
33
+ end
26
34
  end
@@ -1,4 +1,6 @@
1
1
  module CspReport
2
2
  class CspReport < ActiveRecord::Base
3
+ validates_presence_of :document_uri, :violated_directive, :original_policy,
4
+ :incoming_ip
3
5
  end
4
6
  end
@@ -14,8 +14,12 @@
14
14
  Violated Directive
15
15
  %th.csp-report.report-header
16
16
  Blocked URI
17
+ %th.csp-report.report-header
18
+ Incoming IP
17
19
  %th.csp-report.report-header
18
20
  Reported At
21
+ %th.csp-report.report-header
22
+ Actions
19
23
  - @reports.each do |report|
20
24
  %tr.csp-report.report-row
21
25
  %td.csp-report.report-cell=report.id
@@ -24,4 +28,11 @@
24
28
  %td.csp-report.report-cell=report.original_policy
25
29
  %td.csp-report.report-cell=report.violated_directive
26
30
  %td.csp-report.report-cell=report.blocked_uri
31
+ %td.csp-report.report-cell=report.incoming_ip
27
32
  %td.csp-report.report-cell=report.created_at
33
+ %td.csp-report.report-cell
34
+ =link_to('Delete violation', csp_report_path(report.id), method: 'delete')
35
+
36
+ %p
37
+ =link_to "Delete All", csp_reports_destroy_all_path,
38
+ data: {confirm: "Are you sure you want to delete all the violation reports?"}
@@ -1,4 +1,7 @@
1
1
  CspReport::Engine.routes.draw do
2
+ # Careful, the destroy_all action needs to be defined BEFORE the resources
3
+ # indeed the resources declaration add all the csp_reports/XXX routes to be
4
+ # the show XXX item action
5
+ get '/csp_reports/destroy_all' #, controller: 'csp_reports#destroy_all'
2
6
  resources :csp_reports
3
-
4
7
  end
@@ -1,11 +1,11 @@
1
1
  class CreateCspReportCspReports < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :csp_report_csp_reports do |t|
4
- t.string :document_uri
4
+ t.string :document_uri , null: false
5
5
  t.string :referrer
6
6
  t.string :blocked_uri
7
- t.string :violated_directive
8
- t.string :original_policy
7
+ t.string :violated_directive , null: false
8
+ t.string :original_policy , null: false
9
9
 
10
10
  t.timestamps
11
11
  end
@@ -0,0 +1,13 @@
1
+ class AddIncomingIpToCspReportCspReports < ActiveRecord::Migration
2
+ def change
3
+ add_column :csp_report_csp_reports, :incoming_ip, :string, null: true
4
+
5
+ CspReport::CspReport.all.each do |report|
6
+ report.incoming_ip = 'Unknown (captured prior to v0.2.0)'
7
+ report.save!
8
+ end
9
+
10
+ # Removes the default value
11
+ change_column :csp_report_csp_reports, :incoming_ip, :string, null: false
12
+ end
13
+ end
@@ -1,4 +1,4 @@
1
1
  module CspReport
2
2
  #TODO - gbataille: Permanent todo to bump the version for new releases
3
- VERSION = "0.1.2".freeze
3
+ VERSION = "0.2.0".freeze
4
4
  end
@@ -0,0 +1,23 @@
1
+ module CspReport
2
+ class CspDeclarationGenerator < Rails::Generators::Base
3
+ desc "Adds the Content-Security-Policy directive in all the responses"
4
+ def setup_filter
5
+ inject_into_file "app/controllers/application_controller.rb",
6
+ after: "ApplicationController < ActionController::Base\n" do
7
+ <<-CONTENT
8
+
9
+ before_filter :csp
10
+
11
+ def csp
12
+ policy = "default *;"
13
+ policy << "script-src 'self';"
14
+ policy << "report-uri /csp/csp_reports"
15
+ response.headers['Content-Security-Policy'] = policy
16
+ end
17
+
18
+ CONTENT
19
+ end
20
+ end
21
+ end
22
+ end
23
+
@@ -1,7 +1,66 @@
1
1
  require 'spec_helper'
2
2
 
3
- module CspReport
4
- describe CspReportsController do
3
+ describe CspReport::CspReportsController do
4
+ before(:each) do
5
+ @local_inline = FactoryGirl.create(:local_inline)
6
+ @local_home_index_inline = FactoryGirl.create(:local_home_index_inline)
5
7
 
8
+ @reports = CspReport::CspReport.all
9
+ end
10
+
11
+ describe "destroy" do
12
+ it "should delete the object" do
13
+ expect {
14
+ delete :destroy, id: @local_inline, use_route: 'csp'
15
+ }.to change(CspReport::CspReport, :count).by(-1)
16
+
17
+ assert_response(:redirect)
18
+ assert_redirected_to(controller: 'csp_report/csp_reports', action: 'index')
19
+ assert_nil CspReport::CspReport.find_by_id @local_inline.id
20
+ end
21
+ end
22
+
23
+ describe "index" do
24
+ it "should return all the reports in store" do
25
+ get :index, use_route: 'csp'
26
+ assert_response(:success)
27
+ assert_not_nil assigns(:reports)
28
+ assert_equal assigns(:reports).length, @reports.length
29
+ end
30
+ end
31
+
32
+ describe "create" do
33
+ before(:each) do
34
+ @unsaved_report = {
35
+ 'document-uri' => "http://localhost:3000/home/index",
36
+ 'referrer' => "",
37
+ 'blocked-uri' => "",
38
+ 'violated-directive' => "script-src 'self'",
39
+ 'original-policy' => "script-src 'self'; report-uri /csp/csp_reports"
40
+ }
41
+ end
42
+
43
+ it "should save the report in the db" do
44
+ expect {
45
+ post :create, 'csp-report' => @unsaved_report, :use_route => 'csp'
46
+ }.to change(CspReport::CspReport, :count).by(1)
47
+
48
+ report = CspReport::CspReport.last
49
+ assert_equal @unsaved_report['document-uri'], report.document_uri
50
+ assert_equal @unsaved_report['referrer'], report.referrer
51
+ assert_equal @unsaved_report['blocked-uri'], report.blocked_uri
52
+ assert_equal @unsaved_report['violated-directive'], report.violated_directive
53
+ assert_equal @unsaved_report['original-policy'], report.original_policy
54
+ end
55
+ end
56
+
57
+ describe "destroy all" do
58
+ it "should delete all the reports in store" do
59
+ delete :destroy_all, use_route: 'csp'
60
+
61
+ assert_empty CspReport::CspReport.all
62
+ assert_response :redirect
63
+ assert_redirected_to(controller: 'csp_report/csp_reports', action: 'index')
64
+ end
6
65
  end
7
66
  end
@@ -1,4 +1,4 @@
1
1
  Rails.application.routes.draw do
2
2
 
3
- mount CspReport::Engine => "/csp_report"
3
+ mount CspReport::Engine, at: 'csp'
4
4
  end
@@ -11,6 +11,17 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 0) do
14
+ ActiveRecord::Schema.define(version: 20130712162922) do
15
+
16
+ create_table "csp_report_csp_reports", force: true do |t|
17
+ t.string "document_uri", null: false
18
+ t.string "referrer"
19
+ t.string "blocked_uri"
20
+ t.string "violated_directive", null: false
21
+ t.string "original_policy", null: false
22
+ t.datetime "created_at"
23
+ t.datetime "updated_at"
24
+ t.string "incoming_ip", null: false
25
+ end
15
26
 
16
27
  end
Binary file
@@ -1,3 +1,137 @@
1
1
   (1.6ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
2
2
   (1.5ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3
3
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
4
+  (8.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
5
+  (1.5ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
6
+  (0.2ms) SELECT version FROM "schema_migrations"
7
+  (1.2ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
8
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
9
+ Migrating to CreateCspReportCspReports (20130630091108)
10
+  (0.1ms) begin transaction
11
+  (1.2ms) CREATE TABLE "csp_report_csp_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_uri" varchar(255), "referrer" varchar(255), "blocked_uri" varchar(255), "violated_directive" varchar(255), "original_policy" varchar(255), "created_at" datetime, "updated_at" datetime) 
12
+ SQL (1.3ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130630091108"]]
13
+  (10.4ms) commit transaction
14
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
15
+  (1.4ms) CREATE TABLE "csp_report_csp_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_uri" varchar(255), "referrer" varchar(255), "blocked_uri" varchar(255), "violated_directive" varchar(255), "original_policy" varchar(255), "created_at" datetime, "updated_at" datetime) 
16
+  (1.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
17
+  (1.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
18
+  (0.2ms) SELECT version FROM "schema_migrations"
19
+  (1.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20130630091108')
20
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
21
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
22
+  (10.7ms) CREATE TABLE "csp_report_csp_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_uri" varchar(255), "referrer" varchar(255), "blocked_uri" varchar(255), "violated_directive" varchar(255), "original_policy" varchar(255), "created_at" datetime, "updated_at" datetime) 
23
+  (5.4ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
24
+  (1.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
25
+  (0.2ms) SELECT version FROM "schema_migrations"
26
+  (1.2ms) INSERT INTO "schema_migrations" (version) VALUES ('20130705054040')
27
+  (1.2ms) INSERT INTO "schema_migrations" (version) VALUES ('20130630091108')
28
+  (1.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
29
+  (1.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
30
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
31
+ Migrating to CreateCspReportCspReports (20130630091108)
32
+  (0.1ms) begin transaction
33
+  (0.4ms) CREATE TABLE "csp_report_csp_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_uri" varchar(255), "not_null" varchar(255), "referrer" varchar(255), "blocked_uri" varchar(255), "violated_directive" varchar(255), "original_policy" varchar(255), "created_at" datetime, "updated_at" datetime) 
34
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130630091108"]]
35
+  (0.8ms) commit transaction
36
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
37
+  (0.2ms) begin transaction
38
+ SQL (3.7ms) INSERT INTO "csp_report_csp_reports" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Sun, 07 Jul 2013 16:24:47 UTC +00:00], ["updated_at", Sun, 07 Jul 2013 16:24:47 UTC +00:00]]
39
+  (1.1ms) commit transaction
40
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
41
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
42
+ Migrating to CreateCspReportCspReports (20130707162804)
43
+  (0.1ms) begin transaction
44
+  (8.3ms) CREATE TABLE "csp_report_csp_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_uri" varchar(255) NOT NULL, "referrer" varchar(255), "blocked_uri" varchar(255), "violated_directive" varchar(255), "original_policy" varchar(255), "created_at" datetime, "updated_at" datetime) 
45
+ SQLite3::SQLException: table "csp_report_csp_reports" already exists: CREATE TABLE "csp_report_csp_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_uri" varchar(255) NOT NULL, "referrer" varchar(255), "blocked_uri" varchar(255), "violated_directive" varchar(255), "original_policy" varchar(255), "created_at" datetime, "updated_at" datetime)
46
+  (0.1ms) rollback transaction
47
+  (7.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
48
+  (1.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
49
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
50
+ Migrating to CreateCspReportCspReports (20130707162804)
51
+  (0.1ms) begin transaction
52
+  (0.4ms) CREATE TABLE "csp_report_csp_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_uri" varchar(255) NOT NULL, "referrer" varchar(255), "blocked_uri" varchar(255), "violated_directive" varchar(255), "original_policy" varchar(255), "created_at" datetime, "updated_at" datetime) 
53
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130707162804"]]
54
+  (0.9ms) commit transaction
55
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
56
+  (0.2ms) begin transaction
57
+ SQL (2.3ms) INSERT INTO "csp_report_csp_reports" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Sun, 07 Jul 2013 16:31:48 UTC +00:00], ["updated_at", Sun, 07 Jul 2013 16:31:48 UTC +00:00]]
58
+ SQLite3::ConstraintException: csp_report_csp_reports.document_uri may not be NULL: INSERT INTO "csp_report_csp_reports" ("created_at", "updated_at") VALUES (?, ?)
59
+  (0.1ms) rollback transaction
60
+  (8.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
61
+  (1.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
62
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
63
+ Migrating to CreateCspReportCspReports (20130630091108)
64
+  (0.1ms) begin transaction
65
+  (0.6ms) CREATE TABLE "csp_report_csp_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_uri" varchar(255) NOT NULL, "referrer" varchar(255), "blocked_uri" varchar(255), "violated_directive" varchar(255), "original_policy" varchar(255), "created_at" datetime, "updated_at" datetime) 
66
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130630091108"]]
67
+  (0.7ms) commit transaction
68
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
69
+  (7.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
70
+  (1.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
71
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
72
+ Migrating to CreateCspReportCspReports (20130630091108)
73
+  (0.1ms) begin transaction
74
+  (0.5ms) CREATE TABLE "csp_report_csp_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_uri" varchar(255) NOT NULL, "referrer" varchar(255), "blocked_uri" varchar(255), "violated_directive" varchar(255) NOT NULL, "original_policy" varchar(255) NOT NULL, "created_at" datetime, "updated_at" datetime) 
75
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130630091108"]]
76
+  (0.7ms) commit transaction
77
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
78
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
79
+ Migrating to AddIncomingIpToCspReport (20130712162922)
80
+  (0.1ms) begin transaction
81
+  (0.6ms) ALTER TABLE "csp_reports" ADD "incoming_ip" varchar(255)
82
+ SQLite3::SQLException: no such table: csp_reports: ALTER TABLE "csp_reports" ADD "incoming_ip" varchar(255)
83
+  (0.1ms) rollback transaction
84
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
85
+ Migrating to AddIncomingIpToCspReport (20130712162922)
86
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
87
+ Migrating to AddIncomingIpToCspReport (20130712162922)
88
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
89
+ Migrating to AddIncomingIpToCspReportCspReports (20130712162922)
90
+  (0.1ms) begin transaction
91
+  (8.8ms) ALTER TABLE "csp_report_csp_reports" ADD "incoming_ip" varchar(255)
92
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130712162922"]]
93
+  (0.9ms) commit transaction
94
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
95
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
96
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
97
+  (7.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
98
+  (1.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
99
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
100
+ Migrating to CreateCspReportCspReports (20130630091108)
101
+  (0.1ms) begin transaction
102
+  (0.4ms) CREATE TABLE "csp_report_csp_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_uri" varchar(255) NOT NULL, "referrer" varchar(255), "blocked_uri" varchar(255), "violated_directive" varchar(255) NOT NULL, "original_policy" varchar(255) NOT NULL, "created_at" datetime, "updated_at" datetime) 
103
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130630091108"]]
104
+  (0.7ms) commit transaction
105
+ Migrating to AddIncomingIpToCspReportCspReports (20130712162922)
106
+  (0.1ms) begin transaction
107
+  (0.2ms) ALTER TABLE "csp_report_csp_reports" ADD "incoming_ip" varchar(255) NOT NULL
108
+ SQLite3::SQLException: Cannot add a NOT NULL column with default value NULL: ALTER TABLE "csp_report_csp_reports" ADD "incoming_ip" varchar(255) NOT NULL
109
+  (0.0ms) rollback transaction
110
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
111
+ Migrating to AddIncomingIpToCspReportCspReports (20130712162922)
112
+  (0.1ms) begin transaction
113
+  (0.8ms) ALTER TABLE "csp_report_csp_reports" ADD "incoming_ip" varchar(255) DEFAULT 'unknown' NOT NULL
114
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130712162922"]]
115
+  (7.6ms) commit transaction
116
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
117
+  (8.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
118
+  (1.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
119
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
120
+ Migrating to CreateCspReportCspReports (20130630091108)
121
+  (0.1ms) begin transaction
122
+  (0.4ms) CREATE TABLE "csp_report_csp_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_uri" varchar(255) NOT NULL, "referrer" varchar(255), "blocked_uri" varchar(255), "violated_directive" varchar(255) NOT NULL, "original_policy" varchar(255) NOT NULL, "created_at" datetime, "updated_at" datetime) 
123
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130630091108"]]
124
+  (0.7ms) commit transaction
125
+ Migrating to AddIncomingIpToCspReportCspReports (20130712162922)
126
+  (0.1ms) begin transaction
127
+  (0.3ms) ALTER TABLE "csp_report_csp_reports" ADD "incoming_ip" varchar(255)
128
+ CspReport::CspReport Load (0.1ms) SELECT "csp_report_csp_reports".* FROM "csp_report_csp_reports"
129
+  (0.4ms) CREATE TEMPORARY TABLE "acsp_report_csp_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_uri" varchar(255) NOT NULL, "referrer" varchar(255), "blocked_uri" varchar(255), "violated_directive" varchar(255) NOT NULL, "original_policy" varchar(255) NOT NULL, "created_at" datetime, "updated_at" datetime, "incoming_ip" varchar(255)) 
130
+  (0.1ms) SELECT * FROM "csp_report_csp_reports"
131
+  (0.3ms) DROP TABLE "csp_report_csp_reports"
132
+  (0.1ms) CREATE TABLE "csp_report_csp_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_uri" varchar(255) NOT NULL, "referrer" varchar(255), "blocked_uri" varchar(255), "violated_directive" varchar(255) NOT NULL, "original_policy" varchar(255) NOT NULL, "created_at" datetime, "updated_at" datetime, "incoming_ip" varchar(255) NOT NULL)
133
+  (0.1ms) SELECT * FROM "acsp_report_csp_reports"
134
+  (0.3ms) DROP TABLE "acsp_report_csp_reports"
135
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130712162922"]]
136
+  (0.7ms) commit transaction
137
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"