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.
- checksums.yaml +4 -4
- data/README.md +31 -13
- data/app/controllers/csp_report/csp_reports_controller.rb +11 -3
- data/app/models/csp_report/csp_report.rb +2 -0
- data/app/views/csp_report/csp_reports/index.html.haml +11 -0
- data/config/routes.rb +4 -1
- data/db/migrate/20130630091108_create_csp_report_csp_reports.rb +3 -3
- data/db/migrate/20130712162922_add_incoming_ip_to_csp_report_csp_reports.rb +13 -0
- data/lib/csp_report/version.rb +1 -1
- data/lib/generators/csp_report/csp_declaration_generator.rb +23 -0
- data/spec/controllers/csp_report/csp_reports_controller_spec.rb +61 -2
- data/spec/dummy/config/routes.rb +1 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +12 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +134 -0
- data/spec/dummy/log/test.log +11806 -0
- data/spec/dummy/tmp/cache/assets/test/sass/745019acb880ec9412f97713489f02ba42209a06/csp_report.css.sassc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/4949b199f7a3f61704ee406dfc99e38c +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/9b94cd42c6d3c0778772d609a4d7006d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/dc4c1ce2dc434402713320ef23981262 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/factories/csp_report_csp_reports.rb +16 -8
- data/spec/features/csp_report/csp_reports_index_spec.rb +81 -0
- data/spec/generators/csp_report/install_generators_spec.rb +35 -5
- data/spec/models/csp_report/csp_report_spec.rb +111 -3
- data/spec/spec_helper.rb +39 -8
- metadata +45 -5
- data/lib/tasks/csp_report_tasks.rake +0 -4
- data/lib/tasks/install.thor +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebd08245ed070e2fe95b8eef4524cbbf7dc2eef4
|
4
|
+
data.tar.gz: 96eb326064d28084640d97e2be95808e47236c1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
49
|
-
|
63
|
+
1. Run the generator
|
50
64
|
```shell
|
51
65
|
rails generate csp_report:install
|
52
66
|
```
|
53
|
-
|
54
|
-
It
|
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
|
-
|
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
|
-
|
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
|
-
*
|
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
|
@@ -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?"}
|
data/config/routes.rb
CHANGED
@@ -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
|
data/lib/csp_report/version.rb
CHANGED
@@ -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
|
-
|
4
|
-
|
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
|
data/spec/dummy/config/routes.rb
CHANGED
Binary file
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -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:
|
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
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -1,3 +1,137 @@
|
|
1
1
|
[1m[36m (1.6ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
2
2
|
[1m[35m (1.5ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
3
3
|
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4
|
+
[1m[36m (8.2ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
5
|
+
[1m[35m (1.5ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
6
|
+
[1m[36m (0.2ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
7
|
+
[1m[35m (1.2ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('0')
|
8
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.5ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
9
|
+
Migrating to CreateCspReportCspReports (20130630091108)
|
10
|
+
[1m[35m (0.1ms)[0m begin transaction
|
11
|
+
[1m[36m (1.2ms)[0m [1mCREATE 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) [0m
|
12
|
+
[1m[35mSQL (1.3ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130630091108"]]
|
13
|
+
[1m[36m (10.4ms)[0m [1mcommit transaction[0m
|
14
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
15
|
+
[1m[36m (1.4ms)[0m [1mCREATE 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) [0m
|
16
|
+
[1m[35m (1.2ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
17
|
+
[1m[36m (1.3ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
18
|
+
[1m[35m (0.2ms)[0m SELECT version FROM "schema_migrations"
|
19
|
+
[1m[36m (1.4ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20130630091108')[0m
|
20
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
21
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
22
|
+
[1m[36m (10.7ms)[0m [1mCREATE 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) [0m
|
23
|
+
[1m[35m (5.4ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
24
|
+
[1m[36m (1.4ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
25
|
+
[1m[35m (0.2ms)[0m SELECT version FROM "schema_migrations"
|
26
|
+
[1m[36m (1.2ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20130705054040')[0m
|
27
|
+
[1m[35m (1.2ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20130630091108')
|
28
|
+
[1m[36m (1.3ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
29
|
+
[1m[35m (1.4ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
30
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
31
|
+
Migrating to CreateCspReportCspReports (20130630091108)
|
32
|
+
[1m[35m (0.1ms)[0m begin transaction
|
33
|
+
[1m[36m (0.4ms)[0m [1mCREATE 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) [0m
|
34
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130630091108"]]
|
35
|
+
[1m[36m (0.8ms)[0m [1mcommit transaction[0m
|
36
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
37
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
38
|
+
[1m[35mSQL (3.7ms)[0m 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
|
+
[1m[36m (1.1ms)[0m [1mcommit transaction[0m
|
40
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
41
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
42
|
+
Migrating to CreateCspReportCspReports (20130707162804)
|
43
|
+
[1m[35m (0.1ms)[0m begin transaction
|
44
|
+
[1m[36m (8.3ms)[0m [1mCREATE 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) [0m
|
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
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
47
|
+
[1m[36m (7.9ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
48
|
+
[1m[35m (1.2ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
49
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
50
|
+
Migrating to CreateCspReportCspReports (20130707162804)
|
51
|
+
[1m[35m (0.1ms)[0m begin transaction
|
52
|
+
[1m[36m (0.4ms)[0m [1mCREATE 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) [0m
|
53
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130707162804"]]
|
54
|
+
[1m[36m (0.9ms)[0m [1mcommit transaction[0m
|
55
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
56
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
57
|
+
[1m[35mSQL (2.3ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
60
|
+
[1m[36m (8.3ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
61
|
+
[1m[35m (1.4ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
62
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
63
|
+
Migrating to CreateCspReportCspReports (20130630091108)
|
64
|
+
[1m[35m (0.1ms)[0m begin transaction
|
65
|
+
[1m[36m (0.6ms)[0m [1mCREATE 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) [0m
|
66
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130630091108"]]
|
67
|
+
[1m[36m (0.7ms)[0m [1mcommit transaction[0m
|
68
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
69
|
+
[1m[36m (7.9ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
70
|
+
[1m[35m (1.6ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
71
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
72
|
+
Migrating to CreateCspReportCspReports (20130630091108)
|
73
|
+
[1m[35m (0.1ms)[0m begin transaction
|
74
|
+
[1m[36m (0.5ms)[0m [1mCREATE 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) [0m
|
75
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130630091108"]]
|
76
|
+
[1m[36m (0.7ms)[0m [1mcommit transaction[0m
|
77
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
78
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
79
|
+
Migrating to AddIncomingIpToCspReport (20130712162922)
|
80
|
+
[1m[35m (0.1ms)[0m begin transaction
|
81
|
+
[1m[36m (0.6ms)[0m [1mALTER TABLE "csp_reports" ADD "incoming_ip" varchar(255)[0m
|
82
|
+
SQLite3::SQLException: no such table: csp_reports: ALTER TABLE "csp_reports" ADD "incoming_ip" varchar(255)
|
83
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
84
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
85
|
+
Migrating to AddIncomingIpToCspReport (20130712162922)
|
86
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
87
|
+
Migrating to AddIncomingIpToCspReport (20130712162922)
|
88
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
89
|
+
Migrating to AddIncomingIpToCspReportCspReports (20130712162922)
|
90
|
+
[1m[35m (0.1ms)[0m begin transaction
|
91
|
+
[1m[36m (8.8ms)[0m [1mALTER TABLE "csp_report_csp_reports" ADD "incoming_ip" varchar(255)[0m
|
92
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130712162922"]]
|
93
|
+
[1m[36m (0.9ms)[0m [1mcommit transaction[0m
|
94
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
95
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
96
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
97
|
+
[1m[36m (7.9ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
98
|
+
[1m[35m (1.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
99
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
100
|
+
Migrating to CreateCspReportCspReports (20130630091108)
|
101
|
+
[1m[35m (0.1ms)[0m begin transaction
|
102
|
+
[1m[36m (0.4ms)[0m [1mCREATE 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) [0m
|
103
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130630091108"]]
|
104
|
+
[1m[36m (0.7ms)[0m [1mcommit transaction[0m
|
105
|
+
Migrating to AddIncomingIpToCspReportCspReports (20130712162922)
|
106
|
+
[1m[35m (0.1ms)[0m begin transaction
|
107
|
+
[1m[36m (0.2ms)[0m [1mALTER TABLE "csp_report_csp_reports" ADD "incoming_ip" varchar(255) NOT NULL[0m
|
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
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
110
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
111
|
+
Migrating to AddIncomingIpToCspReportCspReports (20130712162922)
|
112
|
+
[1m[35m (0.1ms)[0m begin transaction
|
113
|
+
[1m[36m (0.8ms)[0m [1mALTER TABLE "csp_report_csp_reports" ADD "incoming_ip" varchar(255) DEFAULT 'unknown' NOT NULL[0m
|
114
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130712162922"]]
|
115
|
+
[1m[36m (7.6ms)[0m [1mcommit transaction[0m
|
116
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
117
|
+
[1m[36m (8.2ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
118
|
+
[1m[35m (1.4ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
119
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
120
|
+
Migrating to CreateCspReportCspReports (20130630091108)
|
121
|
+
[1m[35m (0.1ms)[0m begin transaction
|
122
|
+
[1m[36m (0.4ms)[0m [1mCREATE 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) [0m
|
123
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130630091108"]]
|
124
|
+
[1m[36m (0.7ms)[0m [1mcommit transaction[0m
|
125
|
+
Migrating to AddIncomingIpToCspReportCspReports (20130712162922)
|
126
|
+
[1m[35m (0.1ms)[0m begin transaction
|
127
|
+
[1m[36m (0.3ms)[0m [1mALTER TABLE "csp_report_csp_reports" ADD "incoming_ip" varchar(255)[0m
|
128
|
+
[1m[35mCspReport::CspReport Load (0.1ms)[0m SELECT "csp_report_csp_reports".* FROM "csp_report_csp_reports"
|
129
|
+
[1m[36m (0.4ms)[0m [1mCREATE 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)) [0m
|
130
|
+
[1m[35m (0.1ms)[0m SELECT * FROM "csp_report_csp_reports"
|
131
|
+
[1m[36m (0.3ms)[0m [1mDROP TABLE "csp_report_csp_reports"[0m
|
132
|
+
[1m[35m (0.1ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mSELECT * FROM "acsp_report_csp_reports"[0m
|
134
|
+
[1m[35m (0.3ms)[0m DROP TABLE "acsp_report_csp_reports"
|
135
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20130712162922"]]
|
136
|
+
[1m[35m (0.7ms)[0m commit transaction
|
137
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|