masq2 1.0.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 (92) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +83 -0
  4. data/CODE_OF_CONDUCT.md +135 -0
  5. data/CONTRIBUTING.md +151 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +426 -0
  8. data/SECURITY.md +23 -0
  9. data/app/assets/images/masq/favicon.ico +0 -0
  10. data/app/assets/images/masq/openid_symbol.png +0 -0
  11. data/app/assets/images/masq/seatbelt_icon.png +0 -0
  12. data/app/assets/images/masq/seatbelt_icon_gray.png +0 -0
  13. data/app/assets/images/masq/seatbelt_icon_high.png +0 -0
  14. data/app/assets/stylesheets/masq/application.css.erb +61 -0
  15. data/app/controllers/masq/accounts_controller.rb +132 -0
  16. data/app/controllers/masq/base_controller.rb +78 -0
  17. data/app/controllers/masq/consumer_controller.rb +144 -0
  18. data/app/controllers/masq/info_controller.rb +23 -0
  19. data/app/controllers/masq/passwords_controller.rb +42 -0
  20. data/app/controllers/masq/personas_controller.rb +75 -0
  21. data/app/controllers/masq/server_controller.rb +247 -0
  22. data/app/controllers/masq/sessions_controller.rb +58 -0
  23. data/app/controllers/masq/sites_controller.rb +60 -0
  24. data/app/controllers/masq/yubikey_associations_controller.rb +25 -0
  25. data/app/helpers/masq/application_helper.rb +57 -0
  26. data/app/helpers/masq/personas_helper.rb +15 -0
  27. data/app/helpers/masq/server_helper.rb +15 -0
  28. data/app/mailers/masq/account_mailer.rb +17 -0
  29. data/app/models/masq/account.rb +245 -0
  30. data/app/models/masq/open_id_request.rb +42 -0
  31. data/app/models/masq/persona.rb +61 -0
  32. data/app/models/masq/release_policy.rb +11 -0
  33. data/app/models/masq/site.rb +68 -0
  34. data/app/views/layouts/masq/base.html.erb +70 -0
  35. data/app/views/layouts/masq/consumer.html.erb +30 -0
  36. data/app/views/masq/account_mailer/forgot_password.html.erb +3 -0
  37. data/app/views/masq/account_mailer/forgot_password.text.erb +3 -0
  38. data/app/views/masq/account_mailer/signup_notification.html.erb +5 -0
  39. data/app/views/masq/account_mailer/signup_notification.text.erb +5 -0
  40. data/app/views/masq/accounts/_hcard.html.erb +29 -0
  41. data/app/views/masq/accounts/edit.html.erb +100 -0
  42. data/app/views/masq/accounts/new.html.erb +27 -0
  43. data/app/views/masq/accounts/show.html.erb +4 -0
  44. data/app/views/masq/accounts/show.xrds.builder +40 -0
  45. data/app/views/masq/consumer/index.html.erb +31 -0
  46. data/app/views/masq/consumer/start.html.erb +2 -0
  47. data/app/views/masq/info/help.html.erb +8 -0
  48. data/app/views/masq/info/index.html.erb +5 -0
  49. data/app/views/masq/info/safe_login.html.erb +24 -0
  50. data/app/views/masq/passwords/edit.html.erb +13 -0
  51. data/app/views/masq/passwords/new.html.erb +11 -0
  52. data/app/views/masq/personas/_form.html.erb +159 -0
  53. data/app/views/masq/personas/edit.html.erb +9 -0
  54. data/app/views/masq/personas/index.html.erb +17 -0
  55. data/app/views/masq/personas/new.html.erb +9 -0
  56. data/app/views/masq/server/decide.html.erb +146 -0
  57. data/app/views/masq/server/index.xrds.builder +19 -0
  58. data/app/views/masq/server/seatbelt_config.xml.builder +24 -0
  59. data/app/views/masq/server/seatbelt_login_state.xml.builder +4 -0
  60. data/app/views/masq/sessions/new.html.erb +27 -0
  61. data/app/views/masq/shared/_error_messages.html.erb +12 -0
  62. data/app/views/masq/sites/edit.html.erb +42 -0
  63. data/app/views/masq/sites/index.html.erb +20 -0
  64. data/config/initializers/configuration.rb +5 -0
  65. data/config/initializers/mime_types.rb +1 -0
  66. data/config/initializers/requires.rb +6 -0
  67. data/config/locales/de.yml +281 -0
  68. data/config/locales/en.yml +271 -0
  69. data/config/locales/es.yml +254 -0
  70. data/config/locales/nl.yml +258 -0
  71. data/config/locales/rails.de.yml +225 -0
  72. data/config/locales/ru.yml +272 -0
  73. data/config/masq.example.yml +132 -0
  74. data/config/routes.rb +41 -0
  75. data/db/migrate/20120312120000_masq_schema.rb +152 -0
  76. data/db/migrate/20130626220915_remame_last_authenticated_with_yubikey_on_masq_accounts.rb +11 -0
  77. data/db/migrate/20130704205532_add_first_and_lastname_columns_to_personas.rb +11 -0
  78. data/db/migrate/20130807060329_change_open_id_associations_server_url_column_type.rb +22 -0
  79. data/lib/masq/active_record_openid_store/association.rb +16 -0
  80. data/lib/masq/active_record_openid_store/nonce.rb +9 -0
  81. data/lib/masq/active_record_openid_store/openid_ar_store.rb +58 -0
  82. data/lib/masq/authenticated_system.rb +136 -0
  83. data/lib/masq/engine.rb +12 -0
  84. data/lib/masq/openid_server_system.rb +110 -0
  85. data/lib/masq/signup.rb +53 -0
  86. data/lib/masq/version.rb +5 -0
  87. data/lib/masq.rb +50 -0
  88. data/lib/masq2.rb +1 -0
  89. data/lib/tasks/masq_tasks.rake +58 -0
  90. data.tar.gz.sig +2 -0
  91. metadata +377 -0
  92. metadata.gz.sig +0 -0
data/README.md ADDED
@@ -0,0 +1,426 @@
1
+ # Masq2 OpenID Server
2
+
3
+ ## ⚠️☢️ SECURITY WARNING ☢️⚠️
4
+
5
+ - The roots of this gem are ancient, and there are more modern options.
6
+ - This gem is based on OpenID 2.0, which is a **deprecated standard**.
7
+ - The modern alternative is called OpenID Connect (OIDC).
8
+ - This gem **does not** support OIDC.
9
+ - Many, if not all, of the [current security vulnerabilities](https://github.com/oauth-xx/masq2/security/code-scanning) **will not be fixed**.
10
+ - The purpose of this gem is to help legacy systems modernize, one step at a time, by allowing them to get onto modern Ruby / Rails.
11
+ - If you find this useful, please consider sponsoring me!
12
+
13
+ ## Read above before continuing
14
+
15
+ [![Version][👽versioni]][👽version]
16
+ [![License: MIT][📄license-img]][📄license-ref]
17
+ [![Downloads Rank][👽dl-ranki]][👽dl-rank]
18
+ [![Open Source Helpers][👽oss-helpi]][👽oss-help]
19
+ [![Depfu][🔑depfui♻️]][🔑depfu]
20
+ [![CodeCov Test Coverage][🔑codecovi♻️]][🔑codecov]
21
+ [![Coveralls Test Coverage][🔑coveralls-img]][🔑coveralls]
22
+ [![CodeClimate Test Coverage][🔑cc-covi♻️]][🔑cc-cov]
23
+ [![Maintainability][🔑cc-mnti♻️]][🔑cc-mnt]
24
+ [![CI Heads][🚎3-hd-wfi]][🚎3-hd-wf]
25
+ [![CI Current][🚎11-c-wfi]][🚎11-c-wf]
26
+ [![CI Supported][🚎6-s-wfi]][🚎6-s-wf]
27
+ [![CI Legacy][🚎4-lg-wfi]][🚎4-lg-wf]
28
+ [![CI Unsupported][🚎7-us-wfi]][🚎7-us-wf]
29
+ [![CI Test Coverage][🚎2-cov-wfi]][🚎2-cov-wf]
30
+ [![CI Style][🚎5-st-wfi]][🚎5-st-wf]
31
+
32
+ ---
33
+
34
+ [![Liberapay Patrons][⛳liberapay-img]][⛳liberapay]
35
+ [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor]
36
+ [![Buy me a coffee][🖇buyme-small-img]][🖇buyme]
37
+ [![Polar Shield][🖇polar-img]][🖇polar]
38
+ [![Donate to my FLOSS or refugee efforts at ko-fi.com][🖇kofi-img]][🖇kofi]
39
+ [![Donate to my FLOSS or refugee efforts using Patreon][🖇patreon-img]][🖇patreon]
40
+
41
+ Masq2 is a mountable Rails engine that provides OpenID server/identity provider functionality.
42
+ It is the successor to the [masq gem](https://github.com/dennisreimann/masq), which in turn
43
+ was the successor of the stand-alone Rails application of the same purpose, [masquerade](http://github.com/dennisreimann/masquerade/).
44
+
45
+ Because of this history, and the desire to be drop-in compatible with `masq`,
46
+ the namespace remains `Masq`, not `Masq2`.
47
+
48
+ The project is released under the MIT-License and its source code is available at [GitHub](http://github.com/oauth-xx/masq2/).
49
+ Feel free to fork and submit patches :)
50
+
51
+ ## Info you can shake a stick at
52
+
53
+ | Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
54
+ |-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
55
+ | Works with MRI Ruby 3 | [![Ruby 3.0 Compat][💎ruby-3.0i]][🚎4-lg-wf] [![Ruby 3.1 Compat][💎ruby-3.1i]][🚎6-s-wf] [![Ruby 3.2 Compat][💎ruby-3.2i]][🚎6-s-wf] [![Ruby 3.3 Compat][💎ruby-3.3i]][🚎6-s-wf] [![Ruby 3.4 Compat][💎ruby-c-i]][🚎11-c-wf] [![Ruby HEAD Compat][💎ruby-headi]][🚎3-hd-wf] |
56
+ | Works with MRI Ruby 2 | [![Ruby 2.7 Compat][💎ruby-2.7i]][🚎7-us-wf] |
57
+ | Source | [![Source on GitLab.com][📜src-gl-img]][📜src-gl] [![Source on Github.com][📜src-gh-img]][📜src-gh] [![The best SHA: dQw4w9WgXcQ!][🧮kloc-img]][🧮kloc] |
58
+ | Documentation | [![Current release on RubyDoc.info][📜docs-cr-rd-img]][🚎yard-current] [![HEAD on RubyDoc.info][📜docs-head-rd-img]][🚎yard-head] [![BDFL Blog][🚂bdfl-blog-img]][🚂bdfl-blog] [![Wiki][📜wiki-img]][📜wiki] |
59
+ | Compliance | [![License: MIT][📄license-img]][📄license-ref] [![📄ilo-declaration-img]][📄ilo-declaration] [![Security Policy][🔐security-img]][🔐security] [![CodeQL][🖐codeQL-img]][🖐codeQL] [![Contributor Covenant 2.1][🪇conduct-img]][🪇conduct] [![SemVer 2.0.0][📌semver-img]][📌semver] [![Keep-A-Changelog 1.0.0][📗keep-changelog-img]][📗keep-changelog] |
60
+ | Expert 1:1 Support | [![Get help from me on Upwork][👨🏼‍🏫expsup-upwork-img]][👨🏼‍🏫expsup-upwork] `or` [![Get help from me on Codementor][👨🏼‍🏫expsup-codementor-img]][👨🏼‍🏫expsup-codementor] |
61
+ | Enterprise Support | [![Get help from me on Tidelift][🏙️entsup-tidelift-img]][🏙️entsup-tidelift]<br/>💡Subscribe for support guarantees covering _all_ FLOSS dependencies!<br/>💡Tidelift is part of [Sonar][🏙️entsup-tidelift-sonar]!<br/>💡Tidelift pays maintainers to maintain the software you depend on!<br/>📊`@`Pointy Haired Boss: An [enterprise support][🏙️entsup-tidelift] subscription is "[never gonna let you down][🧮kloc]", and *supports* open source maintainers! |
62
+ | Comrade BDFL 🎖️ | [![Follow Me on LinkedIn][💖🖇linkedin-img]][💖🖇linkedin] [![Follow Me on Ruby.Social][💖🐘ruby-mast-img]][💖🐘ruby-mast] [![Follow Me on Bluesky][💖🦋bluesky-img]][💖🦋bluesky] [![Contact BDFL][🚂bdfl-contact-img]][🚂bdfl-contact] [![My technical writing][💖💁🏼‍♂️devto-img]][💖💁🏼‍♂️devto] |
63
+ | `...` 💖 | [![Find Me on WellFound:][💖✌️wellfound-img]][💖✌️wellfound] [![Find Me on CrunchBase][💖💲crunchbase-img]][💖💲crunchbase] [![My LinkTree][💖🌳linktree-img]][💖🌳linktree] [![More About Me][💖💁🏼‍♂️aboutme-img]][💖💁🏼‍♂️aboutme] |
64
+
65
+ ## Installation
66
+
67
+ 1. In case you want to run Masq2 as a standalone application (not integrated into an existing app), you will have to generate a bare-bone Rails app first:
68
+ * `rails new my_openid_provider`
69
+
70
+ 2. Add `masq2` to your Gemfile and install it:
71
+ * `gem 'masq2'`
72
+ * `bundle install`
73
+
74
+ 3. Copy the configuration and edit it:
75
+ * `bundle exec rake masq:install:config`
76
+ * `$EDITOR config/masq.yml`
77
+
78
+ 4. Copy the migrations and migrate:
79
+ * `bundle exec rake masq:install:migrations`
80
+ * `bundle exec rake db:migrate`
81
+
82
+ 5. Configure the routes by mounting the masq engine:
83
+ * For integration into an existing app, mount it in a subdirectory, like:
84
+ * `mount Masq::Engine => "/masq"` or
85
+ * `mount Masq::Engine => "/openid"`
86
+ * Standalone installation, mount it at the root:
87
+ * `mount Masq::Engine => "/"`
88
+
89
+ ## Testing the installation
90
+
91
+ You can test the functionality in your local environment starting two instances: One as
92
+ your Identity Provider/OpenID Server and another one as Relying Party.
93
+
94
+ * `rails server`
95
+ * `rails server -p 3001`
96
+
97
+ Open your browser with these urls (assumes you mounted the engine at */masq*):
98
+
99
+ * [http://localhost:3000/masq](http://localhost:3000/masq) (Identity Provider)
100
+ * [http://localhost:3001/masq/consumer](http://localhost:3001/masq/consumer) (Relying Party testsuite)
101
+
102
+ First you have to create an account at the Identity Provider, after that you will be able
103
+ to use the issued OpenID URL (`http://localhost:3000/masq/YOUR_LOGIN`) to send requests from the
104
+ Relying Party to the server.
105
+
106
+ Use the options provided by the OpenID verification form to test several aspects of the
107
+ client-server communication (like requesting simple registration data).
108
+
109
+ ## Development
110
+
111
+ ### Introduction
112
+
113
+ `masq2` adds ORACLE database support, as well as support for
114
+ Rails 5.2, 6.0, 6.1, 7.0, 7.1, 7.2, 8.0,
115
+ which `masq` never had.
116
+
117
+ The main functionality is in the server controller, which is the endpoint for incoming
118
+ OpenID requests. The server controller is supposed to only interact with relying parties
119
+ a.k.a. consumer websites. It includes the OpenidServerSystem module, which provides some
120
+ handy methods to access and answer OpenID requests.
121
+
122
+ #### v1 Release Breaking Change
123
+
124
+ \[📒Also Rails 5.2+ / Serialization / Psych Caveats\]
125
+
126
+ v1 release has a breaking change from the ancient masq v0.3.4 release.
127
+ Continue reading if you think it may impact you.
128
+
129
+ Rails 5.2.8.1 is a security patch release to fix CVE-2022-32224.
130
+ See: https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017
131
+
132
+ The patch (Rails v5.2.8.1) causes an error with `masq` v0.3.4
133
+ (... actually it doesn't work at all on Rails v5, but some forks have been fixed):
134
+
135
+ ```
136
+ Psych::DisallowedClass: Tried to load unspecified class: ActiveSupport::HashWithIndifferentAccess
137
+ ```
138
+
139
+ when serializing a Hash the way we had done in previous versions `app/models/masq/open_id_request.rb`:
140
+ ```ruby
141
+ serialize :parameters, Hash
142
+ ```
143
+
144
+ so we instead switch to serializing as JSON:
145
+ ```ruby
146
+ # Rails 5.2/6.0
147
+ serialize :parameters, JSON
148
+ # Rails 6.1+
149
+ serialize :parameters, type: Hash, coder: JSON
150
+ ```
151
+
152
+ If an implementation needs to continue using the serialized Hash,
153
+ you will need to override the definition by reopening the model,
154
+ and set it back to the old way!
155
+
156
+ ```ruby
157
+ # Rails 5.2/6.0
158
+ serialize :parameters, Hash
159
+ # Rails 6.1+ (untested, might not work!)
160
+ serialize :parameters, type: Hash, coder: Hash
161
+ ```
162
+
163
+ In addition, one of the following is also needed.
164
+
165
+ 1. Simple, but insecure fix, which reverts to previous unpatched behavior is:
166
+
167
+ ```ruby
168
+ Rails.application.config.active_record.use_yaml_unsafe_load = true
169
+ ```
170
+
171
+ 2. More complex, and a bit less insecure fix, is to explicitly list the allowed classes to serialize:
172
+
173
+ ```ruby
174
+ Rails.application.config.active_record.yaml_column_permitted_classes = [Symbol, Date, Time, HashWithIndifferentAccess]
175
+ ```
176
+
177
+ ### Testing
178
+
179
+ You can run the tests with Rake:
180
+
181
+ * `DB_ADAPTER=sqlite3 bundle exec rake app:masq:test:ci`
182
+ * `DB_ADAPTER=mysql2 bundle exec rake app:masq:test:ci`
183
+ * `DB_ADAPTER=postgresql bundle exec rake app:masq:test:ci`
184
+
185
+ The Rake task configures the database.yml for the chosen adapter.
186
+
187
+ In case you prefer running the tests continuously, use Guard:
188
+
189
+ * `bundle exec guard`
190
+
191
+ ## 🔐 Security
192
+
193
+ See [SECURITY.md][🔐security].
194
+
195
+ ## 🤝 Contributing
196
+
197
+ If you need some ideas of where to help, you could work on adding more code coverage,
198
+ or if it is already 💯 (see [below](#code-coverage)) check TODOs (see [below](#todos)),
199
+ or check [issues][🤝issues], or [PRs][🤝pulls],
200
+ or use the gem and think about how it could be better.
201
+
202
+ We [![Keep A Changelog][📗keep-changelog-img]][📗keep-changelog] so if you make changes, remember to update it.
203
+
204
+ See [CONTRIBUTING.md][🤝contributing] for more detailed instructions.
205
+
206
+ ### Code Coverage
207
+
208
+ [![Coverage Graph][🔑codecov-g♻️]][🔑codecov]
209
+
210
+ ### 🪇 Code of Conduct
211
+
212
+ Everyone interacting in this project's codebases, issue trackers,
213
+ chat rooms and mailing lists is expected to follow the [![Contributor Covenant 2.1][🪇conduct-img]][🪇conduct].
214
+
215
+ ## 🌈 Contributors
216
+
217
+ [![Contributors][🖐contributors-img]][🖐contributors]
218
+
219
+ Made with [contributors-img][🖐contrib-rocks].
220
+
221
+ Also see GitLab Contributors: [https://gitlab.com/oauth-xx/masq2/-/graphs/main][🚎contributors-gl]
222
+
223
+ ## ⭐️ Star History
224
+
225
+ <a href="https://star-history.com/#oauth-xx/masq2&Date">
226
+ <picture>
227
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=oauth-xx/masq2&type=Date&theme=dark" />
228
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=oauth-xx/masq2&type=Date" />
229
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=oauth-xx/masq2&type=Date" />
230
+ </picture>
231
+ </a>
232
+
233
+ ## 📌 Versioning
234
+
235
+ This Library adheres to [![Semantic Versioning 2.0.0][📌semver-img]][📌semver].
236
+ Violations of this scheme should be reported as bugs.
237
+ Specifically, if a minor or patch version is released that breaks backward compatibility,
238
+ a new version should be immediately released that restores compatibility.
239
+ Breaking changes to the public API will only be introduced with new major versions.
240
+
241
+ ### 📌 Is "Platform Support" part of the public API?
242
+
243
+ Yes. But I'm obligated to include notes...
244
+
245
+ SemVer should, but doesn't explicitly, say that dropping support for specific Platforms
246
+ is a *breaking change* to an API.
247
+ It is obvious to many, but not all, and since the spec is silent, the bike shedding is endless.
248
+
249
+ > dropping support for a platform is both obviously and objectively a breaking change
250
+
251
+ - Jordan Harband (@ljharb) [in SemVer issue 716][📌semver-breaking]
252
+
253
+ To get a better understanding of how SemVer is intended to work over a project's lifetime,
254
+ read this article from the creator of SemVer:
255
+
256
+ - ["Major Version Numbers are Not Sacred"][📌major-versions-not-sacred]
257
+
258
+ As a result of this policy, and the interpretive lens used by the maintainer,
259
+ you can (and should) specify a dependency on these libraries using
260
+ the [Pessimistic Version Constraint][📌pvc] with two digits of precision.
261
+
262
+ For example:
263
+
264
+ ```ruby
265
+ spec.add_dependency("masq2", "~> 1.0")
266
+ ```
267
+
268
+ See [CHANGELOG.md][📌changelog] for list of releases.
269
+
270
+ ## 📄 License
271
+
272
+ The gem is available as open source under the terms of
273
+ the [MIT License][📄license] [![License: MIT][📄license-img]][📄license-ref].
274
+ See [LICENSE.txt][📄license] for the official [Copyright Notice][📄copyright-notice-explainer].
275
+
276
+ ### © Copyright
277
+
278
+ <p>
279
+ Copyright (c) 2024 - 2025 Peter H. Boling,
280
+ <a href="https://railsbling.com">
281
+ RailsBling.com
282
+ <picture>
283
+ <img alt="Rails Bling" height="20" src="https://railsbling.com/images/logos/RailsBling-TrainLogo.svg" />
284
+ </picture>
285
+ </a>
286
+ </p>
287
+
288
+ ## 🤑 One more thing
289
+
290
+ You made it to the bottom of the page,
291
+ so perhaps you'll indulge me for another 20 seconds.
292
+ I maintain many dozens of gems, including this one,
293
+ because I want Ruby to be a great place for people to solve problems, big and small.
294
+ Please consider supporting my efforts via the giant yellow link below,
295
+ or one of the others at the head of this README.
296
+
297
+ [![Buy me a latte][🖇buyme-img]][🖇buyme]
298
+
299
+ [✇bundle-group-pattern]: https://gist.github.com/pboling/4564780
300
+ [⛳️gem-namespace]: https://github.com/oauth-xx/masq2/blob/main/lib/masq.rb
301
+ [⛳️namespace-img]: https://img.shields.io/badge/namespace-Masq-brightgreen.svg?style=flat&logo=ruby&logoColor=white
302
+ [⛳️gem-name]: https://rubygems.org/gems/masq2
303
+ [⛳️name-img]: https://img.shields.io/badge/name-masq2-brightgreen.svg?style=flat&logo=rubygems&logoColor=red
304
+ [🚂bdfl-blog]: http://www.railsbling.com/tags/masq2
305
+ [🚂bdfl-blog-img]: https://img.shields.io/badge/blog-railsbling-0093D0.svg?style=for-the-badge&logo=rubyonrails&logoColor=orange
306
+ [🚂bdfl-contact]: http://www.railsbling.com/contact
307
+ [🚂bdfl-contact-img]: https://img.shields.io/badge/Contact-BDFL-0093D0.svg?style=flat&logo=rubyonrails&logoColor=red
308
+ [💖🖇linkedin]: http://www.linkedin.com/in/peterboling
309
+ [💖🖇linkedin-img]: https://img.shields.io/badge/PeterBoling-LinkedIn-0B66C2?style=flat&logo=newjapanprowrestling
310
+ [💖✌️wellfound]: https://angel.co/u/peter-boling
311
+ [💖✌️wellfound-img]: https://img.shields.io/badge/peter--boling-orange?style=flat&logo=wellfound
312
+ [💖💲crunchbase]: https://www.crunchbase.com/person/peter-boling
313
+ [💖💲crunchbase-img]: https://img.shields.io/badge/peter--boling-purple?style=flat&logo=crunchbase
314
+ [💖🐘ruby-mast]: https://ruby.social/@galtzo
315
+ [💖🐘ruby-mast-img]: https://img.shields.io/mastodon/follow/109447111526622197?domain=https%3A%2F%2Fruby.social&style=flat&logo=mastodon&label=Ruby%20%40galtzo
316
+ [💖🦋bluesky]: https://galtzo.bsky.social
317
+ [💖🦋bluesky-img]: https://img.shields.io/badge/@galtzo.bsky.social-0285FF?style=flat&logo=bluesky&logoColor=white
318
+ [💖🌳linktree]: https://linktr.ee/galtzo
319
+ [💖🌳linktree-img]: https://img.shields.io/badge/galtzo-purple?style=flat&logo=linktree
320
+ [💖💁🏼‍♂️devto]: https://dev.to/galtzo
321
+ [💖💁🏼‍♂️devto-img]: https://img.shields.io/badge/dev.to-0A0A0A?style=flat&logo=devdotto&logoColor=white
322
+ [💖💁🏼‍♂️aboutme]: https://about.me/peter.boling
323
+ [💖💁🏼‍♂️aboutme-img]: https://img.shields.io/badge/about.me-0A0A0A?style=flat&logo=aboutme&logoColor=white
324
+ [👨🏼‍🏫expsup-upwork]: https://www.upwork.com/freelancers/~014942e9b056abdf86?mp_source=share
325
+ [👨🏼‍🏫expsup-upwork-img]: https://img.shields.io/badge/UpWork-13544E?style=for-the-badge&logo=Upwork&logoColor=white
326
+ [👨🏼‍🏫expsup-codementor]: https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github
327
+ [👨🏼‍🏫expsup-codementor-img]: https://img.shields.io/badge/CodeMentor-Get_Help-1abc9c?style=for-the-badge&logo=CodeMentor&logoColor=white
328
+ [🏙️entsup-tidelift]: https://tidelift.com/subscription
329
+ [🏙️entsup-tidelift-img]: https://img.shields.io/badge/Tidelift_and_Sonar-Enterprise_Support-FD3456?style=for-the-badge&logo=sonar&logoColor=white
330
+ [🏙️entsup-tidelift-sonar]: https://blog.tidelift.com/tidelift-joins-sonar
331
+ [💁🏼‍♂️peterboling]: http://www.peterboling.com
332
+ [🚂railsbling]: http://www.railsbling.com
333
+ [📜src-gl-img]: https://img.shields.io/badge/GitLab-FBA326?style=for-the-badge&logo=Gitlab&logoColor=orange
334
+ [📜src-gl]: https://gitlab.com/oauth-xx/masq2/
335
+ [📜src-gh-img]: https://img.shields.io/badge/GitHub-238636?style=for-the-badge&logo=Github&logoColor=green
336
+ [📜src-gh]: https://github.com/oauth-xx/masq2
337
+ [📜docs-cr-rd-img]: https://img.shields.io/badge/RubyDoc-Current_Release-943CD2?style=for-the-badge&logo=readthedocs&logoColor=white
338
+ [📜docs-head-rd-img]: https://img.shields.io/badge/RubyDoc-HEAD-943CD2?style=for-the-badge&logo=readthedocs&logoColor=white
339
+ [📜wiki]: https://gitlab.com/oauth-xx/masq2/-/wikis/home
340
+ [📜wiki-img]: https://img.shields.io/badge/wiki-examples-943CD2.svg?style=for-the-badge&logo=Wiki&logoColor=white
341
+ [👽dl-rank]: https://rubygems.org/gems/masq2
342
+ [👽dl-ranki]: https://img.shields.io/gem/rd/masq2.svg
343
+ [👽oss-help]: https://www.codetriage.com/oauth-xx/masq2
344
+ [👽oss-helpi]: https://www.codetriage.com/oauth-xx/masq2/badges/users.svg
345
+ [👽version]: https://rubygems.org/gems/masq2
346
+ [👽versioni]: https://img.shields.io/gem/v/masq2.svg
347
+ [🔑cc-mnt]: https://qlty.sh/gh/oauth-xx/projects/masq2
348
+ [🔑cc-mnti♻️]: https://qlty.sh/badges/018b561f-0b1d-478b-910e-5133f71fd973/maintainability.svg
349
+ [🔑cc-cov]: https://qlty.sh/gh/oauth-xx/projects/masq2
350
+ [🔑cc-covi♻️]: https://qlty.sh/badges/018b561f-0b1d-478b-910e-5133f71fd973/test_coverage.svg
351
+ [🔑codecov]: https://codecov.io/gh/oauth-xx/masq2
352
+ [🔑codecovi♻️]: https://codecov.io/gh/oauth-xx/masq2/branch/main/graph/badge.svg?token=xqVPZjg76X
353
+ [🔑coveralls]: https://coveralls.io/github/oauth-xx/masq2?branch=main
354
+ [🔑coveralls-img]: https://coveralls.io/repos/github/oauth-xx/masq2/badge.svg?branch=main
355
+ [🔑depfu]: https://depfu.com/github/oauth-xx/masq2?project_id=60301
356
+ [🔑depfui♻️]: https://badges.depfu.com/badges/c31817967a3a2467ee56d3e95c3a2802/count.svg
357
+ [🖐codeQL]: https://github.com/oauth-xx/masq2/security/code-scanning
358
+ [🖐codeQL-img]: https://github.com/oauth-xx/masq2/actions/workflows/codeql-analysis.yml/badge.svg
359
+ [🚎1-an-wf]: https://github.com/oauth-xx/masq2/actions/workflows/ancient.yml
360
+ [🚎1-an-wfi]: https://github.com/oauth-xx/masq2/actions/workflows/ancient.yml/badge.svg
361
+ [🚎2-cov-wf]: https://github.com/oauth-xx/masq2/actions/workflows/coverage.yml
362
+ [🚎2-cov-wfi]: https://github.com/oauth-xx/masq2/actions/workflows/coverage.yml/badge.svg
363
+ [🚎3-hd-wf]: https://github.com/oauth-xx/masq2/actions/workflows/heads.yml
364
+ [🚎3-hd-wfi]: https://github.com/oauth-xx/masq2/actions/workflows/heads.yml/badge.svg
365
+ [🚎4-lg-wf]: https://github.com/oauth-xx/masq2/actions/workflows/legacy.yml
366
+ [🚎4-lg-wfi]: https://github.com/oauth-xx/masq2/actions/workflows/legacy.yml/badge.svg
367
+ [🚎5-st-wf]: https://github.com/oauth-xx/masq2/actions/workflows/style.yml
368
+ [🚎5-st-wfi]: https://github.com/oauth-xx/masq2/actions/workflows/style.yml/badge.svg
369
+ [🚎6-s-wf]: https://github.com/oauth-xx/masq2/actions/workflows/supported.yml
370
+ [🚎6-s-wfi]: https://github.com/oauth-xx/masq2/actions/workflows/supported.yml/badge.svg
371
+ [🚎7-us-wf]: https://github.com/oauth-xx/masq2/actions/workflows/unsupported.yml
372
+ [🚎7-us-wfi]: https://github.com/oauth-xx/masq2/actions/workflows/unsupported.yml/badge.svg
373
+ [🚎8-ho-wf]: https://github.com/oauth-xx/masq2/actions/workflows/hoary.yml
374
+ [🚎8-ho-wfi]: https://github.com/oauth-xx/masq2/actions/workflows/hoary.yml/badge.svg
375
+ [🚎11-c-wf]: https://github.com/oauth-xx/masq2/actions/workflows/current.yml
376
+ [🚎11-c-wfi]: https://github.com/oauth-xx/masq2/actions/workflows/current.yml/badge.svg
377
+ [⛳liberapay-img]: https://img.shields.io/liberapay/patrons/pboling.svg?logo=liberapay
378
+ [⛳liberapay]: https://liberapay.com/pboling/donate
379
+ [🖇sponsor-img]: https://img.shields.io/badge/Sponsor_Me!-pboling.svg?style=social&logo=github
380
+ [🖇sponsor]: https://github.com/sponsors/pboling
381
+ [🖇polar-img]: https://polar.sh/embed/seeks-funding-shield.svg?org=pboling
382
+ [🖇polar]: https://polar.sh/pboling
383
+ [🖇kofi-img]: https://img.shields.io/badge/buy_me_coffee-donate-yellow.svg
384
+ [🖇kofi]: https://ko-fi.com/O5O86SNP4
385
+ [🖇patreon-img]: https://img.shields.io/badge/patreon-donate-yellow.svg
386
+ [🖇patreon]: https://patreon.com/galtzo
387
+ [💎ruby-2.7i]: https://img.shields.io/badge/Ruby-2.7-DF00CA?style=for-the-badge&logo=ruby&logoColor=white
388
+ [💎ruby-3.0i]: https://img.shields.io/badge/Ruby-3.0-CC342D?style=for-the-badge&logo=ruby&logoColor=white
389
+ [💎ruby-3.1i]: https://img.shields.io/badge/Ruby-3.1-CC342D?style=for-the-badge&logo=ruby&logoColor=white
390
+ [💎ruby-3.2i]: https://img.shields.io/badge/Ruby-3.2-CC342D?style=for-the-badge&logo=ruby&logoColor=white
391
+ [💎ruby-3.3i]: https://img.shields.io/badge/Ruby-3.3-CC342D?style=for-the-badge&logo=ruby&logoColor=white
392
+ [💎ruby-c-i]: https://img.shields.io/badge/Ruby-current-CC342D?style=for-the-badge&logo=ruby&logoColor=green
393
+ [💎ruby-headi]: https://img.shields.io/badge/Ruby-HEAD-CC342D?style=for-the-badge&logo=ruby&logoColor=blue
394
+ [🤝issues]: https://github.com/oauth-xx/masq2/issues
395
+ [🤝pulls]: https://github.com/oauth-xx/masq2/pulls
396
+ [🤝contributing]: CONTRIBUTING.md
397
+ [🔑codecov-g♻️]: https://codecov.io/gh/oauth-xx/masq2/graphs/tree.svg?token=xqVPZjg76X
398
+ [🖐contrib-rocks]: https://contrib.rocks
399
+ [🖐contributors]: https://github.com/oauth-xx/masq2/graphs/contributors
400
+ [🖐contributors-img]: https://contrib.rocks/image?repo=oauth-xx/masq2
401
+ [🚎contributors-gl]: https://gitlab.com/oauth-xx/masq2/-/graphs/main
402
+ [🪇conduct]: CODE_OF_CONDUCT.md
403
+ [🪇conduct-img]: https://img.shields.io/badge/Contributor_Covenant-2.1-4baaaa.svg
404
+ [📌pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
405
+ [📌semver]: https://semver.org/spec/v2.0.0.html
406
+ [📌semver-img]: https://img.shields.io/badge/semver-2.0.0-FFDD67.svg?style=flat
407
+ [📌semver-breaking]: https://github.com/semver/semver/issues/716#issuecomment-869336139
408
+ [📌major-versions-not-sacred]: https://tom.preston-werner.com/2022/05/23/major-version-numbers-are-not-sacred.html
409
+ [📌changelog]: CHANGELOG.md
410
+ [📗keep-changelog]: https://keepachangelog.com/en/1.0.0/
411
+ [📗keep-changelog-img]: https://img.shields.io/badge/keep--a--changelog-1.0.0-FFDD67.svg?style=flat
412
+ [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
413
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-0.075-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
414
+ [🔐security]: SECURITY.md
415
+ [🔐security-img]: https://img.shields.io/badge/security-policy-brightgreen.svg?style=flat
416
+ [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
417
+ [📄license]: LICENSE.txt
418
+ [📄license-ref]: https://opensource.org/licenses/MIT
419
+ [📄license-img]: https://img.shields.io/badge/License-MIT-green.svg
420
+ [📄ilo-declaration]: https://www.ilo.org/declaration/lang--en/index.htm
421
+ [📄ilo-declaration-img]: https://img.shields.io/badge/ILO_Fundamental_Principles-✓-brightgreen.svg?style=flat
422
+ [🚎yard-current]: http://rubydoc.info/gems/masq2
423
+ [🚎yard-head]: https://rubydoc.info/github/oauth-xx/masq2/main
424
+ [🖇buyme-img]: https://img.buymeacoffee.com/button-api/?text=Buy%20me%20a%20latte&emoji=&slug=pboling&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff
425
+ [🖇buyme]: https://www.buymeacoffee.com/pboling
426
+ [🖇buyme-small-img]: https://img.shields.io/badge/Buy--Me--A--Coffee-✓-brightgreen.svg?style=flat
data/SECURITY.md ADDED
@@ -0,0 +1,23 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ |------------|-----------|
7
+ | 1.0.latest | ✅ |
8
+ | 0.x | ❌ |
9
+
10
+ ## Security contact information
11
+
12
+ To report a security vulnerability, other than the [known ones listed here][known-ones], please use the
13
+ [Tidelift security contact](https://tidelift.com/security).
14
+ Tidelift will coordinate the fix and disclosure.
15
+
16
+ ## Additional Support
17
+
18
+ If you are interested in support for versions older than the latest release,
19
+ please consider sponsoring the project / maintainer @ https://liberapay.com/pboling/donate,
20
+ or find other sponsorship links in the [README].
21
+
22
+ [README]: README.md
23
+ [known-ones]: https://github.com/oauth-xx/masq2/security/code-scanning
Binary file
@@ -0,0 +1,61 @@
1
+ * { margin: 0; padding: 0; }
2
+ body { font: normal 100% Helvetica, Arial, sans-serif; line-height: 1.7em; color: #222; }
3
+ .wrap { width: 44em; }
4
+ #head { position: relative; height: 4em; padding: 0 3em; background: #222; color: #FFF; }
5
+ #head h1 { position: absolute; bottom: 0.2em; font-size: 2em; font-weight: normal; letter-spacing: -0.05em; }
6
+ #head h1 a { color: #FFF; }
7
+ #navi { position: absolute; bottom: 0.1em; left: 15em; width: 32em; list-style: none; margin: 0; }
8
+ #navi li { float: left; margin-right: 0.4em; }
9
+ #navi a { color: #FFF; padding: 0.6em 0.5em 0.5em 0.5em; }
10
+ #navi a:focus,
11
+ #navi a:hover { color: #FF6200; }
12
+ #navi li.act a { color: #222; background: #FFF; border-top: 2px solid #FF6200; }
13
+ #main { padding: 2em 3em; background: #FFF; color: #000; }
14
+ #main li { margin: 0; border-bottom: 1px dotted #CCC; padding: 0.5em 0; }
15
+ #main ul { list-style: none; }
16
+ #foot { padding: 0.3em 3em 1em 3em; text-align: right; }
17
+ #foot a { text-decoration: none; }
18
+ h2 { margin: 0.2em 0 0.5em 0; font-size: 1.4em; font-weight: bold; color: #FF6200; }
19
+ h3 { margin: 0; font-size: 1.1em; font-weight: bold; }
20
+ h3 .note { margin-left: 0.3em; }
21
+ form h3 { margin: 0 0 0.5em 0; }
22
+ p { margin-bottom: 0.7em; }
23
+ ul { margin: 0 0 1.7em 0; }
24
+ a { color: #FF6200; text-decoration: none; }
25
+ img { border: 0; }
26
+ form { margin: 0 0 1.7em 0; }
27
+ small { font-size: 0.8em; font-weight: normal; }
28
+ table { margin: 0 0 1.7em 0; }
29
+ th { font-weight: normal; padding: 0.2em 2em 0.2em 0; text-align: left; color: #AAA; }
30
+ td { padding: 0.2em 2em 0.2em 0; }
31
+ form { margin: 1em 0 1.7em 0; border: 1px dotted #CCC; border-top: 2px solid #AAA; padding: 1em; }
32
+ input { padding: 0.2em; }
33
+ select { width: 24em; }
34
+ input[type=text],
35
+ input[type=password] { width: 24em; }
36
+ input[type=checkbox],
37
+ input[type=radio] { position: relative; top: -0.2em; }
38
+ input.space { margin-right: 0.7em; }
39
+ select#persona_dob_day { width: 6em; }
40
+ select#persona_dob_month { width: 11em; }
41
+ select#persona_dob_year { width: 6em; }
42
+ div.row { margin: 0 0 0.7em 0; clear: both; }
43
+ div.space { margin: 0 0 1.7em 0; }
44
+ label { display: block; }
45
+ label.check { display: inline; margin: 0 2em 0 0.2em; }
46
+ label.note { display: inline; margin: 0 0 0 0.4em; }
47
+ div.inline label { float: left; width: 8.5em; }
48
+ .labelspace { margin-left: 10.5em; }
49
+ .options a { margin-right: 0.7em; }
50
+ .note { font-size: 0.9em; color: #AAA; font-weight: normal; }
51
+ .note a,
52
+ a#forgot_password { color: #AAA; margin: 0 0.3em; text-decoration: underline; font-weight: normal; }
53
+ #openid_identifier { background: url(<%= image_path('masq/openid_symbol.png') %>) 2px 40% no-repeat; padding-left: 25px; }
54
+ .clear { clear: both; }
55
+ .notice { margin: 0 0 1.7em 0; border: 1px solid #60964f; padding: 0.5em; background: #b3dca7; }
56
+ .fieldWithErrors label { color: #FF6200; }
57
+ .error,
58
+ #errorExplanation { margin: 0 0 1.7em 0; padding: 0.5em 1em; background: #FF6200; color: #222; }
59
+ #errorExplanation h2 { font-size: 1.1em; color: #222; }
60
+ #errorExplanation ul { margin: 0 0 0 1.2em; list-style: square; }
61
+ #errorExplanation ul li { padding: 0; border: 0; }
@@ -0,0 +1,132 @@
1
+ module Masq
2
+ class AccountsController < BaseController
3
+ before_action :check_disabled_registration, only: [:new, :create]
4
+ before_action :login_required, except: [:show, :new, :create, :activate, :resend_activation_email]
5
+ before_action :detect_xrds, only: :show
6
+
7
+ def show
8
+ @account =
9
+ if params[:account].to_i.to_s == params[:account].to_s
10
+ Account.find_by(id: params[:account], enabled: true)
11
+ else
12
+ Account.find_by(login: params[:account], enabled: true)
13
+ end
14
+
15
+ raise ActiveRecord::RecordNotFound if @account.nil?
16
+
17
+ respond_to do |format|
18
+ format.html do
19
+ response.headers["X-XRDS-Location"] = identity_url(account: @account, format: :xrds, protocol: scheme)
20
+ end
21
+ format.xrds
22
+ end
23
+ end
24
+
25
+ def new
26
+ @account = Account.new
27
+ end
28
+
29
+ def create
30
+ cookies.delete(:auth_token)
31
+ account_params[:login] = account_params[:email] if email_as_login?
32
+ signup = Signup.create_account!(account_params)
33
+ if signup.succeeded?
34
+ redirect_to(login_path, notice: signup.send_activation_email? ?
35
+ t(:thanks_for_signing_up_activation_link) :
36
+ t(:thanks_for_signing_up))
37
+ else
38
+ @account = signup.account
39
+ render(action: "new")
40
+ end
41
+ end
42
+
43
+ def update
44
+ account_params.delete(:email) if email_as_login?
45
+ account_params.delete(:login)
46
+
47
+ if current_account.update(account_params)
48
+ redirect_to(edit_account_path(account: current_account), notice: t(:profile_updated))
49
+ else
50
+ render(action: "edit")
51
+ end
52
+ end
53
+
54
+ def destroy
55
+ return render_404 unless Masq::Engine.config.masq["can_disable_account"]
56
+
57
+ if current_account.authenticated?(params[:confirmation_password])
58
+ current_account.disable!
59
+ current_account.forget_me
60
+ cookies.delete(:auth_token)
61
+ reset_session
62
+ redirect_to(root_path, notice: t(:account_disabled))
63
+ else
64
+ redirect_to(edit_account_path, alert: t(:entered_password_is_wrong))
65
+ end
66
+ end
67
+
68
+ def activate
69
+ return render_404 unless Masq::Engine.config.masq["send_activation_mail"]
70
+
71
+ begin
72
+ Account.find_and_activate!(params[:activation_code])
73
+ redirect_to(login_path, notice: t(:account_activated_login_now))
74
+ rescue ArgumentError, Account::ActivationCodeNotFound
75
+ redirect_to(new_account_path, alert: t(:couldnt_find_account_with_code_create_new_one))
76
+ rescue Account::AlreadyActivated
77
+ redirect_to(login_path, alert: t(:account_already_activated_please_login))
78
+ end
79
+ end
80
+
81
+ def change_password
82
+ return render_404 unless Masq::Engine.config.masq["can_change_password"]
83
+
84
+ if Account.authenticate(current_account.login, params[:old_password])
85
+ if (params[:password] == params[:password_confirmation]) && !params[:password_confirmation].blank?
86
+ current_account.password_confirmation = params[:password_confirmation]
87
+ current_account.password = params[:password]
88
+ if current_account.save
89
+ redirect_to(edit_account_path(account: current_account), notice: t(:password_has_been_changed))
90
+ else
91
+ redirect_to(edit_account_path, alert: t(:sorry_password_couldnt_be_changed))
92
+ end
93
+ else
94
+ @old_password = params[:old_password]
95
+ redirect_to(edit_account_path, alert: t(:confirmation_of_new_password_invalid))
96
+ end
97
+ else
98
+ redirect_to(edit_account_path, alert: t(:old_password_incorrect))
99
+ end
100
+ end
101
+
102
+ def resend_activation_email
103
+ account = Account.find_by(login: params[:account])
104
+
105
+ if account && !account.active?
106
+ AccountMailer.signup_notification(account).deliver_now
107
+ flash[:notice] = t(:activation_link_resent)
108
+ else
109
+ flash[:alert] = t(:account_already_activated_or_missing)
110
+ end
111
+
112
+ redirect_to(login_path)
113
+ end
114
+
115
+ protected
116
+
117
+ def check_disabled_registration
118
+ render_404 if Masq::Engine.config.masq["disable_registration"]
119
+ end
120
+
121
+ def detect_xrds
122
+ if params[:account] =~ /\A(.+)\.xrds\z/
123
+ request.format = :xrds
124
+ params[:account] = $1
125
+ end
126
+ end
127
+
128
+ def account_params
129
+ @account_params ||= params.require(:account).permit(:login, :email, :password, :password_confirmation, :public_persona_id, :yubikey_mandatory)
130
+ end
131
+ end
132
+ end