[ARVADOS] updated: 079d6e0e42bfde5f21bd00e963c3a180d2950f5b

git at public.curoverse.com git at public.curoverse.com
Thu Jul 31 10:03:38 EDT 2014


Summary of changes:
 apps/workbench/Gemfile                                 |  1 +
 apps/workbench/Gemfile.lock                            |  2 ++
 apps/workbench/app/controllers/users_controller.rb     |  4 ++--
 apps/workbench/app/helpers/application_helper.rb       |  1 +
 apps/workbench/app/views/application/_choose.html.erb  |  2 +-
 .../workbench/app/views/users/_manage_account.html.erb |  2 +-
 .../app/views/users/_manage_current_token.html.erb     | 11 ++++++++---
 .../app/views/users/_manage_ssh_keys.html.erb          | 18 +++++++++---------
 doc/api/schema/PipelineTemplate.html.textile.liquid    |  6 +++++-
 services/api/Gemfile                                   |  1 +
 services/api/Gemfile.lock                              |  2 ++
 services/api/app/models/authorized_key.rb              |  9 +++++----
 12 files changed, 38 insertions(+), 21 deletions(-)

       via  079d6e0e42bfde5f21bd00e963c3a180d2950f5b (commit)
       via  b2b6b598deb6d09a0de1560fcf4b36ab8c66a369 (commit)
       via  20e4662b703bf305428e223edb98c47d464ccf51 (commit)
       via  033c9aee7dceec10418f6b220358f45002bef770 (commit)
       via  698f00b7f1c760f504963b42720c7fa2cbc66e48 (commit)
       via  c28309c9482d47c99d26718fab7b1d866e035142 (commit)
       via  eb3c52158a603946b7680ae5f3f0848c7246eb9c (commit)
       via  f63a84da333cbcf898fabd41667051f09fae1117 (commit)
       via  9cff2190456b02ec1970759f8b82a98e7a17778e (commit)
      from  4ec57503920f7cd47a48cb0d0cf089517b8d2dd3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 079d6e0e42bfde5f21bd00e963c3a180d2950f5b
Merge: b2b6b59 033c9ae
Author: radhika <radhika at curoverse.com>
Date:   Thu Jul 31 09:46:46 2014 -0400

    Merge branch 'master' into 3193-manage-account


commit b2b6b598deb6d09a0de1560fcf4b36ab8c66a369
Author: radhika <radhika at curoverse.com>
Date:   Thu Jul 31 09:45:07 2014 -0400

    3193: use sshkey gem to validate the ssh key passed in.

diff --git a/apps/workbench/Gemfile b/apps/workbench/Gemfile
index f428bc2..a289303 100644
--- a/apps/workbench/Gemfile
+++ b/apps/workbench/Gemfile
@@ -50,6 +50,7 @@ gem 'bootstrap-x-editable-rails'
 gem 'less'
 gem 'less-rails'
 gem 'wiselinks'
+gem 'sshkey'
 
 # To use ActiveModel has_secure_password
 # gem 'bcrypt-ruby', '~> 3.0.0'
diff --git a/apps/workbench/Gemfile.lock b/apps/workbench/Gemfile.lock
index 3c30bc3..3daa501 100644
--- a/apps/workbench/Gemfile.lock
+++ b/apps/workbench/Gemfile.lock
@@ -167,6 +167,7 @@ GEM
       activesupport (>= 3.0)
       sprockets (~> 2.8)
     sqlite3 (1.3.8)
+    sshkey (1.6.1)
     therubyracer (0.12.0)
       libv8 (~> 3.16.14.0)
       ref
@@ -217,6 +218,7 @@ DEPENDENCIES
   simplecov (~> 0.7.1)
   simplecov-rcov
   sqlite3
+  sshkey
   themes_for_rails!
   therubyracer
   uglifier (>= 1.0.3)
diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index 3bcb956..67b51a9 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -257,10 +257,10 @@ class UsersController < ApplicationController
       key_params['authorized_user_uuid'] = current_user.uuid
 
       if params['name'] && params['name'].size>0
-        key_params['name'] = params['name']
+        key_params['name'] = params['name'].strip
       end
       if params['public_key'] && params['public_key'].size>0
-        key_params['public_key'] = params['public_key']
+        key_params['public_key'] = params['public_key'].strip
       end
 
       if !key_params['name'] && params['public_key'].andand.size>0
diff --git a/apps/workbench/app/views/users/_manage_account.html.erb b/apps/workbench/app/views/users/_manage_account.html.erb
index f247a3d..5024fce 100644
--- a/apps/workbench/app/views/users/_manage_account.html.erb
+++ b/apps/workbench/app/views/users/_manage_account.html.erb
@@ -29,7 +29,7 @@
         <div class="panel-heading">
           <% if section_id == 'ssh_keys' %>
             <div class="pull-right">
-              <%= link_to raw('<i class="fa fa-plus"></i>' "Add new SSH key"), add_ssh_key_popup_url,
+              <%= link_to raw('<i class="fa fa-plus"></i>' " Add new SSH key"), add_ssh_key_popup_url,
                            {class: 'btn btn-xs btn-primary', :remote => true, 'data-toggle' =>  "modal",
                             'data-target' => '#add-ssh-key-modal-window'}  %>
             </div>
diff --git a/apps/workbench/app/views/users/_manage_current_token.html.erb b/apps/workbench/app/views/users/_manage_current_token.html.erb
index 2461410..583ac48 100644
--- a/apps/workbench/app/views/users/_manage_current_token.html.erb
+++ b/apps/workbench/app/views/users/_manage_current_token.html.erb
@@ -1,9 +1,14 @@
+<p>The Arvados API token is a secret key that enables the Arvados SDKs to access Arvados with the proper permissions. For more information see <%= link_to raw('Getting an API token'), "#{Rails.configuration.arvados_docsite}/user/reference/api-tokens.html", target: "_blank"%>.</p>
 <p>Paste the following lines at a shell prompt to set up the necessary environment for Arvados SDKs to authenticate to your account, <b><%= current_user.email %></b></p>
 
-<pre>export ARVADOS_API_TOKEN=<%= Thread.current[:arvados_api_token] %>
-export ARVADOS_API_HOST=<%= current_api_host %>
+<pre>
+read ARVADOS_API_TOKEN <<EOF
+<%= Thread.current[:arvados_api_token] %>
+EOF
+export ARVADOS_API_TOKEN ARVADOS_API_HOST=<%= current_api_host %>
 <% if Rails.configuration.arvados_insecure_https %>
 export ARVADOS_API_HOST_INSECURE=true
 <% else %>
 unset ARVADOS_API_HOST_INSECURE
-<% end %></pre>
+<% end %>
+</pre>
diff --git a/apps/workbench/app/views/users/_manage_ssh_keys.html.erb b/apps/workbench/app/views/users/_manage_ssh_keys.html.erb
index 580b5d8..e559356 100644
--- a/apps/workbench/app/views/users/_manage_ssh_keys.html.erb
+++ b/apps/workbench/app/views/users/_manage_ssh_keys.html.erb
@@ -9,7 +9,7 @@
   <% end %>
 
   <% if @my_ssh_keys.andand.any? %>
-    <table class="table manage-ssh-keys-table" style="table-layout:fixed; overflow:hidden; white-space: nowrap;">
+    <table class="table manage-ssh-keys-table">
       <colgroup>
         <col style="width: 45%" />
         <col style="width: 45%" />
@@ -18,20 +18,20 @@
       <thead>
         <tr>
           <th> Name </th>
-          <th> Public Key </th>
+          <th> Key Finger Print </th>
           <th> </th>
         </tr>
       </thead>
       <tbody>
         <% @my_ssh_keys.andand.each do |key| %>
-          <tr>
-            <td style="width:50px; overflow:hidden;">
+          <tr style="word-break:break-all;">
+            <td>
               <%= key[:name] %>
             </td>
-            <td>
+            <td style="word-break:break-all;">
               <% if key[:public_key] && key[:public_key].size > 0 %>
                 <div>
-                  <pre style="margin:0; overflow-y:scroll; max-height:7em"><%= key[:public_key] %></pre>
+                  <%= SSHKey.fingerprint key[:public_key] %>
                 </div>
               <% else %>
                   <%= key[:public_key] %>
diff --git a/services/api/Gemfile b/services/api/Gemfile
index 7219fe4..fa2ce5a 100644
--- a/services/api/Gemfile
+++ b/services/api/Gemfile
@@ -76,3 +76,4 @@ gem 'arvados-cli', '>= 0.1.20140708213257'
 gem 'pg_power'
 
 gem 'puma'
+gem 'sshkey'
diff --git a/services/api/Gemfile.lock b/services/api/Gemfile.lock
index d704eca..8fb6a52 100644
--- a/services/api/Gemfile.lock
+++ b/services/api/Gemfile.lock
@@ -192,6 +192,7 @@ GEM
       multi_json (~> 1.0)
       rack (~> 1.0)
       tilt (~> 1.1, != 1.3.0)
+    sshkey (1.6.1)
     test_after_commit (0.2.3)
     themes_for_rails (0.5.1)
       rails (>= 3.0.0)
@@ -236,6 +237,7 @@ DEPENDENCIES
   sass-rails (>= 3.2.0)
   simplecov (~> 0.7.1)
   simplecov-rcov
+  sshkey
   test_after_commit
   themes_for_rails
   therubyracer
diff --git a/services/api/app/models/authorized_key.rb b/services/api/app/models/authorized_key.rb
index 5856e0c..b156a1d 100644
--- a/services/api/app/models/authorized_key.rb
+++ b/services/api/app/models/authorized_key.rb
@@ -33,13 +33,14 @@ class AuthorizedKey < ArvadosModel
 
   def public_key_must_be_unique
     if self.public_key
-      key = /^ssh-(rsa|dss) [A-Za-z0-9+\/=\+]+\b/.match(self.public_key)
-      
-      if not key
+      #key = /^ssh-(rsa|dss) [A-Za-z0-9+\/=\+]+\b/.match(self.public_key)
+      valid_key = SSHKey.valid_ssh_public_key? self.public_key
+
+      if not valid_key
         errors.add(:public_key, "does not appear to be a valid ssh-rsa or dsa public key")
       else
         # Valid if no other rows have this public key
-        if self.class.where('public_key like ?', "%#{key[0]}%").any?
+        if self.class.where('public_key like ?', "%#{self.public_key}%").any?
           errors.add(:public_key, "already exists in the database, use a different key.")
           return false
         end

commit 20e4662b703bf305428e223edb98c47d464ccf51
Author: radhika <radhika at curoverse.com>
Date:   Thu Jul 31 05:21:30 2014 -0400

    3193: add plus icon to add ssh key button

diff --git a/apps/workbench/app/views/users/_manage_account.html.erb b/apps/workbench/app/views/users/_manage_account.html.erb
index 309d982..f247a3d 100644
--- a/apps/workbench/app/views/users/_manage_account.html.erb
+++ b/apps/workbench/app/views/users/_manage_account.html.erb
@@ -29,7 +29,7 @@
         <div class="panel-heading">
           <% if section_id == 'ssh_keys' %>
             <div class="pull-right">
-              <%= link_to "Add new SSH key", add_ssh_key_popup_url,
+              <%= link_to raw('<i class="fa fa-plus"></i>' "Add new SSH key"), add_ssh_key_popup_url,
                            {class: 'btn btn-xs btn-primary', :remote => true, 'data-toggle' =>  "modal",
                             'data-target' => '#add-ssh-key-modal-window'}  %>
             </div>
diff --git a/apps/workbench/app/views/users/_manage_ssh_keys.html.erb b/apps/workbench/app/views/users/_manage_ssh_keys.html.erb
index 3612d1d..580b5d8 100644
--- a/apps/workbench/app/views/users/_manage_ssh_keys.html.erb
+++ b/apps/workbench/app/views/users/_manage_ssh_keys.html.erb
@@ -11,9 +11,9 @@
   <% if @my_ssh_keys.andand.any? %>
     <table class="table manage-ssh-keys-table" style="table-layout:fixed; overflow:hidden; white-space: nowrap;">
       <colgroup>
-        <col style="width: 40%" />
-        <col style="width: 55%" />
-        <col style="width: 5%" />
+        <col style="width: 45%" />
+        <col style="width: 45%" />
+        <col style="width: 10%" />
       </colgroup>
       <thead>
         <tr>
@@ -31,7 +31,7 @@
             <td>
               <% if key[:public_key] && key[:public_key].size > 0 %>
                 <div>
-                  <pre style="margin:0; overflow-x:scroll"> <%= key[:public_key] %> </pre>
+                  <pre style="margin:0; overflow-y:scroll; max-height:7em"><%= key[:public_key] %></pre>
                 </div>
               <% else %>
                   <%= key[:public_key] %>

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list