-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes and improvements for admin permissions.
- Allows limited admins to create sub-scopes underneath their current scopes (18F/api.data.gov#135). - Allows limited admins to create new groups utilizing the scopes they have access to (18F/api.data.gov#339). - Fixes potential security issues where a limited admin with knowledge of internal record UUIDs could overwrite records they didn't originally have access to (by overwriting the original record with data they do have access to). Since this hinges upon the limited admin knowing the random UUIDs of other records they don't have access to view, the likelihood of this actually being exploitable should be low. - Refactor most of the admin permission tests to ensure better consistency and coverage. There's now a shared baseline of permission checks we can more easily apply across all admin resource types to ensure basic permission checks. We also now perform the same permission check tests across all CRUD actions (rather than requiring different tests to be written for each CRUD action, which was easy to miss and difficult to maintain).
- Loading branch information
Showing
30 changed files
with
2,142 additions
and
1,345 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/api-umbrella/web-app/app/helpers/application_helper.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,18 @@ | ||
module ApplicationHelper | ||
def web_admin_ajax_api_user | ||
user = ApiUser.where(:email => "[email protected]").order_by(:created_at.asc).first | ||
unless(user) | ||
user = ApiUser.create!({ | ||
:email => "[email protected]", | ||
:first_name => "API Umbrella Admin", | ||
:last_name => "Key", | ||
:use_description => "An API key for the API Umbrella admin to use for internal ajax requests.", | ||
:terms_and_conditions => "1", | ||
:registration_source => "seed", | ||
:settings_attributes => { :rate_limit_mode => "unlimited" }, | ||
}, :without_protection => true) | ||
end | ||
|
||
user | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
<title>API Umbrella Admin</title> | ||
<%= stylesheet_link_tag "admin" %> | ||
<%= javascript_tag do %> | ||
webAdminAjaxApiKey = <%= ApiUser.where(:email => '[email protected]').order_by(:created_at.asc).first.api_key.to_json.html_safe %>; | ||
webAdminAjaxApiKey = <%= web_admin_ajax_api_user.api_key.to_json.html_safe %>; | ||
currentAdmin = <%= current_admin.attributes.slice("username", "superuser").to_json.html_safe %> | ||
<% end %> | ||
<link href='//fonts.googleapis.com/css?family=Oswald:400,700' rel='stylesheet' type='text/css'> | ||
|
@@ -47,9 +47,7 @@ | |
<li><%= link_to(%(<i class="fa fa-user"></i> #{t("admin.nav.admin_accounts")}).html_safe, '/admin/#/admins') %></li> | ||
<li class="divider"></li> | ||
<li role="presentation" class="dropdown-header"><%= t("admin.nav.permissions_management") %></li> | ||
<% if(current_admin.superuser?) %> | ||
<li><%= link_to(%(<i class="fa fa-lock"></i> #{t("admin.nav.api_scopes")}).html_safe, '/admin/#/api_scopes') %></li> | ||
<% end %> | ||
<li><%= link_to(%(<i class="fa fa-lock"></i> #{t("admin.nav.api_scopes")}).html_safe, '/admin/#/api_scopes') %></li> | ||
<li><%= link_to(%(<i class="fa fa-group"></i> #{t("admin.nav.admin_groups")}).html_safe, '/admin/#/admin_groups') %></li> | ||
<% end %> | ||
</ul> | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.