policy_decision_point 0.1.0

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.
Files changed (117) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/main.yml +16 -0
  3. data/.gitignore +65 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +22 -0
  6. data/.ruby-version +1 -0
  7. data/Gemfile +14 -0
  8. data/README.md +1 -0
  9. data/Rakefile +12 -0
  10. data/bin/console +15 -0
  11. data/bin/htmldiff +29 -0
  12. data/bin/ldiff +29 -0
  13. data/bin/rake +27 -0
  14. data/bin/rspec +27 -0
  15. data/bin/rubocop +27 -0
  16. data/bin/ruby-parse +27 -0
  17. data/bin/ruby-rewrite +27 -0
  18. data/bin/setup +11 -0
  19. data/example/Gemfile +65 -0
  20. data/example/Gemfile.lock +273 -0
  21. data/example/README.md +1 -0
  22. data/example/Rakefile +6 -0
  23. data/example/app/assets/config/manifest.js +2 -0
  24. data/example/app/assets/images/.keep +0 -0
  25. data/example/app/assets/stylesheets/application.css +15 -0
  26. data/example/app/channels/application_cable/channel.rb +4 -0
  27. data/example/app/channels/application_cable/connection.rb +4 -0
  28. data/example/app/controllers/application_controller.rb +2 -0
  29. data/example/app/controllers/concerns/.keep +0 -0
  30. data/example/app/controllers/rpc/hello_world/service.proto +15 -0
  31. data/example/app/controllers/rpc/hello_world/service_pb.rb +22 -0
  32. data/example/app/controllers/rpc/hello_world/service_twirp.rb +17 -0
  33. data/example/app/controllers/rpc/hello_world_server.rb +15 -0
  34. data/example/app/helpers/application_helper.rb +2 -0
  35. data/example/app/javascript/channels/consumer.js +6 -0
  36. data/example/app/javascript/channels/index.js +5 -0
  37. data/example/app/javascript/packs/application.js +13 -0
  38. data/example/app/jobs/application_job.rb +7 -0
  39. data/example/app/mailers/application_mailer.rb +4 -0
  40. data/example/app/models/application_record.rb +3 -0
  41. data/example/app/models/concerns/.keep +0 -0
  42. data/example/app/views/layouts/application.html.erb +16 -0
  43. data/example/app/views/layouts/mailer.html.erb +13 -0
  44. data/example/app/views/layouts/mailer.text.erb +1 -0
  45. data/example/babel.config.js +70 -0
  46. data/example/bin/bundle +114 -0
  47. data/example/bin/rails +27 -0
  48. data/example/bin/rake +5 -0
  49. data/example/bin/setup +36 -0
  50. data/example/bin/spring +14 -0
  51. data/example/bin/webpack +18 -0
  52. data/example/bin/webpack-dev-server +18 -0
  53. data/example/bin/yarn +17 -0
  54. data/example/config.ru +6 -0
  55. data/example/config/application.rb +25 -0
  56. data/example/config/boot.rb +4 -0
  57. data/example/config/cable.yml +10 -0
  58. data/example/config/credentials.yml.enc +1 -0
  59. data/example/config/database.yml +25 -0
  60. data/example/config/environment.rb +5 -0
  61. data/example/config/environments/development.rb +79 -0
  62. data/example/config/environments/production.rb +120 -0
  63. data/example/config/environments/test.rb +60 -0
  64. data/example/config/initializers/application_controller_renderer.rb +8 -0
  65. data/example/config/initializers/assets.rb +14 -0
  66. data/example/config/initializers/backtrace_silencers.rb +8 -0
  67. data/example/config/initializers/content_security_policy.rb +30 -0
  68. data/example/config/initializers/cookies_serializer.rb +5 -0
  69. data/example/config/initializers/filter_parameter_logging.rb +6 -0
  70. data/example/config/initializers/inflections.rb +16 -0
  71. data/example/config/initializers/mime_types.rb +4 -0
  72. data/example/config/initializers/permissions_policy.rb +11 -0
  73. data/example/config/initializers/twirp_rails.rb +4 -0
  74. data/example/config/initializers/wrap_parameters.rb +14 -0
  75. data/example/config/locales/en.yml +33 -0
  76. data/example/config/master.key +1 -0
  77. data/example/config/puma.rb +43 -0
  78. data/example/config/routes.rb +4 -0
  79. data/example/config/spring.rb +6 -0
  80. data/example/config/storage.yml +34 -0
  81. data/example/config/webpack/development.js +5 -0
  82. data/example/config/webpack/environment.js +3 -0
  83. data/example/config/webpack/production.js +5 -0
  84. data/example/config/webpack/test.js +5 -0
  85. data/example/config/webpacker.yml +92 -0
  86. data/example/extensions/x86_64-linux/3.0.0/ffi-1.15.3/ffi_c.so +0 -0
  87. data/example/extensions/x86_64-linux/3.0.0/ffi-1.15.3/gem.build_complete +0 -0
  88. data/example/extensions/x86_64-linux/3.0.0/ffi-1.15.3/gem_make.out +165 -0
  89. data/example/extensions/x86_64-linux/3.0.0/ffi-1.15.3/mkmf.log +132 -0
  90. data/example/package.json +17 -0
  91. data/example/postcss.config.js +12 -0
  92. data/example/public/404.html +67 -0
  93. data/example/public/422.html +67 -0
  94. data/example/public/500.html +66 -0
  95. data/example/public/apple-touch-icon-precomposed.png +0 -0
  96. data/example/public/apple-touch-icon.png +0 -0
  97. data/example/public/favicon.ico +0 -0
  98. data/example/public/robots.txt +1 -0
  99. data/example/storage/.keep +0 -0
  100. data/example/test/application_system_test_case.rb +5 -0
  101. data/example/test/channels/application_cable/connection_test.rb +11 -0
  102. data/example/test/controllers/.keep +0 -0
  103. data/example/test/fixtures/files/.keep +0 -0
  104. data/example/test/helpers/.keep +0 -0
  105. data/example/test/integration/.keep +0 -0
  106. data/example/test/mailers/.keep +0 -0
  107. data/example/test/models/.keep +0 -0
  108. data/example/test/system/.keep +0 -0
  109. data/example/test/test_helper.rb +13 -0
  110. data/example/tmp/cache/bootsnap/load-path-cache +0 -0
  111. data/example/vendor/.keep +0 -0
  112. data/example/yarn.lock +6888 -0
  113. data/lib/policy_decision_point.rb +24 -0
  114. data/lib/policy_decision_point/pdp.rb +155 -0
  115. data/lib/policy_decision_point/version.rb +5 -0
  116. data/policy_decision_point.gemspec +32 -0
  117. metadata +160 -0
@@ -0,0 +1,273 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ actioncable (6.1.4)
5
+ actionpack (= 6.1.4)
6
+ activesupport (= 6.1.4)
7
+ nio4r (~> 2.0)
8
+ websocket-driver (>= 0.6.1)
9
+ actionmailbox (6.1.4)
10
+ actionpack (= 6.1.4)
11
+ activejob (= 6.1.4)
12
+ activerecord (= 6.1.4)
13
+ activestorage (= 6.1.4)
14
+ activesupport (= 6.1.4)
15
+ mail (>= 2.7.1)
16
+ actionmailer (6.1.4)
17
+ actionpack (= 6.1.4)
18
+ actionview (= 6.1.4)
19
+ activejob (= 6.1.4)
20
+ activesupport (= 6.1.4)
21
+ mail (~> 2.5, >= 2.5.4)
22
+ rails-dom-testing (~> 2.0)
23
+ actionpack (6.1.4)
24
+ actionview (= 6.1.4)
25
+ activesupport (= 6.1.4)
26
+ rack (~> 2.0, >= 2.0.9)
27
+ rack-test (>= 0.6.3)
28
+ rails-dom-testing (~> 2.0)
29
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
30
+ actiontext (6.1.4)
31
+ actionpack (= 6.1.4)
32
+ activerecord (= 6.1.4)
33
+ activestorage (= 6.1.4)
34
+ activesupport (= 6.1.4)
35
+ nokogiri (>= 1.8.5)
36
+ actionview (6.1.4)
37
+ activesupport (= 6.1.4)
38
+ builder (~> 3.1)
39
+ erubi (~> 1.4)
40
+ rails-dom-testing (~> 2.0)
41
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
42
+ activejob (6.1.4)
43
+ activesupport (= 6.1.4)
44
+ globalid (>= 0.3.6)
45
+ activemodel (6.1.4)
46
+ activesupport (= 6.1.4)
47
+ activerecord (6.1.4)
48
+ activemodel (= 6.1.4)
49
+ activesupport (= 6.1.4)
50
+ activestorage (6.1.4)
51
+ actionpack (= 6.1.4)
52
+ activejob (= 6.1.4)
53
+ activerecord (= 6.1.4)
54
+ activesupport (= 6.1.4)
55
+ marcel (~> 1.0.0)
56
+ mini_mime (>= 1.1.0)
57
+ activesupport (6.1.4)
58
+ concurrent-ruby (~> 1.0, >= 1.0.2)
59
+ i18n (>= 1.6, < 2)
60
+ minitest (>= 5.1)
61
+ tzinfo (~> 2.0)
62
+ zeitwerk (~> 2.3)
63
+ addressable (2.7.0)
64
+ public_suffix (>= 2.0.2, < 5.0)
65
+ aws-eventstream (1.1.1)
66
+ aws-partitions (1.472.0)
67
+ aws-sdk-core (3.115.0)
68
+ aws-eventstream (~> 1, >= 1.0.2)
69
+ aws-partitions (~> 1, >= 1.239.0)
70
+ aws-sigv4 (~> 1.1)
71
+ jmespath (~> 1.0)
72
+ aws-sdk-ec2 (1.245.0)
73
+ aws-sdk-core (~> 3, >= 3.112.0)
74
+ aws-sigv4 (~> 1.1)
75
+ aws-sdk-iam (1.55.0)
76
+ aws-sdk-core (~> 3, >= 3.112.0)
77
+ aws-sigv4 (~> 1.1)
78
+ aws-sigv4 (1.2.3)
79
+ aws-eventstream (~> 1, >= 1.0.2)
80
+ bindex (0.8.1)
81
+ bootsnap (1.7.5)
82
+ msgpack (~> 1.0)
83
+ builder (3.2.4)
84
+ byebug (11.1.3)
85
+ capybara (3.35.3)
86
+ addressable
87
+ mini_mime (>= 0.1.3)
88
+ nokogiri (~> 1.8)
89
+ rack (>= 1.6.0)
90
+ rack-test (>= 0.6.3)
91
+ regexp_parser (>= 1.5, < 3.0)
92
+ xpath (~> 3.2)
93
+ childprocess (3.0.0)
94
+ concurrent-ruby (1.1.9)
95
+ crass (1.0.6)
96
+ erubi (1.10.0)
97
+ faraday (1.4.3)
98
+ faraday-em_http (~> 1.0)
99
+ faraday-em_synchrony (~> 1.0)
100
+ faraday-excon (~> 1.1)
101
+ faraday-net_http (~> 1.0)
102
+ faraday-net_http_persistent (~> 1.1)
103
+ multipart-post (>= 1.2, < 3)
104
+ ruby2_keywords (>= 0.0.4)
105
+ faraday-em_http (1.0.0)
106
+ faraday-em_synchrony (1.0.0)
107
+ faraday-excon (1.1.0)
108
+ faraday-net_http (1.0.1)
109
+ faraday-net_http_persistent (1.1.0)
110
+ ffi (1.15.3)
111
+ globalid (0.4.2)
112
+ activesupport (>= 4.2.0)
113
+ google-protobuf (3.17.3-universal-darwin)
114
+ google-protobuf (3.17.3-x86_64-linux)
115
+ i18n (1.8.10)
116
+ concurrent-ruby (~> 1.0)
117
+ jbuilder (2.11.2)
118
+ activesupport (>= 5.0.0)
119
+ jmespath (1.4.0)
120
+ listen (3.5.1)
121
+ rb-fsevent (~> 0.10, >= 0.10.3)
122
+ rb-inotify (~> 0.9, >= 0.9.10)
123
+ loofah (2.10.0)
124
+ crass (~> 1.0.2)
125
+ nokogiri (>= 1.5.9)
126
+ mail (2.7.1)
127
+ mini_mime (>= 0.1.1)
128
+ marcel (1.0.1)
129
+ method_source (1.0.0)
130
+ mini_mime (1.1.0)
131
+ minitest (5.14.4)
132
+ msgpack (1.4.2)
133
+ multipart-post (2.1.1)
134
+ nio4r (2.5.7)
135
+ nokogiri (1.11.7-x86_64-darwin)
136
+ racc (~> 1.4)
137
+ nokogiri (1.11.7-x86_64-linux)
138
+ racc (~> 1.4)
139
+ public_suffix (4.0.6)
140
+ puma (5.3.2)
141
+ nio4r (~> 2.0)
142
+ racc (1.5.2)
143
+ rack (2.2.3)
144
+ rack-mini-profiler (2.3.2)
145
+ rack (>= 1.2.0)
146
+ rack-proxy (0.7.0)
147
+ rack
148
+ rack-test (1.1.0)
149
+ rack (>= 1.0, < 3)
150
+ rails (6.1.4)
151
+ actioncable (= 6.1.4)
152
+ actionmailbox (= 6.1.4)
153
+ actionmailer (= 6.1.4)
154
+ actionpack (= 6.1.4)
155
+ actiontext (= 6.1.4)
156
+ actionview (= 6.1.4)
157
+ activejob (= 6.1.4)
158
+ activemodel (= 6.1.4)
159
+ activerecord (= 6.1.4)
160
+ activestorage (= 6.1.4)
161
+ activesupport (= 6.1.4)
162
+ bundler (>= 1.15.0)
163
+ railties (= 6.1.4)
164
+ sprockets-rails (>= 2.0.0)
165
+ rails-dom-testing (2.0.3)
166
+ activesupport (>= 4.2.0)
167
+ nokogiri (>= 1.6)
168
+ rails-html-sanitizer (1.3.0)
169
+ loofah (~> 2.3)
170
+ railties (6.1.4)
171
+ actionpack (= 6.1.4)
172
+ activesupport (= 6.1.4)
173
+ method_source
174
+ rake (>= 0.13)
175
+ thor (~> 1.0)
176
+ rake (13.0.3)
177
+ rb-fsevent (0.11.0)
178
+ rb-inotify (0.10.1)
179
+ ffi (~> 1.0)
180
+ regexp_parser (2.1.1)
181
+ ruby2_keywords (0.0.4)
182
+ rubyzip (2.3.0)
183
+ sass-rails (6.0.0)
184
+ sassc-rails (~> 2.1, >= 2.1.1)
185
+ sassc (2.4.0)
186
+ ffi (~> 1.9)
187
+ sassc-rails (2.1.2)
188
+ railties (>= 4.0.0)
189
+ sassc (>= 2.0)
190
+ sprockets (> 3.0)
191
+ sprockets-rails
192
+ tilt
193
+ selenium-webdriver (3.142.7)
194
+ childprocess (>= 0.5, < 4.0)
195
+ rubyzip (>= 1.2.2)
196
+ semantic_range (3.0.0)
197
+ spring (2.1.1)
198
+ sprockets (4.0.2)
199
+ concurrent-ruby (~> 1.0)
200
+ rack (> 1, < 3)
201
+ sprockets-rails (3.2.2)
202
+ actionpack (>= 4.0)
203
+ activesupport (>= 4.0)
204
+ sprockets (>= 3.0.0)
205
+ sqlite3 (1.4.2)
206
+ thor (1.1.0)
207
+ tilt (2.0.10)
208
+ turbolinks (5.2.1)
209
+ turbolinks-source (~> 5.2)
210
+ turbolinks-source (5.2.0)
211
+ twirp (1.7.2)
212
+ faraday (< 2)
213
+ google-protobuf (~> 3.0, >= 3.7.0)
214
+ twirp-rails (0.1.1)
215
+ railties (>= 4.2)
216
+ twirp
217
+ tzinfo (2.0.4)
218
+ concurrent-ruby (~> 1.0)
219
+ web-console (4.1.0)
220
+ actionview (>= 6.0.0)
221
+ activemodel (>= 6.0.0)
222
+ bindex (>= 0.4.0)
223
+ railties (>= 6.0.0)
224
+ webdrivers (4.6.0)
225
+ nokogiri (~> 1.6)
226
+ rubyzip (>= 1.3.0)
227
+ selenium-webdriver (>= 3.0, < 4.0)
228
+ webpacker (5.4.0)
229
+ activesupport (>= 5.2)
230
+ rack-proxy (>= 0.6.1)
231
+ railties (>= 5.2)
232
+ semantic_range (>= 2.3.0)
233
+ webrick (1.7.0)
234
+ websocket-driver (0.7.5)
235
+ websocket-extensions (>= 0.1.0)
236
+ websocket-extensions (0.1.5)
237
+ xpath (3.2.0)
238
+ nokogiri (~> 1.8)
239
+ zeitwerk (2.4.2)
240
+
241
+ PLATFORMS
242
+ x86_64-darwin-20
243
+ x86_64-linux
244
+
245
+ DEPENDENCIES
246
+ aws-sdk-ec2
247
+ aws-sdk-iam
248
+ bootsnap (>= 1.4.4)
249
+ byebug
250
+ capybara (>= 3.26)
251
+ faraday
252
+ jbuilder (~> 2.7)
253
+ listen (~> 3.3)
254
+ puma (~> 5.0)
255
+ rack-mini-profiler (~> 2.0)
256
+ rails (~> 6.1.3, >= 6.1.3.2)
257
+ sass-rails (>= 6)
258
+ selenium-webdriver
259
+ spring
260
+ sqlite3 (~> 1.4)
261
+ turbolinks (~> 5)
262
+ twirp-rails
263
+ tzinfo-data
264
+ web-console (>= 4.1.0)
265
+ webdrivers
266
+ webpacker (~> 5.0)
267
+ webrick
268
+
269
+ RUBY VERSION
270
+ ruby 3.0.1p64
271
+
272
+ BUNDLED WITH
273
+ 2.2.15
data/example/README.md ADDED
@@ -0,0 +1 @@
1
+ # opa-rails-middleware
data/example/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative "config/application"
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,2 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../stylesheets .css
File without changes
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
6
+ * vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Channel < ActionCable::Channel::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Connection < ActionCable::Connection::Base
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationController < ActionController::Base
2
+ end
File without changes
@@ -0,0 +1,15 @@
1
+ syntax = "proto3";
2
+ package example.hello_world;
3
+
4
+
5
+ service HelloWorld {
6
+ rpc Hello(HelloRequest) returns (HelloResponse);
7
+ }
8
+
9
+ message HelloRequest {
10
+ string name = 1;
11
+ }
12
+
13
+ message HelloResponse {
14
+ string message = 1;
15
+ }
@@ -0,0 +1,22 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: hello_world/service.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ Google::Protobuf::DescriptorPool.generated_pool.build do
7
+ add_file("hello_world/service.proto", :syntax => :proto3) do
8
+ add_message "example.hello_world.HelloRequest" do
9
+ optional :name, :string, 1
10
+ end
11
+ add_message "example.hello_world.HelloResponse" do
12
+ optional :message, :string, 1
13
+ end
14
+ end
15
+ end
16
+
17
+ module Example
18
+ module HelloWorld
19
+ HelloRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("example.hello_world.HelloRequest").msgclass
20
+ HelloResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("example.hello_world.HelloResponse").msgclass
21
+ end
22
+ end
@@ -0,0 +1,17 @@
1
+ # Code generated by protoc-gen-twirp_ruby 1.8.0, DO NOT EDIT.
2
+ require 'twirp'
3
+ require_relative 'service_pb.rb'
4
+
5
+ module Example
6
+ module HelloWorld
7
+ class HelloWorldService < Twirp::Service
8
+ package 'example.hello_world'
9
+ service 'HelloWorld'
10
+ rpc :Hello, HelloRequest, HelloResponse, :ruby_method => :hello
11
+ end
12
+
13
+ class HelloWorldClient < Twirp::Client
14
+ client_for HelloWorldService
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ require 'rack'
2
+ require 'webrick'
3
+
4
+ require_relative 'hello_world/service_twirp.rb'
5
+
6
+ # Service implementation
7
+ class HelloWorldHandler
8
+ include Twirp::Rails::Helpers
9
+ bind Example::HelloWorld::HelloWorldService
10
+
11
+ def hello(req, env)
12
+ puts ">> Hello #{req.name}"
13
+ {message: "Hello #{req.name}"}
14
+ end
15
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,6 @@
1
+ // Action Cable provides the framework to deal with WebSockets in Rails.
2
+ // You can generate new channels where WebSocket features live using the `bin/rails generate channel` command.
3
+
4
+ import { createConsumer } from "@rails/actioncable"
5
+
6
+ export default createConsumer()
@@ -0,0 +1,5 @@
1
+ // Load all the channels within this directory and all subdirectories.
2
+ // Channel files must be named *_channel.js.
3
+
4
+ const channels = require.context('.', true, /_channel\.js$/)
5
+ channels.keys().forEach(channels)
@@ -0,0 +1,13 @@
1
+ // This file is automatically compiled by Webpack, along with any other files
2
+ // present in this directory. You're encouraged to place your actual application logic in
3
+ // a relevant structure within app/javascript and only use these pack files to reference
4
+ // that code so it'll be compiled.
5
+
6
+ import Rails from "@rails/ujs"
7
+ import Turbolinks from "turbolinks"
8
+ import * as ActiveStorage from "@rails/activestorage"
9
+ import "channels"
10
+
11
+ Rails.start()
12
+ Turbolinks.start()
13
+ ActiveStorage.start()
@@ -0,0 +1,7 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ # Automatically retry jobs that encountered a deadlock
3
+ # retry_on ActiveRecord::Deadlocked
4
+
5
+ # Most jobs are safe to ignore if the underlying records are no longer available
6
+ # discard_on ActiveJob::DeserializationError
7
+ end