Implementing Machine AuthN & Compliance at Pinterest | by Pinterest Engineering | Pinterest Engineering Weblog | Jan, 2023

Armen Tashjian | Safety Engineer, Company Safety

Flow map from User to Okta to External Identity Provider to Device Compliance Check with an arrow back to Okta “User redirected back to Okta to proceed with authentication.”

Pinterest has enforced the usage of managed and compliant units in our Okta authentication circulation, utilizing a passwordless implementation, in order that entry to our instruments all the time requires a wholesome Pinterest gadget.

Following the phishing-based assaults in opposition to our friends within the tech trade, Pinterest determined to take a two pronged method to defend in opposition to related assaults. We determined to:

  1. Require a managed and wholesome Pinterest gadget be used to entry all Pinterest assets, even when within the possession of legitimate credentials
  2. Require FIDO2 credentials for person authentication

On this publish, we’ll be specializing in how we required the usage of Pinterest managed units in our Okta authentication circulation.

Picture 1: A person on an Android gadget is prevented from authenticating. Picture 2: A person on macOS is warned about some compliance failures.

There are just a few driving forces behind this initiative:

  • With the introduction of our PinFlex WFH coverage, we anticipated an elevated variety of staff interacting with Pinterest instruments and providers exterior of the workplace.
  • For worker dealing with instruments, Pinterest is a SaaS-first firm, which implies that the overwhelming majority of our instruments are web accessible. These instruments will stay internet-accessible both by alternative, or due to the shortage of native IP-based allowlisting capabilities.
  • Our urge for food for network-centric safety controls has diminished. Whereas that doesn’t imply that VPN or on-premise network-based entry can be completely going away, we acknowledge that our default place gained’t be to power customers to be on a specific community in an effort to entry assets, particularly a SaaS software.
  • Now we have a set of necessary safety controls that solely exist on company-managed units and/or Cell BYOD with MDM.

We really feel that requiring a managed and wholesome gadget for authentication mitigates a number of the misplaced safety boundaries described above, by making certain that:

  • Phished person credentials (whether or not password, OTP, or push notification) won’t lead to entry to Pinterest assets.
  • Web-accessible Pinterest instruments, together with people who could include delicate knowledge, can’t be accessed from unmanaged or unknown units.
  • Managed units can be in a hardened state, making it tougher for adversaries to achieve a foothold.

Whereas researching the completely different integration choices inside Okta, just a few issues grew to become obvious for Okta Basic prospects:

  1. The prevailing bespoke gadget associated integrations that do exist between MDM suppliers and Okta, corresponding to Machine Belief with Jamf or WS1, don’t present complete options to prospects.
  2. If an Okta buyer or a possible vendor needs to combine with Okta to do one thing “attention-grabbing” with the authentication circulation, the one avenue for doing so is to determine mutual belief with some external identity provider (IdP), the place these “attention-grabbing” issues can happen.

Subsequently, we didn’t have a lot of a alternative however to construct and route customers to our personal customized id supplier. Zuul (apologies Netflix) is an OIDC id supplier that the Pinterest safety workforce constructed, in an effort to incorporate our gadget auth and compliance necessities into the Okta authentication circulation.

Flow map from User to Okta to External Identity Provider to Device Compliance Check with an arrow back to Okta “User redirected back to Okta to proceed with authentication.”
Picture 3: Excessive stage circulation diagram of Okta authentication with idP Routing/Discovery

Like a number of the distributors on this area, we combine our IdP with Okta utilizing IdP Routing/Discovery, the place our IdP acts as a trusted exterior id supplier. We combine with Okta utilizing the “IdP as SSO” method, slightly than the “IdP as a Issue/MFA” method, because the latter conflicts with our FIDO2 implementation.

At its core, and from Okta’s perspective, our IdP is nothing greater than a compliant OIDC IdP. Nevertheless, now that we’re within the vital path for SSO authentication, the whole expertise, in addition to the success of the authentication request, could be enhanced to implement the usage of a managed and compliant gadget.

One of many challenges that must be overcome with any device-based answer is with the ability to affiliate an authentication try with a particular gadget. This requirement is why a certificate-based method was a lovely choice.

We concern certificates to all managed units, together with desktop and cell platforms, by our MDM answer, which requires customers to authenticate to ensure that a credential to be issued to the gadget. This permits us to:

  1. Decide the person id earlier than interacting with them (e.g. FIDO2) by encoding the person id within the PKI certificates issued to the gadget throughout MDM enrollment
  2. Affiliate an authentication try with a bodily gadget, because the certificates was issued to that gadget throughout enrollment
  3. Keep away from platform-specific brokers, as certificate-based authentication is natively supported on the platforms that we help at Pinterest, so we’re capable of reap the benefits of a platform-agnostic method to authentication

Our customized IdP solely helps mTLS authentication with consumer certificates, utilizing certificates which are tied each to a person and gadget. With out a legitimate consumer certificates, which is simply distributed to managed units, authentication to our IdP isn’t attainable.

For purposes that don’t help Mutual TLS authentication, for the explanations described within the followup weblog publish, a workaround exists to revert again to password-based authentication.

One other hurdle to beat is Okta’s lack of “enforcement” of an exterior id supplier. Though we are able to route customers to an exterior id supplier, Okta doesn’t present the instruments essential to correctly implement the usage of an id supplier.

Okta clearly indicates that the usage of IdP Routing, and corresponding IdP Routing Guidelines, isn’t a safety management:

Routing guidelines enhance the end-user sign-in expertise, however they don’t present safety enhancements. You want to configure person authentication insurance policies to your IdPs independently of your routing guidelines.

This successfully implies that we can’t depend on exterior IdP as being something greater than an “non-obligatory” type of authentication. With out taking any extra steps to implement the usage of an exterior IdP, it’s trivial to bypass the usage of an exterior IdP by reverting again to Okta username/password-based authentication.

Within the quote above, Okta alludes to “person authentication insurance policies” as a technique of enforcement. Had these referenced insurance policies been precise “utility sign-on insurance policies,” enforcement would have been a non-issue. Sadly, the one Okta insurance policies that exist are “international sign-on” insurance policies, which can’t account for the inevitable utility exceptions that you’ll seemingly run into, and are due to this fact not sensible to make use of.

SAML Inline Hooks permit for an exterior service to switch a SAML assertion earlier than that SAML Assertion is signed by Okta. On the floor, that’s not likely related to a tool authentication answer, however there may be one notable return sort that piqued our curiosity: the power to reject an entry try by returning an error.

The requests despatched by Okta in a SAML Inline Hook include some related details about an utility entry try, together with:

  1. The applying that’s being accessed
  2. The person making an attempt to entry the applying
  3. How the person’s Okta session was established

Within the examples under, notice the distinction between the “periods” in these two app entry makes an attempt.

Entry try to reject (exterior IdP not used)

Entry try to permit (exterior IdP used)

Which means that we are able to programmatically make an access-based choice for each single utility entry try. For an entry try that ought to proceed, we return an empty response. For entry makes an attempt that must be rejected, we throw an error. In different phrases, we are able to overcome no matter limitations exist in Okta app sign-on insurance policies by bolting on our personal customized app sign-on coverage utilizing an inline hook.

To enhance the person expertise, we additionally revoke a person’s Okta session when this error is surfaced.

Within the instance under, a person has established an Okta session with one of many many ways in which IdP routing could be bypassed, in an try to bypass our gadget necessities. But, they nonetheless can’t entry an utility that requires our exterior IdP.

User is directed to a 400 bad request screen and has to be redirected back to the hompage.
Picture 4: SAML Inline Hook blocks an utility entry try, as a consequence of an Okta session that was not established with the proper idP

Though SAML Inline Hooks characterize a great short-term answer for us, that is under no circumstances superb. SAML Inline Hooks have to be enabled on a per utility foundation and may solely be enabled on purposes which are manually configured in Okta, so some reconfiguration of apps may be vital. We’re planning to reconfigure purposes that had been downloaded from the Okta Integration Network for the only real function of enabling our SAML Inline Hook on these purposes.

We’re hopeful that Okta will launch one thing, in both Okta Basic or OIE, that enables for us to natively implement an IdP on a per utility foundation, with a configuration that additionally permits FIDO2 enforcement. Alternatively, an “Inline Hook” for common authentication that may be universally utilized to each Okta app would even be an attention-grabbing different.

Now that each Okta authentication try requires customers to authenticate in opposition to our IdP, we have now the chance to judge the well being of a tool. The intent of our compliance insurance policies is to implement our safety hardening pointers to make sure that the fleet of units which are able to accessing our instruments are in compliance and in a hardened state.

Within the occasion {that a} gadget with compliance failures makes an attempt to authenticate, we are able to take just a few actions, together with presenting a warning to the person, or for some insurance policies, blocking the authentication try altogether.

User is directed to a screen that reads “There are one or more issues with your device. Warnings: chrome_running_versions and uptime.”
Picture 5: A person on macOS is warned about some compliance failures.

Our compliance framework permits for some capabilities that had been necessary to us and are usually not generally seen in different options. This contains:

  1. Insurance policies which are outlined as code, permitting us to create advanced insurance policies if vital
  2. Insurance policies that may bear in mind knowledge from as many knowledge sources as wanted. We at present combine with Splunk, Chef, Workspace One, and osquery, with extra integrations deliberate.
  3. “Actions” which are executed upon the failure of a coverage, two of which we present on this weblog publish (Block/Warn)
  4. The power to slowly shard a brand new coverage throughout the fleet, utilizing our current manufacturing framework for deploying experiments

Beneath we’ve created an instance coverage to make sure that a person authenticating to Okta is doing so from a tool that’s owned by them and logged in on that gadget with an identical username.

Picture 6: A person on macOS is prevented from authenticating as their gadget is failing the instance coverage “username_mismatch”.

Beneath is the code related to this instance coverage. With the intention to carry out this analysis, we take knowledge collected from two completely different knowledge sources (Airwatch MDM and osquery), and examine the usernames with the particular person making an attempt to authenticate to Okta.

Potential future compliance insurance policies would possibly bear in mind:

  1. Patch standing
  2. Malware detection
  3. Safety agent well being
  4. Log ingestion well being
  5. Utility/browser extensions
  6. Kernel/system extensions
  7. Root CAs
  8. CIS hardening pointers
  9. And plenty of different issues!

We’ve solely begun our gadget compliance journey, and a great quantity of labor lies forward, together with:

  • Constantly codifying gadget compliance insurance policies
  • Further integrations, for each accumulating knowledge, in addition to performing actions within the occasion of failures
  • Evaluating gadget compliance not simply at authentication time, however on a steady foundation
  • Closing the Okta enforcement gaps by enabling SAML Inline Hooks throughout all apps

An enormous thanks to our companions in IT and Site visitors Engineering, for serving to Company Safety to implement this, and a particular point out goes to Jason Craig, a human being.

Keep tuned for some followup weblog posts, together with:

  • Our FIDO2 implementation
  • A extra in depth look into gadget compliance

For any ideas or suggestions, be happy to succeed in out to zuul[at]

To be taught extra about engineering at Pinterest, try the remainder of our Engineering Weblog and go to our Pinterest Labs web site. To discover life at Pinterest, go to our Careers web page.