Skip to content

Commit

Permalink
Add example app for Sinatra sanitized routes
Browse files Browse the repository at this point in the history
Add test route to Sinatra app to test the sanitized routes / route
definition to be set as the `path` metadata to avoid storing PII and
other sensitive data.

Related PR appsignal/appsignal-ruby#972
  • Loading branch information
tombruijn committed Jun 28, 2023
1 parent 794fffa commit 54c208a
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 0 deletions.
111 changes: 111 additions & 0 deletions ruby/sinatra/app/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
PATH
remote: /integration
specs:
appsignal (3.4.4)
rack

GEM
remote: https://rubygems.org/
specs:
actionmailer (5.2.0)
actionpack (= 5.2.0)
actionview (= 5.2.0)
activejob (= 5.2.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.0)
actionview (= 5.2.0)
activesupport (= 5.2.0)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.0)
activesupport (= 5.2.0)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.0)
activesupport (= 5.2.0)
globalid (>= 0.3.6)
activesupport (5.2.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
builder (3.2.4)
coderay (1.1.3)
concurrent-ruby (1.2.2)
crass (1.0.6)
date (3.3.3)
erubi (1.12.0)
globalid (1.1.0)
activesupport (>= 5.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
loofah (2.21.3)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
method_source (1.0.0)
mini_mime (1.1.2)
minitest (5.18.1)
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
net-imap (0.3.6)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.1)
timeout
net-smtp (0.3.3)
net-protocol
nokogiri (1.15.2-aarch64-linux)
racc (~> 1.4)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
racc (1.7.1)
rack (2.2.7)
rack-protection (3.0.6)
rack
rack-test (2.1.0)
rack (>= 1.3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
ruby2_keywords (0.0.5)
sinatra (3.0.6)
mustermann (~> 3.0)
rack (~> 2.2, >= 2.2.4)
rack-protection (= 3.0.6)
tilt (~> 2.0)
thread_safe (0.3.6)
tilt (2.2.0)
timeout (0.4.0)
tzinfo (1.2.11)
thread_safe (~> 0.1)
webrick (1.8.1)

PLATFORMS
aarch64-linux

DEPENDENCIES
actionmailer (= 5.2.0)
activesupport (= 5.2.0)
appsignal!
pry
sinatra
webrick

BUNDLED WITH
2.2.33
5 changes: 5 additions & 0 deletions ruby/sinatra/app/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<ul>
<li><a href="/slow?time=#{time}">Slow request</a></li>
<li><a href="/error?time=#{time}">Error request</a></li>
<li><a href="/item/123?time=#{time}">Route with param request</a></li>
</ul>
HTML
end
Expand All @@ -26,3 +27,7 @@
Appsignal.add_breadcrumb("category", "action", "message", { "metadata_key" => "some value" })
raise "error"
end

get "/item/:id" do
"Item with id #{params[:id]}"
end
1 change: 1 addition & 0 deletions ruby/sinatra/app/config/appsignal.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
default: &defaults
sinatra_sanitized_routes: true

test:
<<: *defaults
Expand Down

0 comments on commit 54c208a

Please sign in to comment.