<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Jamie Lawrence</title>
    <description>The latest articles on Forem by Jamie Lawrence (@ideasasylum).</description>
    <link>https://forem.com/ideasasylum</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F124911%2F0cdf168d-819e-463f-96e7-c1108cec6843.jpg</url>
      <title>Forem: Jamie Lawrence</title>
      <link>https://forem.com/ideasasylum</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ideasasylum"/>
    <language>en</language>
    <item>
      <title>Use these “unfair advantages” when applying for a job</title>
      <dc:creator>Jamie Lawrence</dc:creator>
      <pubDate>Sat, 11 Apr 2020 22:52:55 +0000</pubDate>
      <link>https://forem.com/ideasasylum/use-these-unfair-advantages-when-applying-for-a-job-1n2d</link>
      <guid>https://forem.com/ideasasylum/use-these-unfair-advantages-when-applying-for-a-job-1n2d</guid>
      <description>&lt;p&gt;Sometimes you might be lucky enough to be in such high demand that you don’t need any unfair advantages when applying for a job—but even if you’re well qualified, it’s worth making sure you do all you can to get the job you want.&lt;/p&gt;

&lt;p&gt;This is especially true for remote jobs which regularly get hundred or thousands of applicants. You’ll need to do something to stand out from the crowds of people applying minimal effort to their job hunt.&lt;/p&gt;

&lt;p&gt;Here’s a few “unfair” advantages you can give yourself that I’ve seen work…&lt;/p&gt;

&lt;p&gt;&lt;em&gt;To be clear, it’s entirely possible to get a job without employing any of these ideas but you should be aware that other candidates will use them to their advantage.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Make a personal connection
&lt;/h2&gt;

&lt;p&gt;I know, I know, not the “Old boys club” again you’re thinking. Well, not quite. All I mean is that you should, if possible in your application, make known any connection you’ve had with anyone in the company.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“Oh, yes, I met Jason last year at RailsConf” &lt;/li&gt;
&lt;li&gt;“I used to work with Andrew”&lt;/li&gt;
&lt;li&gt;“I saw the job on Twitter when Jamie posted it”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And, if possible, elaborate on that in a positive way.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“And he seemed really smart”&lt;/li&gt;
&lt;li&gt;“And he said how much he is enjoying working at Podia“&lt;/li&gt;
&lt;li&gt;“And I really liked what he said about React”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I was even offering calls to anyone that wanted to find out more about the job/company and I they gave me a great initial connection with some of the eventual candidates.&lt;/p&gt;

&lt;p&gt;Anything like that helps me understand that you know something about the company, something about the people, and something about who we are. And after knowing that, you still want to work with us!&lt;/p&gt;

&lt;h2&gt;
  
  
  Use the product
&lt;/h2&gt;

&lt;p&gt;It such a trivial thing but if you can demonstrate that you’ve looked at the product website or, even better, tried it out then it shows a level of interest that’s extremely uncommon. When we get down to making a choice among the last few candidates, you can bet we check the user database to see who has played with the product 😉&lt;/p&gt;

&lt;h2&gt;
  
  
  Make a video
&lt;/h2&gt;

&lt;p&gt;This is a bit of stretch for most of us but a quick intro video or screencast gives you a huge advantage. It creates that personal connection, letting me hear your voice and thinking and personality which most candidates don’t get to show off until the interview.&lt;/p&gt;

&lt;p&gt;One of the most common ways candidates have done this is a screencast to walkthrough some improvement they’ve recognised in the product. It needs to be done subtly and with some humbleness (you never know why it hasn’t already been done) but it’s a great way to demonstrate your thinking.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making a job-specific landing page
&lt;/h2&gt;

&lt;p&gt;Along the same lines, creating a job-specific landing page with a personal blurb, link to your CV etc is a good way to demonstrate that you’re serious about the job. Just don’t make it too easy to see the other 12 landing pages you’ve created for other companies 😬 (yes, it’s happened)&lt;/p&gt;

&lt;h2&gt;
  
  
  Show your personality
&lt;/h2&gt;

&lt;p&gt;Are you funny? Are you quirky? Do you have an odd hobby? Been a katana-wielding stunt double? Do you have an obsession with raccoons? Been binging on the Tiger King? Have a favourite GIF collection?&lt;/p&gt;

&lt;p&gt;At the slightest opportunity you express yourself! Give the reviewer a chance to say “yeah, I really like this candidate”. In a sea of applications from competent, qualified people, the reviewers will look for anything to distinguish people and your love of cats might just do it.&lt;/p&gt;

&lt;p&gt;Don’t be afraid to express who you are. A sterile business-like tone is a losing strategy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Answer the questions asked
&lt;/h2&gt;

&lt;p&gt;This is seemingly trivial but actually answering the questions that are asked in the application form probably puts you in the top 50% of applicants. Read the question, then spend as long as needed to answer it. Don’t rush, invest the time a new job deserves, and give the best answer you can.&lt;/p&gt;

&lt;p&gt;If there’s an open text area, write more. Always write more. The more you write, the more material you’re giving the reviewer to like you and move onto the next stage. You need to distinguish yourself from the hordes of people that are just applying for every job they see.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Photo by &lt;a href="https://unsplash.com/@bruno_nascimento?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Bruno Nascimento&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/step?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Implementing Impersonation</title>
      <dc:creator>Jamie Lawrence</dc:creator>
      <pubDate>Sat, 29 Sep 2018 14:11:00 +0000</pubDate>
      <link>https://forem.com/ideasasylum/implementing-impersonation-10g0</link>
      <guid>https://forem.com/ideasasylum/implementing-impersonation-10g0</guid>
      <description>&lt;p&gt;The ability to log in as one of your users is one of the highest value features you can develop to support your customers.&lt;/p&gt;

&lt;p&gt;The ability to log in as one of your users is one of the most &lt;em&gt;dangerous&lt;/em&gt; features you can develop to support your customers.&lt;/p&gt;

&lt;p&gt;With that pithy introduction out of the way…&lt;/p&gt;

&lt;p&gt;No, actually, let’s back up a minute because I’m not sure that you’ve fully appreciated what you’re about to do: &lt;strong&gt;you are creating a security hole in your app&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If your app is Helm’s Deep, then impersonating users is like adding a small unguarded culvert that bypasses the main fortifications. You should expect Orks… and add the appropriate defences.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Fv4omErx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://jamie.ideasasylum.com/images/helmsdeep.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Fv4omErx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://jamie.ideasasylum.com/images/helmsdeep.gif" alt="Helmsdeep"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Still not afraid? Oh, maybe you’ve heard of Facebook? Yeah, this feature you’re about to blithely implement &lt;a href="https://www.theregister.co.uk/2018/09/28/facebook_accounts_hacked_bug/"&gt;resulted in 90 million compromised accounts&lt;/a&gt; yesterday.&lt;/p&gt;

&lt;p&gt;So, are you afraid &lt;em&gt;now&lt;/em&gt;? Good. You may continue.&lt;/p&gt;




&lt;p&gt;There’s a lot of things to consider when implementing a feature like this and the technical details are possibly the least interesting. They also vary considerably between apps, frameworks, and languages.&lt;/p&gt;

&lt;p&gt;Technically, logging in as another user is probably as simple as &lt;code&gt;session[:current_user] = user.id&lt;/code&gt; or something similar. Whatever. You probably know how this works.&lt;/p&gt;

&lt;p&gt;Logging in as another user is not the hard part.&lt;/p&gt;

&lt;p&gt;Here’s some more important things to consider:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Do users need to give explicit permission for support staff to impersonate them?&lt;/li&gt;
&lt;li&gt;Who is authorised to impersonate users?&lt;/li&gt;
&lt;li&gt;How have you authenticated the support staff?&lt;/li&gt;
&lt;li&gt;How long does the impersonation last?&lt;/li&gt;
&lt;li&gt;How does the impersonator know they impersonating another user?&lt;/li&gt;
&lt;li&gt;What unintentional effects do you need to avoid?&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Getting permission
&lt;/h2&gt;

&lt;p&gt;This might not be required in every application but if you’re dealing with sensitive or financial data you might need to ask the user’s permission before viewing their account. I’ve seen this implemented by FreeAgent as a special code visible in the user’s settings which must be provided directly to the support staff&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DJdUjSml--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://jamie.ideasasylum.com/images/freeagent-support-access.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DJdUjSml--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://jamie.ideasasylum.com/images/freeagent-support-access.png" alt="FreeAgent support access code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The user can also opt-in/opt-out off allowing support staff to access their account.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who can impersonate users?
&lt;/h2&gt;

&lt;p&gt;This is really an internal company process but you should be clear about who can and cannot impersonate a user, under what circumstances, and for what purposes. You probably want your support staff to impersonate users so they can fix/debug an ongoing issue. You probably don’t want your sales people impersonating users out of idle curiosity.&lt;/p&gt;

&lt;p&gt;One feature I’ve previously built is some form of accountability. You might build an audit log in the database recording each time a member of the support staff impersonated a user. Personally, I think audit logs are great for analysing abuse &lt;em&gt;after&lt;/em&gt; it’s occurred but do little to act as a deterrent. Instead, I think good behaviour can be enforce by announcing the impersonation publicly — posting to a Slack channel each time some one is impersonated is a simple method of ensuring accountability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Authentication
&lt;/h2&gt;

&lt;p&gt;Now that your admin accounts are a backdoor to every user account, it’s time to take another look at their security.&lt;/p&gt;

&lt;p&gt;First, I think it’s important to have separate &lt;code&gt;Admin&lt;/code&gt; and &lt;code&gt;User&lt;/code&gt; models as the simplest way to avoid privilege escalation attacks&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6smXkhbi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://jamie.ideasasylum.com/images/you-can-t-escalate-privilege.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6smXkhbi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://jamie.ideasasylum.com/images/you-can-t-escalate-privilege.jpg" alt="You can't escalate a privilege if there's nothing to escalate"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we should ensure that it really is an admin impersonating the user. But don’t we just check that they’re logged-in as an admin?&lt;/p&gt;

&lt;p&gt;Ha! Er… no. What happens if your support staff laptop is stolen? Or they’ve reused a password? You need another means of verifying it’s really an admin user. A sort of second password…a two-factor authentication if you will. 2FA. Top tip: just use &lt;a href="https://www.twilio.com/authy"&gt;https://www.twilio.com/authy&lt;/a&gt; to generate and confirm a confirmation code. It’s dead simple and will take a few hours at most.&lt;/p&gt;

&lt;p&gt;This ensures that the logged-in admin account is being operated by the member of staff you think it is.&lt;/p&gt;

&lt;h2&gt;
  
  
  How long does the impersonation last?
&lt;/h2&gt;

&lt;p&gt;A fairly common problem occurs when you impersonate a user on Friday, and then on Monday you open the app and forget you’re logged into that user’s account. Hopefully you realise in time before you do anything too… permanent like send a newsletter out with the wrong account.&lt;/p&gt;

&lt;p&gt;A simple solution is to expire the impersonation much quicker than normal session cookies. If your user sessions normally last 30 days, I’d reduce the session timeout for impersonations to something like 1 hour.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does the admin know they impersonating another user?
&lt;/h2&gt;

&lt;p&gt;Even if you limit the duration, you’ll still want to display some indication that they’re impersonating another user.&lt;/p&gt;

&lt;p&gt;In one app, I added a large/prominent ghost 👻 fixed in the left-hand corner which would end the session when clicked. It was a fun but important feature. A banner at the top works just as well&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AJi6XzSU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://jamie.ideasasylum.com/images/podia-impersonation.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AJi6XzSU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://jamie.ideasasylum.com/images/podia-impersonation.png" alt="Impersonating a user in Podia"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What unintentional effects do you need to avoid?
&lt;/h2&gt;

&lt;p&gt;It’s only after you’ve built an impersonation feature that you discover all the unintended side-effects. Try to shortcut this process by considering where else you send your user information.&lt;/p&gt;

&lt;p&gt;Some of my hard-won lessons include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;turn off Intercom when impersonating a user! Otherwise, you’ll send a message and end up it reading it yourself in the impersonated session… and the user will never get a notification! &lt;/li&gt;
&lt;li&gt;disable all analytics or you’ll develop a very suspicious hotspot of user activity around your support staff’s location!&lt;/li&gt;
&lt;li&gt;if possible, disable user notifications/emails when an account is being impersonated — or remind staff that impersonating a user will still generate emails, notifications, and dashboard events.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Multi-tenant applications
&lt;/h2&gt;

&lt;p&gt;It’s slightly more complex to impersonate users when they’re on different subdomains or custom domains. The basic process isn’t too arduous though:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Generate a secure token attached to the target user’s account&lt;/li&gt;
&lt;li&gt;Redirect the admin user to a special endpoint at the correct domain with the token as a parameter (&lt;a href="https://mycustomdomain.com/users/impersonate?token=ac8feb1b48fcddfe902814ff342de0d41e80d8d67e56d8182d634dbea1220e92f9dda4b0dbbe902ec460f119a435a684793e844b738529b42d6d60f12736b2f2"&gt;https://mycustomdomain.com/users/impersonate?token=ac8feb1b48fcddfe902814ff342de0d41e80d8d67e56d8182d634dbea1220e92f9dda4b0dbbe902ec460f119a435a684793e844b738529b42d6d60f12736b2f2&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Look up the target user account using the token&lt;/li&gt;
&lt;li&gt;Sign them in using whatever version of &lt;code&gt;session[:current_user] = user.id&lt;/code&gt; your app requires&lt;/li&gt;
&lt;li&gt;Remove the token from the user account so the impersonation can’t be replayed&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Recap
&lt;/h2&gt;

&lt;p&gt;So here’s the outline process for impersonating a user:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In your admin dashboard, let staff choose a user account to impersonate&lt;/li&gt;
&lt;li&gt;Request a 2FA verification code to confirm the identity of the admin user&lt;/li&gt;
&lt;li&gt;Once you’ve confirmed their identity, create the user session. In a simple web app, this might be just &lt;code&gt;session[:current_user] = user.id&lt;/code&gt; . Or you might do the more complex multi-tenant dance with tokens and redirects.&lt;/li&gt;
&lt;li&gt;Record the impersonation session in an audit log&lt;/li&gt;
&lt;li&gt;Notify a team Slack channel with the details of the session&lt;/li&gt;
&lt;li&gt;Add a session variable indicating that the account is being impersonated &lt;code&gt;session[:impersonating] = user.id&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Display a banner with a warning message, the name current user, and a way to end the session&lt;/li&gt;
&lt;li&gt;Disable all user analytics, both javascript and server-side&lt;/li&gt;
&lt;li&gt;If necessary &amp;amp; possible, disable user notifications like account activity emails&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>rails</category>
      <category>saas</category>
      <category>webapp</category>
      <category>security</category>
    </item>
  </channel>
</rss>
