Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanitize organization name #20393

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/views/admin/listings/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<%= form_tag(admin_listings_path, method: "get", role: "search", class: "crayons-card crayons-card--secondary p-4 flex items-center") do %>
<div class="mr-4">
<%= label_tag(:search, "Keyword", class: "mb-0") %>
<%= text_field_tag(:search, params[:search]) %>
<%= text_field_tag(:search, params[:search], autocomplete: "off") %>
<% if params[:state].present? %>
<%= hidden_field_tag(:state, params[:state]) %>
<% end %>
Expand Down Expand Up @@ -52,7 +52,7 @@
<tr>
<td><%= link_to listing.title, edit_admin_listing_path(listing.id), rel: "noopener" %></td>
<td><%= link_to listing.user.username, admin_user_path(listing.user.id) %></td>
<td><%= link_to listing.organization.name, admin_organization_path(listing.organization_id) if listing.organization_id.present? %></td>
<td><%= link_to sanitize(listing.organization.name), admin_organization_path(listing.organization_id) if listing.organization_id.present? %></td>
<td><%= listing.category %></td>
<td><%= listing.cached_tag_list %></td>
<td><%= listing.published ? "Yes" : "No" %></td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/organizations/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<tbody class="crayons-card">
<% @organizations.each do |organization| %>
<tr>
<td><%= link_to "@#{organization.name}", admin_organization_path(organization.id) %></td>
<td><%= link_to sanitize("@#{organization.name}"), admin_organization_path(organization.id) %></td>
<td class="whitespace-nowrap"><%= organization.id %></td>
<% if organization.twitter_username %>
<td><%= link_to organization.twitter_username, "https://twitter.com/#{organization.twitter_username}" %></td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/organizations/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="s:flex items-center gap-5">
<div class="flex flex-1 items-center">
<h1 class="crayons-title lh-tight">
<%= @organization.name %>
<%= sanitize(@organization.name) %>
</h1>
</div>
<div class="flex relative justify-between s:justify-end gap-2 my-2 s:my-0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</a>
<h3 class="crayons-subtitle-2">
<a href="<%= org_membership.organization.path %>" target="_blank" rel="noopener" class="c-link">
<%= org_membership.organization.name %>
<%= sanitize(org_membership.organization.name) %>
</a>
<span class="opacity-50">&bull;</span> <%= t("views.admin.users.overview.orgs.type.#{org_membership.type_of_user}") %></span>
</h3>
Expand Down
2 changes: 1 addition & 1 deletion app/views/dashboards/following_organizations.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<div class="pl-4 s:pl-0 self-center">
<h3 class="s:mb-1 p-0">
<a href="<%= organization.path %>">
<%= organization.name %>
<%= sanitize(organization.name) %>
</a>
</h3>

Expand Down
2 changes: 1 addition & 1 deletion app/views/organizations/_liquid.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</a>
<div class="ltag__user__content">
<h2>
<a href="/<%= organization.slug %>" class="ltag__user__link"><%= organization.name %></a>
<a href="/<%= organization.slug %>" class="ltag__user__link"><%= sanitize(organization.name) %></a>
<%= follow_button(organization, "full", "c-btn--secondary fs-base") %>
</h2>
<div class="ltag__user__summary">
Expand Down
4 changes: 2 additions & 2 deletions app/views/organizations/members.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% title @organization.name %>
<% title sanitize(@organization.name) %>
<div class="blank-space"></div>
<main class="org-member-page crayons-layout px-4 m:px-9 gap-0">
<h1 class="crayons-title"><%= @organization.name %> (<%= @members.count %>)</h1>
<h1 class="crayons-title"><%= sanitize(@organization.name) %> (<%= @members.count %>)</h1>
<div class="mt-4 l:mt-7 grid gap-4 grid-cols-1 s:grid-cols-1 m:grid-cols-2 l:grid-cols-3 xl:grid-cols-4 mb-6">
<% @members.each_with_index do |member, index| %>
<div class="crayons-card member-item">
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_billboard_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<% else %>
<a href="<%= billboard.organization.path %>" target="_blank" rel="noopener" class="flex">
<img width="24" height="24" class="radius-default crayons-sponsorship__image" src="<%= billboard.organization.profile_image_url_for(length: 64) %>" alt="profile" loading="lazy" />
<div class="crayons-sponsorship__title ml-2 fs-s fw-medium"><%= billboard.organization.name %></div>
<div class="crayons-sponsorship__title ml-2 fs-s fw-medium"><%= sanitize(billboard.organization.name) %></div>
</a>
<% end %>
<% if billboard.type_of == "external" %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/_org_member.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div>
<h2><%= @organization.name %></h2>
<h2><%= sanitize(@organization.name) %></h2>
<div class="grid gap-2">
<% @organization.users.each do |user| %>
<div class="crayons-card crayons-card--secondary p-4">
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/_sidebar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<span class="crayons-logo crayons-logo--l mr-2 shrink-0">
<img src="<%= organization.profile_image_url_for(length: 90) %>" alt="<%= organization.name %> profile image" class="crayons-logo__image" loading="lazy" />
</span>
<h4 class="fs-base fw-medium"><%= organization.name %></h4>
<h4 class="fs-base fw-medium"><%= sanitize(organization.name) %></h4>
</a>
<% end %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<div class="profile-header__details" data-url="<%= user_path(@user, format: "json") %>">
<div class="items-center js-username-container mb-2">
<h1 class="crayons-title lh-tight">
<%= @user.name %>
<%= sanitize @user.name %>
</h1>
</div>

Expand Down