WEBVTT

00:02.040 --> 00:04.220
Hello, my name is Aaron.

00:04.220 --> 00:06.080
And I guess I have to apologize.

00:06.080 --> 00:12.340
The resemblance is a little hard to see in that picture, because my hair is not nearly as luscious as it is in that photo.

00:12.380 --> 00:17.800
But I'm sorry, your mineral content in the water, as you've all found out, really awful here.

00:18.700 --> 00:21.780
But yeah, like Jen, I work at Google.

00:21.780 --> 00:25.560
We do web security on hundreds and thousands of different web apps.

00:25.560 --> 00:28.140
I've been at Google for a little under seven years.

00:28.140 --> 00:31.360
And before my stint in security, I came from the developer side.

00:31.360 --> 00:35.760
I've worked on products like Google Docs and GCP on customer facing stuff.

00:35.760 --> 00:51.080
So when we approach this work of trying to make our web apps as secure as possible, we approach it with a special empathy for the developer, where we want to ship the most secure products, but also we don't want to get in the way of delivering really dynamic and new user features.

00:51.840 --> 00:52.460
Cool.

00:52.460 --> 00:53.360
Thanks, Aaron.

00:53.540 --> 00:55.840
Here's a quick look at our agenda for today.

00:55.840 --> 00:58.940
So we'll start with a quick intro to XSS.

00:58.940 --> 01:02.320
I assume most of you are familiar with it, but we'll still go over some examples.

01:02.600 --> 01:08.140
And then we'll talk about runtime mitigation, specifically those that come with content security policy and its different flavors.

01:08.260 --> 01:12.100
Then we'll talk about how we use those to secure applications at scale.

01:12.460 --> 01:16.980
And we'll move on to how we imagine the post-XSS world and end with a call to action.

01:17.720 --> 01:18.460
Cool.

01:18.560 --> 01:20.060
So cross-site scripting.

01:20.900 --> 01:23.900
It's just some data to motivate that this is a big problem.

01:24.000 --> 01:30.240
Google runs a vulnerability reward program where we pay out security researchers when they report their bugs to us.

01:30.720 --> 01:34.980
As you can see here, over 50% of the bugs reported are web-related.

01:34.980 --> 01:35.540
That makes sense.

01:35.540 --> 01:37.100
Google is a web company.

01:37.200 --> 01:43.080
And then the rest, out of those 50%, almost 35% are XSS.

01:43.080 --> 01:48.200
So this was a really big problem, and that's why we've developed techniques to remediate the stats at scale.

01:48.540 --> 01:51.200
So let's talk about what XSS really is.

01:51.200 --> 01:56.060
The root cause is user input gets mixed up with code and then gets interpreted as code.

01:56.080 --> 02:02.840
Because HTML is dynamic and mixes static data with logic that should execute, as you see here, this is very prevalent.

02:02.840 --> 02:06.800
And this leads to malicious scripts getting injected into a trusted site.

02:06.880 --> 02:16.700
In this example, you see a very simple example, there's a description that's supposed to be dynamic, but if this is user-controlled, we can inject the following script and get it to execute.

02:16.700 --> 02:18.160
And there you have an XSS.

02:18.940 --> 02:24.140
An XSS, when exploited, lets the attacker take control of the account of a logged-in user.

02:24.140 --> 02:29.520
This means the attacker can do anything the victim can, so it's pretty powerful, and that's why we try really hard to avoid it.

02:29.640 --> 02:37.060
We also call this the client-side version of remote code execution, as they share a similar concept of arbitrary code execution.

02:37.260 --> 02:41.160
And here's another format you might be used to seeing XSS.

02:41.160 --> 02:46.320
We usually pop an alert with the document domain as a proof of concept when we find an XSS record.

02:47.200 --> 02:53.240
So a quick example of DOM XSS, the client-side variant of cross-site scripting.

02:53.240 --> 02:57.220
The root cause here is DOM APIs are not secure by default.

02:57.220 --> 03:05.060
We all love JavaScript, and JavaScript loves turning strings into code through APIs like innerHTML or script.innerText.

03:05.140 --> 03:07.940
Here's a very simple example of how this might happen.

03:07.940 --> 03:11.060
In this code snippet, locationHash is a user-controlled string.

03:11.060 --> 03:13.860
We take that and happily insert it into innerHTML.

03:13.940 --> 03:20.620
In this case, with the example here, the onError alert statement will execute, and then we have XSS.

03:20.620 --> 03:22.380
But no one codes like this anymore, right?

03:22.380 --> 03:27.200
Thanks to modern frameworks like React that abstract away file manipulations, nobody has to do this.

03:29.580 --> 03:30.980
Except... not.

03:30.980 --> 03:41.620
As you can see in this fresh bit of internet outrage, an enterprising developer has managed to work in a innerHTML assignment inside a very functional React component.

03:41.620 --> 03:52.140
It's supposed to be a really advanced system that takes care of the virtual DOM dipping, all of the different re-rendering things, so that you don't have to do this yourself, but this developer didn't really want to take it into their own hands.

03:52.140 --> 03:54.140
And this is the crux of the problem.

03:54.140 --> 04:01.480
Just because a framework can abstract away the complex DOM operations doesn't mean that it can prevent a developer from using them.

04:01.480 --> 04:04.540
And these issues are really easy to introduce in your codebase.

04:04.540 --> 04:12.540
It really takes a developer, a code reviewer, having a bad day and once it sneaks into your product then it's really hard to eradicate.

04:12.540 --> 04:15.740
So do we stand a chance against this class of problems?

04:16.060 --> 04:17.160
And we think we do.

04:17.160 --> 04:22.240
We've all heard of content security policy and how it can solve all your process scripting, right?

04:22.240 --> 04:28.580
Well, we do admit that content security policy is a little bit difficult to understand and configure.

04:28.660 --> 04:32.040
It really is more like a meta feature than a feature.

04:32.040 --> 04:36.780
It has a lot of bells and whistles and knobs that you can change, a lot of directives.

04:36.780 --> 04:38.420
What do you have to set on these directives?

04:38.420 --> 04:44.640
And it is a little confusing because it tries to cover everything, any sort of resource that loads on your page.

04:44.640 --> 04:58.020
But hopefully when we go on this journey together, we can talk about some of the configurations that we found to work at scale and cover many classes of cross-site scripting and we'll see why they work together.

04:58.540 --> 05:10.740
And before we begin, since we are talking about cross-site scripting and CSP and protections that Google uses, maybe we'll take a look at what is actually working in the wild.

05:10.740 --> 05:15.220
So here we have an example of a particular Google web app that some of you may have used.

05:15.220 --> 05:21.980
You know it has a really complicated UI with a lot of interactive user features and a small call out to this team.

05:21.980 --> 05:31.640
They've been great partners in really shipping the best and greatest and the latest web protection mitigations and working really hard to keep their end users safe.

05:31.660 --> 05:36.620
So let's open up Chrome DevTools and see what we are actually shipping on a real life product.

05:36.900 --> 05:43.180
And as you can see here, we see a couple different content security policies, a lot of them as a matter of fact.

05:43.180 --> 05:54.120
But like we said before, not all of them are specifically for cross-site scripting defenses because it's a meta feature that can also turn off other potential dangerous vectors as well.

05:54.120 --> 06:01.860
We don't have time to get into the other protections, but if you have questions, we will be sticking around for a little bit after we can go into more detail after the talk.

06:01.860 --> 06:13.460
But for now, we'll focus on these two, the ones that we find to be really powerful protections against cross-site scripting, namely the nonce-only CSP and the trusted types header.

06:14.700 --> 06:17.140
Cool, and we'll go into some details.

06:17.140 --> 06:22.580
So nonce-only CSP, in the example we saw before, it's pretty self-explanatory.

06:22.580 --> 06:24.600
It's the one with the nonce directive.

06:25.360 --> 06:30.000
More specifically, a nonce-only policy takes a form that looks a bit like this.

06:30.000 --> 06:34.820
Internally, we recommend a nonce-only or a strict CSP for most of our modern web apps.

06:34.820 --> 06:39.960
What this does is only what's allow-listed under the script source directive can run on the page.

06:39.960 --> 06:41.480
Other scripts will be blocked.

06:41.480 --> 06:48.740
So in this case, any script with the right nonce, which is a random value that's generated per request, can run on the page.

06:48.740 --> 06:56.800
So the templating systems usually propagate the nonce for each script tag on the HTML, and the header has to send the right value for the nonce.

06:56.800 --> 07:01.840
So the header and the HTML work together to indicate which scripts are trusted, and the browser can act accordingly.

07:02.480 --> 07:07.680
Another CSP directive that's useful for a nonce-only policy is the strict dynamic directive.

07:07.680 --> 07:11.040
This directive enables a transitive trust for scripts.

07:11.040 --> 07:16.740
So if you have one script with the right nonce, it's allowed to load other scripts, and the trust is propagated.

07:16.920 --> 07:20.560
When we don't have this directive, only scripts with the right nonce can execute.

07:20.560 --> 07:22.640
If they load other scripts, they'll be blocked.

07:23.320 --> 07:30.100
So although this slightly relaxes the policy, we found that it's also made adoptions a lot easier for complex web apps.

07:30.100 --> 07:32.540
So that's the trade-off that we're working on.

07:33.820 --> 07:34.980
So thanks, Jen.

07:34.980 --> 07:47.740
So as Jen mentioned, a nonce-only CSP is great if you have the back-end or the server-side render content working in close conjunction with the front-end or client-side code, because you have to generate these nonces that are new for every single response.

07:47.940 --> 07:50.360
But what if you don't have control over the back-end?

07:50.360 --> 07:55.040
Then we have to use a close relative of the nonce-only CSP called the hash-based CSP.

07:55.060 --> 08:02.740
And the way it works is, it's very similar to a nonce-based policy, but as you've noticed, instead of the nonce value, we provide a hash value.

08:02.740 --> 08:09.040
And this is really powerful because we don't have to regenerate this CSP for every response load.

08:09.040 --> 08:15.980
The hash is fixed, presumably because on every response, your script is mostly the same.

08:15.980 --> 08:25.340
And this is really powerful when you don't have control over that back-end, so you can put in the logic to do this nonce generation.

08:25.560 --> 08:41.360
And this is also super useful for the SBA, single-page applications, because when you are doing the final bundling process for your final HTML, you know what script has are going to be there in your SBA bundle, and use that to generate your hash, and there you go,

08:41.480 --> 08:49.300
a fixed CSP policy that offers this protection that you can even drop into a meta tag at the top of the HTML file.

08:49.300 --> 08:56.240
And in more detail, so what you have on the left is sort of like what your bundle might look like for a particular single-page application.

08:56.240 --> 09:00.700
You've got a couple scripts loading to actually get the user interaction going.

09:00.700 --> 09:10.740
And we would actually rewrite this in this case into a dynamic loader inside an inline script block, because that is one of the characteristics of a hash-based CSP for now.

09:10.740 --> 09:15.060
You need to know exactly what's in the script content in order to make the hash.

09:15.060 --> 09:27.780
So usually you do this by actually inlining the block, and if you have resources that would load over the network, then you turn it into JavaScript that would dynamically add it to the page.

09:27.780 --> 09:35.880
And once we have that, we also added some preload tags so that we actually get the parallelization going for fetching these resources.

09:35.880 --> 09:42.680
You can take the script block, create the hash, and stick it in as a meta tag that carries a CSP, and there you go.

09:42.680 --> 09:47.680
The HTML is self-contained and offers this protection with a CSP baked in.

09:51.680 --> 09:56.200
The next CSP-delivered mitigation that we want to talk about is trusted types.

09:56.200 --> 10:00.280
Specifically, trusted types is geared towards protecting DOM-based XSS.

10:00.300 --> 10:07.660
So in the example that we saw before, it's the one that says require trusted types for, and that's the directive that you need to send.

10:08.940 --> 10:13.080
So we want to point out that the attack surface is large here for DOM XSS.

10:13.080 --> 10:22.100
There's over 60 JavaScript APIs that can turn strings into code and lead to arbitrary code execution, and DOM XSS is usually very easy to introduce and hard to detect.

10:22.100 --> 10:30.200
Calls to these APIs could be going through multiple levels of indirections, it could be in a transitive dependency, or it could exist in libraries that we don't have control over.

10:30.200 --> 10:31.800
So how can we make this better?

10:32.260 --> 10:36.280
And we need a run-time mitigation for this, and this is where trusted types comes in.

10:36.280 --> 10:40.680
The main idea behind trusted types is to make security decisions explicit and auditable.

10:40.680 --> 10:52.520
To do this, trusted types will restrict the access to the dangerous DOM APIs we mentioned previously, and it will require typed objects instead of plain strings to be passed into the over 60 APIs.

10:52.580 --> 10:59.920
So in this case, instead of strings that represent script URLs, HTML, or scripts, will require typed objects such as trusted script URL.

10:59.920 --> 11:03.700
And we'll discuss how to generate these typed objects, but this is the main idea.

11:04.720 --> 11:07.040
This is what the header looks like, again.

11:07.100 --> 11:14.500
This tells the browser to reject string assignments to injection syncs, and effectively it provides a run-time type checking mechanism on top of JavaScript.

11:14.880 --> 11:25.100
If you remember the example from our DOM XSS slide before, we're using a plain string here with innerHTML, and if trusted types were enforced, we would throw an error that looks like this.

11:25.100 --> 11:29.180
So the browser will tell you you need a trusted HTML, and it won't use a string.

11:30.120 --> 11:39.600
We want to highlight that most security guarantees of trusted types come from a policy, and the policy is what I mentioned of how we could generate a trusted object.

11:39.720 --> 11:44.680
So you can think of it as a wrapper that takes in a string and returns a trusted type.

11:44.680 --> 11:56.200
And we apply this policy to strings before inserting them into the DOM sync, and the processing you do within the policy should make sure the string won't lead to any unintended code execution, therefore preventing DOM XSS.

11:56.380 --> 11:59.740
So in this example, we use a sanitizer from DOM Purify.

11:59.740 --> 12:06.800
We check for the presence of trusted types in the JavaScript namespace for browser compatibility, and then use the correct factory if it exists.

12:06.800 --> 12:21.840
But if you don't want to keep writing this verbose if block, because it is a bit clunky, DOM Purify also works with trusted types off the shelf, so it will do the policy creation and the browser compatibility checking under the hood for you if you pass in the right config for trusted types.

12:25.280 --> 12:26.020
Thanks, Jen.

12:26.020 --> 12:38.060
So now that we've talked about our security features that we believe are powerful against cross-site scripting today, we'll touch a little bit on how to use them in your application and offer a bit of the lessons that we've learned from securing our apps at scale at Google.

12:38.060 --> 12:45.040
So before we begin, we'd like to make a quick plug for an article that presents many of the ideas that we'll discuss in the next section, but in written form.

12:45.040 --> 12:53.340
This approach is used widely in our team and our org, and this article goes into a little bit more detail than what we have time for in some of the ideas that we'll elaborate on next.

12:53.340 --> 13:02.780
It's on the Google Security Engineering blog at bughunters.google.com, along with other great content like this, and also similar to, I think, the theme of this village.

13:02.780 --> 13:04.480
So please check us out.

13:04.720 --> 13:06.280
So back to the main show.

13:06.280 --> 13:12.540
What are some of the tactics that we use to adopt these security features at scale on hundreds of different web apps?

13:12.540 --> 13:18.800
So some of the lessons that we've learned that we find most useful are, number one, use the frameworks that will help you in this journey.

13:18.900 --> 13:28.280
Number two, try to shift left to get developers an indication whether this feature is incompatible with code that they're writing as early as possible in the process.

13:28.280 --> 13:34.380
Number three, some tools that we've built and we also rely on throughout this process that we found useful.

13:34.380 --> 13:40.320
And number four, a quick note about third-party dependencies and how they might complicate your adoption process.

13:40.460 --> 13:49.160
So the first big idea is if you're starting a new code base from scratch, let's think about which frameworks we can use that will give us security superpowers.

13:49.160 --> 14:04.700
And the big idea behind that is that at our scale, at at-scale defense against cross-site scripting at Google, we rely on frameworks with, number one, context-aware templating, and number two, built-in compatibility with these security features that are secure by default.

14:04.860 --> 14:11.020
And as a quick aside, we haven't talked too much about context-aware templating right now, but we don't have too much time to get into that.

14:11.020 --> 14:20.320
But the gist of it is you want to have a templating system that does reasonable enough things to prevent a lot of server-side rendered cross-site scripting from happening.

14:20.320 --> 14:24.920
Catch us after the talk, and we are happy to chat about templating too, which is beyond the scope of this talk.

14:26.820 --> 14:33.100
So what we want to cover on this slide and for the rest of the talk is what we call the safe calling philosophy at Google.

14:33.100 --> 14:47.220
And this is the idea that we want to give tools to developers that take away a lot of the uncertainty from the developer on how to use and configure these security features correctly, because they are really easy to misconfigure in really subtle ways.

14:47.260 --> 14:58.240
And we want the security to not really get in the way of feature development and shipping great things to our users, so we want to abstract away some of these decisions in a clear and understandable manner.

14:58.240 --> 15:02.480
And the key to do this is through our frameworks and our APIs.

15:02.540 --> 15:14.460
And we'll say that this is possible at Google because you do have tight control over the internal frameworks that you use in-house, and also tight control over the guidance that we give to our developers on how to use these frameworks.

15:14.460 --> 15:21.540
But I imagine many of the web developers here aren't building internal web apps for Google, so how can you get some of these benefits?

15:21.780 --> 15:32.520
And thankfully, our, yeah, colleagues have worked hard to ensure compatibility with some of these security features and frameworks that are available outside of our internal ecosystem as well.

15:32.520 --> 15:44.080
For instance, some of the frameworks that are also available externally, like Angular and Lit, all the hurdling work that we do there translates to benefits for the ecosystem and for everyone in the world to use.

15:44.080 --> 15:59.740
But if you're also using frameworks that are not entirely within the Google ecosystem or very Google-inspired, we also have our colleagues at Meta who did a lot of work to make React compatible with CSV and Trusted Types, and some of the frameworks that are based on React,

15:59.740 --> 16:04.940
like Next.js, thanks to volunteers and other colleagues, have compatibility as well.

16:04.940 --> 16:09.420
Great, so on to the second idea, how to shift left and enforce early.

16:09.420 --> 16:25.440
And this is just the idea that you want to add these headers and protections as early as possible, maybe in your dev server, so that when things go wrong, your developers can see the error and act on it as soon as they've written the code, so that they can fix it while the context of what they're trying to do is fresh in their minds.

16:25.640 --> 16:33.700
And a quick, and more technically, a way to do this is, well, here in this example, we have a configuration for a Vite dev server.

16:33.700 --> 16:36.560
I hear that's what all the web developers are using nowadays.

16:36.560 --> 16:38.320
We are all on to Vite now.

16:38.840 --> 16:46.960
And here we see a Node.js express-style middleware inside this configuration for the dev server that just dumps in these headers.

16:48.220 --> 16:58.240
But if you don't have control over your dev server or your serving stack, as you mentioned before, meta tags at the top of an HTML file also can deliver these headers.

16:58.240 --> 17:13.880
And for the observant among you, you will see that here we have our hash-based CSP again, because if you are baking a CSP into a static HTML page, you really want it to be a hash-based CSP so that the nonce value isn't blown the first time you use it.

17:14.040 --> 17:22.420
And we saw an example of how to do the refactoring to make a hash-based CSP before, and it was a little cumbersome, so how can you do that more easily?

17:22.420 --> 17:30.860
And the answer is, we have an experimental tool available in GitHub and NPM that does a lot of this transformation for you.

17:30.860 --> 17:40.400
This is available as a Webpack plugin, but also as a utility library that takes in a string of the HTML and does a refactoring like this.

17:40.460 --> 17:49.300
I mean, I know there's a lot of code on the screen, but it just takes in a string and outputs a string and will shuffle around the notes, do the hashing, add the meta tags for you.

17:49.300 --> 18:00.240
And this is really powerful because this is a very framework-agnostic way that now has proven to have outlasted the popularity of Webpack plugins because they just keep changing the configurations.

18:00.240 --> 18:09.340
But this is really powerful because if we remember the example from before with the Vite middleware, it composes almost perfectly.

18:09.340 --> 18:12.420
This is just a copy-paste job of the last two slides.

18:12.700 --> 18:27.060
And I think one of the lessons we learned in building some of this tooling is if you keep it as agnostic as possible in terms of frameworks and just separate the logic from the framework, then you can just, yeah, snap the pieces together when a new framework comes along.

18:28.120 --> 18:30.340
So on to the next section.

18:31.560 --> 18:32.740
Thanks, Aaron.

18:32.740 --> 18:40.540
In addition to using the header to spot violations early, we really advocate for using some other tools to help you with adopting these defenses.

18:40.540 --> 18:49.080
We'll introduce a bunch of helpful tools, but they can be categorically be broken down into, first of all, tools for understanding features and violations.

18:49.100 --> 18:55.180
We mentioned that CSV is notoriously hard to configure and understand, and the CSV evaluator solves that problem.

18:55.180 --> 19:01.700
It's available as either a website or a Chrome extension, which will give you some high-level guidance on the configuration of your CSV.

19:01.700 --> 19:05.880
It can detect directives and then kind of explain them.

19:06.340 --> 19:09.780
We're also actively working on a tool called Trusted Types Helper.

19:09.780 --> 19:15.440
This isn't released yet, but it will be soon, for streamlining the Trusted Types adoption process.

19:15.440 --> 19:21.860
One of the most time-consuming and painful stages of Trusted Types enforcement is finding the source of violations and trying to fix them.

19:21.860 --> 19:28.100
So this Chrome extension will create a DevTools tab that helps you demystify Trusted Types violations and suggest some refactoring.

19:28.100 --> 19:29.320
So stay tuned.

19:29.920 --> 19:34.820
Another category of tools are those that help with refactoring using Static Analysis.

19:35.280 --> 19:47.000
We have a huge Static Analysis pipeline at Google, and we took the most effective checks that we run on our internal Static Analysis tooling and Linter and built it on top of ESLint, and that is Safety Web.

19:47.000 --> 19:51.660
This project is also in active development, but it is available on GitHub.

19:51.740 --> 20:00.720
As you can see in the example here, it will detect unsafe usages of risky APIs, and you can refactor these unsafe calls with another tool we provide called Safe Values.

20:00.720 --> 20:05.880
So Safe Values is a library designed to steer developers to make safer choices.

20:05.980 --> 20:14.800
It will prevent unsafe assignments using TypeScript type checking unless the value is trusted, either from a trusted source or by transformation that makes it trusted.

20:14.800 --> 20:17.980
For example, sanitizing an HTML makes it trusted.

20:19.000 --> 20:23.380
We mentioned we were going to add a quick note about third-party dependencies.

20:23.380 --> 20:29.560
This is the complicated part, and it's a big aspect of making your application compatible with these features.

20:29.820 --> 20:37.780
For both Trusted Types and CSP, all code running on your site needs to be free of violations of these policies, otherwise they will be blocked by the browser.

20:38.040 --> 20:50.580
This is a hard part because we won't always know which dependencies are incompatible until we've introduced them, and it's also hard to fix because the potential refactoring sites don't exist in our code, but code that others have written and others control.

20:50.720 --> 21:00.380
We're currently working on tooling that will make informed decisions about which dependencies might be compatible with which features in the ecosystem, but this is a part where we could use some help as well.

21:00.380 --> 21:10.920
As CSP and Trusted Types gain more widespread browser adoption, you can help us by making pull requests if you do end up patching third-party dependencies that you find along your journey of adopting these features.

21:12.900 --> 21:13.680
Thanks, Jen.

21:13.680 --> 21:24.440
So, I know we talked a lot about the mitigations and the tools that are used today to protect our apps, but let's talk a bit about where we want to go from here and the more secure world that we'd like to see in the future.

21:25.020 --> 21:32.820
And here are the key ideas we talked about today that form the basis of this protection, this pipeline of protection, if you will.

21:34.220 --> 21:40.840
So, the running theme is abstracting security decisions away from developers in a clear and secure by default way.

21:41.180 --> 21:52.660
When all of these elements work together, starting from the first stage when the code is written, all the way to the final point when the code is executed in the client's browser, we have protection at every stage of the development lifecycle.

21:52.780 --> 21:57.680
And this should make most cross-site scripting solvable, and we see this working at Google scale.

21:57.680 --> 22:13.020
On our most recent in-house frameworks that follow a lot of these guidelines from these pillars, we see so few cross-site scripting, and none of them are trivial attack chains, and all of them really have some weird logic bug or some legacy system involved.

22:13.020 --> 22:19.140
So, we are seeing the effects of this working at scale across billions of users and hundreds of different web apps.

22:19.140 --> 22:20.520
But how can we make this safer?

22:20.520 --> 22:21.480
Where do we go from here?

22:21.480 --> 22:23.340
What's the next logical step?

22:23.340 --> 22:34.140
And we believe that, remember how we talked about trusted types, and it blocks a lot of these inherently unsafe DOM APIs in the web platform, or at least makes it harder to use?

22:34.140 --> 22:47.440
What if we take that to the conclusion of the idea and actually like ban all of those usages at runtime of these legacy DOM APIs that are a little bit inherently unsafe as they've been designed?

22:47.440 --> 22:50.580
Can we build apps where we don't use any of those APIs?

22:51.060 --> 22:53.680
And that's our future vision of where we go from here.

22:53.680 --> 23:15.760
If we have new platform-level APIs for operations that we currently use DOM APIs for, such as maybe a browser-included sanitizer implementation for HTML, maybe a templating solution, then we've really come full circle and have our runtime enforcements influence a new suite of secure-by-default web platform APIs to bring decisions that nudge developers towards safer choices,

23:15.760 --> 23:27.960
maybe at the framework level, from the very beginning when the first line of code is written in a new code base all the way to the moment when it is executed on the client's browser.

23:28.520 --> 23:39.020
And this is the future we hope to get to, one where we can safely lock down all the accesses to many DOM APIs along with a new suite of platform APIs to replace those operations in a safe-by-default manner.

23:39.020 --> 23:49.140
And we call this approach, we've nicknamed it Perfect Types, it is the logical evolution of Trusted Types, and we see this as the next evolution of Trusted Types and a post-cross-site scripting world.

23:49.140 --> 23:58.660
This combined with the strict CSP configurations we talked about and our framework-based approaches, secure-by-design, safe-by-design, should guide us to a new post-cross-site scripting world.

23:58.660 --> 24:12.120
And taking a step back for a second, for an even bigger picture, and as a final plug, this safe coding philosophy and safe-by-design, trying to steer developers in the right direction is something that extends beyond just JavaScript, cross-site scripting,

24:12.120 --> 24:16.060
and is a core priority for all Google-scale security efforts.

24:16.060 --> 24:28.980
You can read more about our organization's work at these links, and Google is a signer of CISA's secure-by-design pledge along with other industry and government leaders in the space, and we've committed to sharing our knowledge on how to build a safer future together.

24:29.820 --> 24:34.260
All right, well, that is the end of our talk, so thank you everyone for listening.

24:34.260 --> 24:37.380
Hopefully this was a good guide on how to think about solving XSS.

24:37.380 --> 24:38.160
I'll leave you here.

