Building and Deploying Secure Angular Apps

Slides:



Advertisements
Similar presentations
Make your app a native part of Office with Add-ins
Advertisements

From IT Pros to IT Heroes - with Azure DevTest Labs
Azure Machine Learning Deploying and Managing Models in production
SharePoint Provisioning Success with PnP PowerShell
6/5/2018 1:30 PM THR1029 Spend less time managing data and more time with customers: Quick tour of Outlook Customer Manager Welly Lee
DevOps for any language
THR3052 Tips and tricks: Build, deploy, and manage web apps powered by containers Ahmed Elnably Program Manager
6/11/2018 8:14 AM THR2175 Building and deploying existing ASP.NET applications using VSTS and Docker on Windows Marcel de Vries CTO, Xpirit © Microsoft.
Azure Cloud Shell Magic of Modern Command-line Management
ASP.NET Core 2.0 Fundamentals
Developing Hybrid Apps on Microsoft Azure Stack
TFS Database Import Service for Visual Studio Team Services
Azure SDKs and Tools for You
7/2/2018 3:48 AM BRK3394: Visual Studio Code The most useful (and underused!) tips and tricks Chris Dias Principal Program Manager VS Code © Microsoft.
Optimizing Microsoft OneDrive for the enterprise
Performing a Seamless Migration in Azure SQL DB
What a Real, Functioning DevOps Team Looks Like
Virtual Machine Diagnostics in Microsoft Azure
SQL Server on Linux on All-Flash Arrays
SQL Server for Java developers
Workflow Orchestration with Adobe I/O
Customize Office 365 Search and create result sources
9/12/2018 7:18 AM THR1081 Don’t be the first victim of new malware Turn Windows Defender AV Cloud Protection on! Amitai Senior Program.
Automate all things! Microsoft Azure continuous deployment
Modern Front-End Web Development with Visual Studio
Agile Planning with Visual Studio Team Services (VSTS)
9/22/2018 3:49 AM BRK2247 Learn from MVPs: Panel discussion on all things SharePoint and OneDrive © Microsoft Corporation. All rights reserved. MICROSOFT.
Confidence at speed: Visual Studio 2017 and your CI pipeline
Azure PowerShell Aaron Roney Senior Program Manager Cormac McCarthy
Continuous Delivery for Microsoft Azure
Port your AWS Knowledge to Azure
11/15/ :59 AM THR2294 Building great looking experiences with Microsoft Graph and Office UI Fabric Ben Summers Office Marketing David Lavenda Harmon.ie.
Continuous Delivery with Visual Studio Team Services
Supercharge Microsoft Teams using Teams apps in node.js
Azure Advisor: Optimization in the best way
PowerShell Unplugged Jeffrey Snover Technical Fellow
Mobile Center and VSTS:​ Better together for your Mobile DevOps
11/27/2018 5:08 PM THR3057 Using a PowerShell release pipeline for a real-world service provider delivery in Microsoft Azure Niklas Åkerlund Lead Architect.
Microsoft products for non-profits
Power-up NoSQL with Azure Cosmos DB
Azure CLI Jason R. Shaver Senior Program Manager
Introduction to ASP.NET Core 1.0
Five cool things you can do with Windows PowerShell on Office 365
Microsoft To-Do Preview
Securely pass passwords into your deployment
Microsoft Exchange: Through the eyes of MVPs (Panel discussion)
MDM Migration Analysis Tool (MMAT)
TechEd /11/ :21 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered.
Overview: Dynamics 365 for Project Service Automation
Understand your Azure cloud assets dependencies with BMC Discovery
Hostage Negotiation, Special Ops and Office 365 Adoption
Breaking Down the Value of A Yammer Post: 20 Things to Do
Cool Microsoft Edge Tips and Tricks
When Bad Things Happen to Good Applications
Getting the most out of Azure resources with Azure Advisor
Manage your App Service resources using Command line tools
“Hey Mom, I’ll Fix Your Computer”
4/21/2019 7:09 AM THR2098 Unlock New Opportunities with Nintex Hawkeye Process Intelligence and Workflow Analytics Sr. Product.
Build /19/2019 © 2015 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION.
Виктор Хаджийски Катедра “Металургия на желязото и металолеене”
Consolidate, manage, backup, and secure your cloud content
Designing Bots that Fit Your Organization
Ask the Experts: Windows 10 deployment and servicing
Jason Zander Unplugged
Passwordless Service Accounts
Шитманов Дархан Қаражанұлы Тарих пәнінің
Digital Transformation: Putting the Jigsaw Together
WCF and .NET Framework Microservices in Containers
Diagnostics and troubleshooting in Azure App Service Support Center
Optimizing your content for search and discovery
Presentation transcript:

Building and Deploying Secure Angular Apps 9/17/2018 4:52 AM BRK3288 Building and Deploying Secure Angular Apps John Papa Brian Clark @john_papa @_clarkio BRK3288 9:00 AM - 10:15 AM ET OCCC S330 © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Try it Out https://github.com/Azure-Samples/angular-cosmosdb use the develop branch

Building , Deploying, Securing Angular 1 1 2 2 3 3 4 4 5 5 Building , Deploying, Securing Angular

Building , Deploying, Securing Angular 1 1 Building , Deploying, Securing Angular 2 2 Creating Apps 3 3 4 4 5 5

Building , Deploying, Securing Angular 1 Building , Deploying, Securing Angular 2 2 1 Creating Apps 3 3 4 4 5 5

Building , Deploying, Securing Angular 1 Building , Deploying, Securing Angular 2 1 2 Creating Apps Building Apps 3 3 4 4 5 5

Building , Deploying, Securing Angular 1 Building , Deploying, Securing Angular 2 1 2 3 Creating Apps Building Apps Deploying Apps 3 4 4 5 5

Building , Deploying, Securing Angular 1 Building , Deploying, Securing Angular 2 1 2 3 Creating Apps Building Apps Deploying Apps 3 4 4 Access Control 5 5

Building , Deploying, Securing Angular 1 Building , Deploying, Securing Angular 2 1 2 3 Creating Apps Building Apps Deploying Apps 3 4 4 5 Access Control Securing Apps 5

9/17/2018 4:52 AM Angular CLI © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Create, build, test and run with consistency

Friction Points to Modern Web Development Getting started 1 Dev and debug cycle 2 Optimized and consistent build process 3

Friction Points to Modern Web Development 1 Getting started Dev and debug cycle 2 Optimized and consistent build process 3

Friction Points to Modern Web Development 1 Getting started 2 Dev and debug cycle Optimized and consistent build process 3

Friction Points to Modern Web Development 1 Getting started 2 Dev and debug cycle 3 Optimized and consistent build process

Installing the Angular CLI npm install –g @angular/cli Installed globally with npm

Generating a New App ng new my-app --routing --prefix ma --style scss --dry-run Add routing Set your prefix Define your styles Verify the file names Remove when ready

Generating from Blueprints ng generate component customer ng generate service customer-data ng generate class customer-model customer.component.ts customer-data.service.ts customer-model.ts Syntax: ng generate <blueprint> <options> Use the --dry-run option to practice

When it’s Time to Build ng build Development build Output to /dist folder, by default (see .angular-cli.json) ng build --prod Minified, optimized, and cache busting

Comparing Dev and Prod Build Targets ng build ng build --prod Environment environment.ts environment.prod.ts Cache-busting only images referenced in css all build files Source maps generated not generated Extracted CSS global CSS output to .js yes, to css file(s) Uglification no yes Tree-Shaking no yes AOT no yes Bundling yes yes

Analyze and Optimize https://www.npmjs.com/package/source-map-explorer ng build --prod --build-optimizer -sm Optimized build with source maps source-map-explorer dist/main.xxx.js Analyze the source https://www.npmjs.com/package/source-map-explorer

Keep Our Apps Safe

9/17/2018 4:52 AM Casterly Rock © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Casterly Rock 9/17/2018 4:52 AM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Casterly Rock 9/17/2018 4:52 AM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Casterly Rock “an impregnable fortress” 9/17/2018 4:52 AM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Casterly Rock 9/17/2018 4:52 AM ?! © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Casterly Rock 9/17/2018 4:52 AM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Deter your enemies

Defending against…

Defending against… Infantry

Defending against… Infantry Arrows

Defending against… Infantry Arrows Mortars

O W A S P

O pen W eb A pplication owasp.org S ecurity P roject

Control Access to Our Apps

permissions for the request 9/17/2018 4:52 AM Authenticatio n Authorization You are who you say you are You have the required permissions for the request © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

permissions for the request Authenticatio n Authorization You are who you say you are You have the required permissions for the request

permissions for the request Authenticatio n Authorization You are who you say you are You have the required permissions for the request

permissions for the request Authenticatio n Authorization You are who you say you are You have the required permissions for the request

permissions for the request Authenticatio n Authorization You are who you say you are You have the required permissions for the request

Browser http://localhost:3001 Server http://localhost:3001 id=1 9/17/2018 4:52 AM Browser http://localhost:3001 Server http://localhost:3001 id=1 © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Browser http://localhost:3001 Login Server http://localhost:3001 id=1 9/17/2018 4:52 AM Browser http://localhost:3001 Login Server http://localhost:3001 id=1 © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Browser http://localhost:3001 Server http://localhost:3001 id=1 9/17/2018 4:52 AM Browser http://localhost:3001 id=1 Server http://localhost:3001 © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Browser http://localhost:3001 Create Server http://localhost:3001 9/17/2018 4:52 AM Browser Cookie s http://localhost:3001 Create id=1 Server http://localhost:3001 © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Browser http://localhost:3001 Create Hero: Luke Server 9/17/2018 4:52 AM Browser Cookie s http://localhost:3001 Create id=1 id=1 Hero: Luke Server http://localhost:3001 © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

http://passportjs.org 9/17/2018 4:52 AM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Faking Requests

Browser http://localhost:3001 Server http://localhost:3001 Cookie s 9/17/2018 4:52 AM Browser Cookie s http://localhost:3001 id=1 id=1 Server http://localhost:3001 © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Browser http://localhost:3001 Create Hero: Luke Server 9/17/2018 4:52 AM Browser Cookie s http://localhost:3001 Create id=1 id=1 Hero: Luke Server http://localhost:3001 © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Browser http://localhost:3001 http://clickbaity.co Server 9/17/2018 4:52 AM Browser Cookie s http://localhost:3001 http://clickbaity.co id=1 Server http://localhost:3001 © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Browser http://localhost:3001 http://attacker.com Attack 9/17/2018 4:52 AM Browser Cookie s http://localhost:3001 http://attacker.com Attack localhost:3001 id=1 id=1 Hero: Darth Server http://localhost:3001 © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Cross-site Request Forgery (CSRF, XSRF)

Cross-site Request Forgery https://github.com/expressjs/csurf

HTTP Headers

https://helmetjs.github.io/ 9/17/2018 4:52 AM https://helmetjs.github.io/ Clickjacking Cross-site Scripting (XSS) © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Security Authentication/Authorization CSRF Security Headers Cultural Ambassador Compliance

Deployment

Build and deploy with consistency and confidence

Copy it all to the dist folder Deploying the Web App Install dependencies Build Angular assets Build express server Copy it all to the dist folder Do the versions of Node match, both locally and in the cloud?

Containerize with Docker Build the image Tag it Push it to Azure docker-compose up –d docker tag myimage myreg.azurecr.io/papa/myimage docker push myreg.azurecr.io/papa/myimage Push the Docker image to the Azure Container Registry

Summary

Summary Angular CLI VS Code (Extensions and Debugging) passport (Auth) csurf (CSRF) helmet (security headers) SSL/HTTPS Docker and VSTS (CI) Summary Cultural Ambassador Compliance

Resources https://aka.ms/ng-cosmosdb https://aka.ms/ng-essentials GitHub (develop branch) https://aka.ms/ng-cosmosdb Extension: Angular Essentials https://aka.ms/ng-essentials Extension: Docker https://aka.ms/vsc-docker Extension: Azure CLI https://aka.ms/vsc-azure-cli

Related Great Sessions 9/17/2018 4:52 AM Related Great Sessions Get typed with TypeScript (BRK3196) Continuous delivery with Visual Studio Team Services (THR2146) Visual Studio Code: The most useful (and underused) tips and tricks (BRK3394) Globally distributed, secure MongoDB with Azure Cosmos DB (BRK3110) © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Please evaluate this session Tech Ready 15 9/17/2018 Please evaluate this session From your Please expand notes window at bottom of slide and read. Then Delete this text box. PC or tablet: visit MyIgnite https://myignite.microsoft.com/evaluations Phone: download and use the Microsoft Ignite mobile app https://aka.ms/ignite.mobileapp Your input is important! © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.