Skip to content

Commit f02fceb

Browse files
24c02leowilkindeployorDaInfLoop
authored
VERSION. TWO. (#42)
* INITIAL SAML SUPPORT WOO YEA BABEY it works? * wawa * mwaow * b * WOAG * mph * bunch more stuff * new OAuth screen * add trust level to oauth apps * [community oauth] new scopes, validate only some community ones * bleh * my info first pass * sessions and 2fa * oauth authorizations/revoke * nuke sms * fix drift * remove hcid on ident#edit * attack our rack? * session fixation't * first pass at stepup auth * eye eighteen en * fix brand * think that does it for dev mode! * add promote to full user button * first crack at landing page * better sessions * better id edit * better verf * less css pass 1 * add phone no * better cssed? * securité * switch from slocks * HCA * touch last seen at * session fingerprinting * improved? * localize scopes * add proper oauth welcome * eepier tutorial * how long was that like that?! * common blankslate * better addresses? * [backend] fix reprovisioning and promotion * improve addresses * ICONS, BEAUTIFUL ICONS * primary sidebar * saml welcome? * new totp flow? * marginally better login sec * better print for backup codes! * MASSIVE LINT PASS * autocompletes * woops * new staging * actual login code txnl * no more legacy slack account linking * fake slack in staging * no account yet? * add samls for staging * fix slack_staging * lint * frickin' xmlsec * no validate keys ? * AUGH * ASGJHFGSDJFG * shoot me * aieeeee * SCHEIßE * no more attempt association on code * believe in prefers-color-scheme * fix verf icon * nuke vestigial aadhaar functionality thanks deployor! * fix xmlsec on gh ci * remove identity (#27) * move idcon flashes to locale * remove dead code impersonation logic h/t ian! * fix hx-confirm on delete address? * add missing dev app locale key * fix #28 * wait, i'm an idiot (#28) * THERE WE GO * add paper_trail to more stuff * red delete btn * more red delete btns * THE AUDIT LOGS UPDATE * yuge lint pass * Fix icons (#33) Some icons didn't have a fill nor a viewbox * weh * first pass at docs * memoize docs, fix 404 * [docs] add crappy erb support * support non-e+ flow * fix no devmode locale * DOCS DOCS DOCS * tldr dev doc * anti-clickjacking countdown (h/t @J-Meow) * weh * get rid of those, they do nothing for us * dependent destroy * find user via scim if ent * save nav channel ids * fix base onboarding scenario * only unique among the living * add SAML debug * simplify legacy_email * add UAT env * we ARE * add slack to uat * no entity id? * fix saml if logged out * fix scim assignment? * bring channels into config * darn it * try backoff on assign_to_workspace?? this feels problematic * do the scim docs lie? * that was dumb * Revert "do the scim docs lie?" This reverts commit 69310db. * Revert "try backoff on assign_to_workspace?? this feels problematic" This reverts commit 7a5edd6. * this some bull shit * internal tutorial by default * 18 point something * fixes: componentize login, no more viewcontext, parse sp-initiated saml better * one return to. * just send it * fix replay bug * fix URL in welcome docs page (#38) * simplify login/signup flow, s/faq/terms + privacy * no more H... we hardly knew you * first pass at reddening * red pt. 2 * she's red for an AMAZING reason * lint pass * fix tooled tips * another docs pass * initial pass at factorybotting docs * scope diffing for api docs! * wait we don't need a legend lol * add verf status to community apps * fricken lint * make current_user not nomethod * move are_we_enterprise_yet to a flipper flag * improve slack racing * allow not creating slack * factorybot in prod for api docs! * LOL, LMAO * properly set owner on oauthorizations * lint pass * bypass age on existing users * fix that... --------- Co-authored-by: Leo <[email protected]> Co-authored-by: Tom (Deployor) <[email protected]> Co-authored-by: DaInfLoop <[email protected]>
1 parent ecb8134 commit f02fceb

File tree

489 files changed

+12638
-1173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

489 files changed

+12638
-1173
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ jobs:
1313
- name: Checkout code
1414
uses: actions/checkout@v4
1515

16+
- name: Install system dependencies
17+
run: sudo apt-get update && sudo apt-get install -y libxmlsec1-dev libxmlsec1-openssl pkg-config
18+
1619
- name: Set up Ruby
1720
uses: ruby/setup-ruby@v1
1821
with:
@@ -28,6 +31,9 @@ jobs:
2831
- name: Checkout code
2932
uses: actions/checkout@v4
3033

34+
- name: Install system dependencies
35+
run: sudo apt-get update && sudo apt-get install -y libxmlsec1-dev libxmlsec1-openssl pkg-config
36+
3137
- name: Set up Ruby
3238
uses: ruby/setup-ruby@v1
3339
with:

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ node_modules
4646
/config/credentials/staging.key
4747

4848
/config/credentials/development.key
49+
50+
.idea
51+
**/.DS_Store
52+
/config/credentials/uat.key

.rspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--require spec_helper

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ WORKDIR /rails
1717
# Install base packages with runtime libraries for libheif
1818
RUN apt-get update -qq && \
1919
apt-get install --no-install-recommends -y curl libjemalloc2 libvips imagemagick postgresql-client libffi-dev \
20-
libjpeg62-turbo libaom3 libx265-199 libde265-0 libpng16-16 wget && \
20+
libjpeg62-turbo libaom3 libx265-199 libde265-0 libpng16-16 wget libxmlsec1 libxmlsec1-openssl && \
2121
apt-get clean && \
2222
rm -rf /var/lib/apt/lists/*
2323

@@ -40,7 +40,7 @@ FROM base AS build
4040
# Install packages needed to build gems
4141
RUN apt-get update -qq && \
4242
apt-get install --no-install-recommends -y curl libjemalloc2 libvips imagemagick postgresql-client libffi-dev build-essential git libpq-dev libyaml-dev pkg-config \
43-
cmake libjpeg-dev libpng-dev libaom-dev libx265-dev libde265-dev && \
43+
cmake libjpeg-dev libpng-dev libaom-dev libx265-dev libde265-dev libxmlsec1-dev libxmlsec1 libxmlsec1-openssl && \
4444
# Build libheif from latest source with examples
4545
cd /tmp && \
4646
git clone --depth 1 https://github.com/strukturag/libheif.git && \

Dockerfile.worker

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ WORKDIR /rails
1616

1717
# Install base packages
1818
RUN apt-get update -qq && \
19-
apt-get install --no-install-recommends -y curl libjemalloc2 libvips imagemagick libheif-dev postgresql-client libffi-dev && \
19+
apt-get install --no-install-recommends -y curl libjemalloc2 libvips imagemagick libheif-dev postgresql-client libffi-dev libxmlsec1-dev libxmlsec1 libxmlsec1-openssl && \
2020
apt-get clean && \
2121
rm -rf /var/lib/apt/lists/*
2222

Gemfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ group :development, :test do
3131

3232
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
3333
gem "rubocop-rails-omakase", require: false
34+
35+
# Testing framework
36+
gem "rspec-rails", "~> 7.1"
3437
end
3538

3639
group :development do
@@ -113,6 +116,7 @@ gem "ruby-vips", "~> 2.2"
113116
gem "slack-ruby-client", "~> 2.6"
114117

115118
gem "redcarpet", "~> 3.6"
119+
gem "front_matter_parser", "~> 1.0"
116120

117121
gem "flipper", "~> 1.3"
118122
gem "flipper-ui", "~> 1.3"
@@ -121,3 +125,20 @@ gem "flipper-active_record", "~> 1.3"
121125
gem "annotaterb", "~> 4.19"
122126

123127
gem "erb_lint", "~> 0.9.0", group: :development
128+
129+
gem "saml2", "~> 3.2"
130+
131+
gem "geocoder", "~> 1.8"
132+
133+
gem "rotp", "~> 6.3"
134+
gem "rqrcode", "~> 2.0"
135+
136+
gem "bcrypt", "~> 3.1"
137+
138+
gem "rack-attack", "~> 6.7"
139+
140+
gem "browser", "~> 6.0"
141+
142+
gem "slocks", "~> 0.1.0"
143+
144+
gem "factory_bot_rails", "~> 6.4"

Gemfile.lock

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ GEM
115115
aws-sigv4 (1.12.0)
116116
aws-eventstream (~> 1, >= 1.0.2)
117117
base64 (0.2.0)
118+
bcrypt (3.1.20)
118119
benchmark (0.4.0)
119120
better_html (2.1.1)
120121
actionview (>= 6.0)
@@ -133,9 +134,11 @@ GEM
133134
msgpack (~> 1.2)
134135
brakeman (7.1.0)
135136
racc
137+
browser (6.2.0)
136138
builder (3.3.0)
137139
childprocess (5.1.0)
138140
logger (~> 1.5)
141+
chunky_png (1.4.0)
139142
concurrent-ruby (1.3.5)
140143
connection_pool (2.5.3)
141144
console1984 (0.2.2)
@@ -146,10 +149,12 @@ GEM
146149
countries (7.1.1)
147150
unaccent (~> 0.3)
148151
crass (1.0.6)
152+
csv (3.3.5)
149153
date (3.4.1)
150154
debug (1.10.0)
151155
irb (~> 1.10)
152156
reline (>= 0.3.8)
157+
diff-lcs (1.6.2)
153158
domain_name (0.6.20240107)
154159
doorkeeper (5.8.2)
155160
railties (>= 5)
@@ -167,6 +172,11 @@ GEM
167172
erubi (1.13.1)
168173
et-orbi (1.2.11)
169174
tzinfo
175+
factory_bot (6.5.6)
176+
activesupport (>= 6.1.0)
177+
factory_bot_rails (6.5.1)
178+
factory_bot (~> 6.5)
179+
railties (>= 6.1.0)
170180
faraday (2.13.1)
171181
faraday-net_http (>= 2.0, < 3.5)
172182
json
@@ -202,9 +212,13 @@ GEM
202212
rack-protection (>= 1.5.3, < 5.0.0)
203213
rack-session (>= 1.0.2, < 3.0.0)
204214
sanitize (< 8)
215+
front_matter_parser (1.0.1)
205216
fugit (1.11.1)
206217
et-orbi (~> 1, >= 1.2.11)
207218
raabro (~> 1.4)
219+
geocoder (1.8.6)
220+
base64 (>= 0.1.0)
221+
csv (>= 3.0.0)
208222
gli (2.22.2)
209223
ostruct
210224
globalid (1.2.1)
@@ -325,6 +339,8 @@ GEM
325339
racc (~> 1.4)
326340
nokogiri (1.18.8-x86_64-linux-musl)
327341
racc (~> 1.4)
342+
nokogiri-xmlsec-instructure (0.12.0)
343+
nokogiri (~> 1.13)
328344
ostruct (0.6.1)
329345
paper_trail (16.0.0)
330346
activerecord (>= 6.1)
@@ -364,6 +380,8 @@ GEM
364380
raabro (1.4.0)
365381
racc (1.8.1)
366382
rack (3.1.15)
383+
rack-attack (6.7.0)
384+
rack (>= 1.0, < 4)
367385
rack-protection (4.1.1)
368386
base64 (>= 0.1.0)
369387
logger (>= 1.6.0)
@@ -423,7 +441,29 @@ GEM
423441
rack (>= 1.4)
424442
rexml (3.4.1)
425443
rinku (2.0.6)
444+
rotp (6.3.0)
426445
rouge (4.5.2)
446+
rqrcode (2.2.0)
447+
chunky_png (~> 1.0)
448+
rqrcode_core (~> 1.0)
449+
rqrcode_core (1.2.0)
450+
rspec-core (3.13.6)
451+
rspec-support (~> 3.13.0)
452+
rspec-expectations (3.13.5)
453+
diff-lcs (>= 1.2.0, < 2.0)
454+
rspec-support (~> 3.13.0)
455+
rspec-mocks (3.13.6)
456+
diff-lcs (>= 1.2.0, < 2.0)
457+
rspec-support (~> 3.13.0)
458+
rspec-rails (7.1.1)
459+
actionpack (>= 7.0)
460+
activesupport (>= 7.0)
461+
railties (>= 7.0)
462+
rspec-core (~> 3.13)
463+
rspec-expectations (~> 3.13)
464+
rspec-mocks (~> 3.13)
465+
rspec-support (~> 3.13)
466+
rspec-support (3.13.6)
427467
rubocop (1.75.7)
428468
json (~> 2.3)
429469
language_server-protocol (~> 3.17.0.2)
@@ -456,6 +496,10 @@ GEM
456496
ruby-vips (2.2.4)
457497
ffi (~> 1.12)
458498
logger
499+
saml2 (3.2.3)
500+
activesupport (>= 3.2, < 8.2)
501+
nokogiri (>= 1.5.8, < 2.0)
502+
nokogiri-xmlsec-instructure (~> 0.9, >= 0.9.5)
459503
sanitize (7.0.0)
460504
crass (~> 1.0.2)
461505
nokogiri (>= 1.16.8)
@@ -471,6 +515,9 @@ GEM
471515
gli
472516
hashie
473517
logger
518+
slocks (0.1.0)
519+
actionview (>= 6.0)
520+
activesupport (>= 6.0)
474521
smart_properties (1.17.0)
475522
stringio (3.1.7)
476523
superform (0.5.1)
@@ -539,19 +586,24 @@ DEPENDENCIES
539586
audits1984 (~> 0.1.7)
540587
awesome_print (~> 1.9)
541588
aws-sdk-s3 (~> 1.189)
589+
bcrypt (~> 3.1)
542590
blind_index (~> 2.7)
543591
bootsnap
544592
brakeman
593+
browser (~> 6.0)
545594
console1984 (~> 0.2.2)
546595
countries (~> 7.1)
547596
debug
548597
doorkeeper (~> 5.8)
549598
dotenv
550599
erb_lint (~> 0.9.0)
600+
factory_bot_rails (~> 6.4)
551601
faraday (~> 2.13)
552602
flipper (~> 1.3)
553603
flipper-active_record (~> 1.3)
554604
flipper-ui (~> 1.3)
605+
front_matter_parser (~> 1.0)
606+
geocoder (~> 1.8)
555607
good_job (~> 4.10)
556608
hashid-rails (~> 1.4)
557609
honeybadger (~> 5.28)
@@ -572,12 +624,18 @@ DEPENDENCIES
572624
public_activity (~> 3.0)
573625
puma (>= 5.0)
574626
pundit (~> 2.5)
627+
rack-attack (~> 6.7)
575628
rails (~> 8.0.2)
576629
rails_semantic_logger (~> 4.17)
577630
redcarpet (~> 3.6)
631+
rotp (~> 6.3)
632+
rqrcode (~> 2.0)
633+
rspec-rails (~> 7.1)
578634
rubocop-rails-omakase
579635
ruby-vips (~> 2.2)
636+
saml2 (~> 3.2)
580637
slack-ruby-client (~> 2.6)
638+
slocks (~> 0.1.0)
581639
superform (~> 0.5.1)
582640
thruster
583641
tzinfo-data

app/components/api_example.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class Components::APIExample < Components::Base
55
prop :path_only, _Boolean?
66

77
def view_template
8-
div style: { margin: "10px 0" } do
8+
# div style: { margin: "10px 0" } do
99
code style: { background: "black", padding: "0.2em", color: "white" } do
1010
span style: { color: "cyan" } do
1111
@method
@@ -19,6 +19,6 @@ def view_template
1919
end
2020
end
2121
end
22-
end
22+
# end
2323
end
2424
end

app/components/auth_welcome.rb

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
class Components::AuthWelcome < Components::Base
2+
include Phlex::Rails::Helpers::DistanceOfTimeInWordsToNow
3+
4+
def initialize(headline:, subtitle:, return_to: nil)
5+
@headline = headline
6+
@subtitle = subtitle
7+
@return_to = return_to
8+
end
9+
10+
def view_template
11+
div(class: "auth-container") do
12+
div(class: "auth-card") do
13+
render_header
14+
render_actions
15+
render_footer
16+
end
17+
end
18+
end
19+
20+
private
21+
22+
def render_header
23+
header do
24+
h1 { @headline }
25+
small { @subtitle }
26+
end
27+
end
28+
29+
def render_actions
30+
login_url = @return_to ? "/login?return_to=#{CGI.escape(@return_to)}" : "/login"
31+
32+
div(style: "margin: 3rem 0;") do
33+
form(
34+
action: login_url,
35+
method: "post"
36+
) do
37+
input(type: "hidden", name: "authenticity_token", value: helpers.form_authenticity_token)
38+
39+
div(style: "margin-bottom: 1rem;") do
40+
input(
41+
type: "email",
42+
name: "email",
43+
placeholder: t("identities.email_placeholder"),
44+
required: true,
45+
autocomplete: "email",
46+
style: "width: 100%;"
47+
)
48+
49+
small(style: "color: var(--muted-color); display: block; margin-top: 0.5rem;") do
50+
plain helpers.t("logins.welcome.email_help")
51+
end
52+
end
53+
54+
button(
55+
type: "submit",
56+
class: "primary",
57+
style: "width: 100%; margin-top: 1rem;"
58+
) do
59+
plain helpers.t("logins.welcome.continue")
60+
whitespace
61+
plain "→"
62+
end
63+
end
64+
end
65+
end
66+
67+
def render_footer
68+
footer(class: "welcome-footer") do
69+
p(class: "welcome-links") do
70+
a(href: "/docs/privacy") { "Privacy" }
71+
plain " • "
72+
a(href: "/docs/terms-of-service") { "Terms" }
73+
end
74+
75+
if Rails.application.config.try(:git_version).present?
76+
span(class: "welcome-version") do
77+
plain "Build "
78+
if Rails.application.config.try(:commit_link).present?
79+
a(href: Rails.application.config.commit_link, target: "_blank") do
80+
Rails.application.config.git_version
81+
end
82+
else
83+
plain Rails.application.config.git_version
84+
end
85+
if Rails.application.config.try(:server_start_time).present?
86+
plain " from #{distance_of_time_in_words_to_now(Rails.application.config.server_start_time)} ago"
87+
end
88+
end
89+
end
90+
end
91+
end
92+
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Components::AuthWelcomeTest < Components::Base
2+
def initialize(service_name: nil, return_to: nil)
3+
@service_name = service_name
4+
@return_to = return_to
5+
end
6+
7+
def view_template
8+
div(class: "auth-container") do
9+
h1 { "Test: #{@service_name}" }
10+
p { "Return to: #{@return_to}" }
11+
end
12+
end
13+
end

0 commit comments

Comments
 (0)