Skip to content

Commit

Permalink
Deploying to gh-pages from @ 7b71131 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
facebook-github-bot committed Oct 13, 2023
1 parent 4717924 commit 94f7e52
Show file tree
Hide file tree
Showing 25 changed files with 87 additions and 82 deletions.
4 changes: 2 additions & 2 deletions 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<meta name="generator" content="Docusaurus v2.1.0">
<title data-rh="true">Page Not Found | Mariana Trench</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="https://mariana-tren.ch/404.html"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docusaurus_tag" content="default"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docsearch:docusaurus_tag" content="default"><meta data-rh="true" property="og:title" content="Page Not Found | Mariana Trench"><link data-rh="true" rel="icon" href="/img/favicon.ico"><link data-rh="true" rel="canonical" href="https://mariana-tren.ch/404.html"><link data-rh="true" rel="alternate" href="https://mariana-tren.ch/404.html" hreflang="en"><link data-rh="true" rel="alternate" href="https://mariana-tren.ch/404.html" hreflang="x-default"><link rel="alternate" type="application/rss+xml" href="/blog/rss.xml" title="Mariana Trench RSS Feed">
<link rel="alternate" type="application/atom+xml" href="/blog/atom.xml" title="Mariana Trench Atom Feed"><link rel="stylesheet" href="/assets/css/styles.e56ff910.css">
<link rel="preload" href="/assets/js/runtime~main.d4a8db2a.js" as="script">
<link rel="preload" href="/assets/js/runtime~main.4240a0ef.js" as="script">
<link rel="preload" href="/assets/js/main.98fb840d.js" as="script">
</head>
<body class="navigation-with-keyboard">
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script>
<div style="display: none; text-align: center; background-color: white; color: black;" id="internaldocs-banner"></div><div id="__docusaurus">
<div role="region" aria-label="theme.common.skipToMainContent"><a href="#" class="skipToContent_fXgn">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Navigation bar toggle" class="navbar__toggle clean-btn" type="button" tabindex="0"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><b class="navbar__title text--truncate">Mariana Trench</b></a><a class="navbar__item navbar__link" href="/docs/overview/">Documentation</a></div><div class="navbar__items navbar__items--right"><a href="https://github.com/facebook/mariana-trench" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div class="main-wrapper mainWrapper_z2l0"><main class="container margin-vert--xl"><div class="row"><div class="col col--6 col--offset-3"><h1 class="hero__title">Page Not Found</h1><p>We could not find what you were looking for.</p><p>Please contact the owner of the site that linked you to the original URL and let them know their link is broken.</p></div></div></main></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="row footer__links"><div class="col footer__col"><div class="footer__title">Learn</div><ul class="footer__items clean-list"><li class="footer__item"><a class="footer__link-item" href="/docs/getting-started/">Getting Started</a></li></ul></div><div class="col footer__col"><div class="footer__title">Community</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://twitter.com/metaOpenSource" target="_blank" rel="noopener noreferrer" class="footer__link-item">Twitter<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="col footer__col"><div class="footer__title">More</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://github.com/facebook/mariana-trench" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="col footer__col"><div class="footer__title">Legal</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://opensource.facebook.com/legal/privacy/" target="_blank" rel="noopener noreferrer" class="footer__link-item">Privacy<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://opensource.facebook.com/legal/terms/" target="_blank" rel="noopener noreferrer" class="footer__link-item">Terms<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="footer__bottom text--center"><div class="margin-bottom--sm"><a href="https://opensource.facebook.com" rel="noopener noreferrer" class="footerLogoLink_BH7S"><img src="/img/oss_logo.png" alt="Facebook Open Source Logo" class="themedImage_ToTc themedImage--light_HNdA footer__logo"><img src="/img/oss_logo.png" alt="Facebook Open Source Logo" class="themedImage_ToTc themedImage--dark_i4oU footer__logo"></a></div><div class="footer__copyright">Copyright © 2023 Meta Platforms, Inc. Built with Docusaurus.</div></div></div></footer></div>
<script src="/assets/js/runtime~main.d4a8db2a.js"></script>
<script src="/assets/js/runtime~main.4240a0ef.js"></script>
<script src="/assets/js/main.98fb840d.js"></script>
</body>
</html>
83 changes: 44 additions & 39 deletions _src/customize_sources_and_sinks.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,63 +4,68 @@ title: Customize Sources and Sinks
sidebar_label: Customize Sources and Sinks
---

import {OssOnly, FbInternalOnly} from 'docusaurus-plugin-internaldocs-fb/internal';
import FbCustomizeSourcesAndSinks from './fb/customize_sources_and_sinks.md';
import {OssOnly, FbInternalOnly} from 'docusaurus-plugin-internaldocs-fb/internal'; import FbCustomizeSourcesAndSinks from './fb/customize_sources_and_sinks.md';

This page provides a high-level overview of the steps needed to update or create new sources and sinks.

## Overview

Under the context of Mariana Trench, we talk about sources and sinks in terms of methods. For example, we may say that the return value of a method is a source (or a sink). We may also say that the 2nd parameter of a method is a source (or a sink). Such description of a method is called a **"model"**. See [Models](./models.md) for more details about models and writing them.
Under the context of Mariana Trench, we talk about sources and sinks in terms of methods (or, rarely, fields). For example, we may say that the return value of a method is a source (or a sink). We may also say that the 2nd parameter of a method is a source (or a sink). Such description of a method is called a **"model"**. See [Models & Model Generators](./models.md) for more details about models and writing them.

<FbInternalOnly> <FbCustomizeSourcesAndSinks/> </FbInternalOnly>

<OssOnly>

To define sources or sinks that are not contained in the default set of [sources](https://github.com/facebook/mariana-trench/tree/main/configuration/model-generators/sources) and [sinks](https://github.com/facebook/mariana-trench/tree/main/configuration/model-generators/sinks), a user needs to:

1. Write one or more JSON files that respect our [model generator Domain Specific Language (DSL)](./models.md), which express how to generate models from methods and are hence called **"model generators"**.
- For example, a model generator may say that, for all methods (that will be analyzed by Mariana Trench) whose name is `onActivityResult`, specify their 2nd parameter as a source.
```
{
"model_generators": [
{
"find": "methods",
"where": [
{
"constraint": "name",
"pattern": "onActivityResult"
},
],
"model": {
"sources": [
{
"kind": "TestSensitiveUserInput",
"port": "Argument(2)"
}
]
}
}
}
```
1. Write one or more JSON files that respect our [model generator Domain Specific Language (DSL)](./models.md), which express how to generate models from methods and are hence called **"model generators"**.

- For example, a model generator may say that, for all methods (that will be analyzed by Mariana Trench) whose name is `onActivityResult`, specify their 2nd parameter as a source.

```json
{
"model_generators": [
{
"find": "methods",
"where": [
{
"constraint": "name",
"pattern": "onActivityResult"
}
],
"model": {
"sources": [
{
"kind": "TestSensitiveUserInput",
"port": "Argument(2)"
}
]
}
}
]
}
```

2. Instruct Mariana Trench to read from your model generator, so that Mariana Trench will generate models at runtime.
- Intuitively, the models generated by interpreting model generators express sources and sinks of each method **before** running Mariana Trench. Based on such models, Mariana Trench will automatically infer **new** models for each method at runtime.
- To instruct Mariana Trench to read from customized JSON model generators, add your json model generator [here](https://github.com/facebook/mariana-trench/tree/main/configuration/model-generators).
- Add the model generator name (i.e, the file name) in the [JSON configuration file](https://github.com/facebook/mariana-trench/blob/main/configuration/default_generator_config.json).
- Intuitively, the models generated (by interpreting model generators) express sources and sinks for each method **before** running Mariana Trench. Based on such models, Mariana Trench will automatically infer **new** models for each method at runtime.
- To instruct Mariana Trench to read from customized JSON model generators, add your json model generator [here](https://github.com/facebook/mariana-trench/tree/main/configuration/model-generators).
- Add the model generator name (i.e, the file name) in the [JSON configuration file](https://github.com/facebook/mariana-trench/blob/main/configuration/default_generator_config.json).
3. Update **"rules"** if necessary.
- Background: Mariana Trench categorizes sources and sinks into different **"kinds"**, which are string-typed. For example, a source may have a kind of`JavascriptInterfaceUserInput`. A sink may have a kind of `Logging`. Mariana Trench only finds data flow **from sources of a particular kind to sinks of another paritcular kind**, which are called **"rules"**.
- To specify kinds that are not mentioned in the default set of rules or to specify rules that are different than the default rules, you need to specify a new rule in file [`rules.json`](https://github.com/facebook/mariana-trench/blob/main/configuration/rules.json), in order to instruct Mariana Trench to find data flow that matches the new rule.
- For example, to catch flows from `TestSensitiveUserInput` in the example above and the sink kind `Logging`, you can add the following rule to the default [`rules.json`](https://github.com/facebook/mariana-trench/blob/main/configuration/rules.json):
```
{
- Background: Mariana Trench categorizes sources and sinks into different **"kinds"**, which are string-typed. For example, a source may have a kind of`JavascriptInterfaceUserInput`. A sink may have a kind of `Logging`. Mariana Trench only finds data flow **from sources of a particular kind to sinks of another paritcular kind**, which are called **"rules"**. See [Rules](./rules.md) for writing them.
- To specify kinds that are not mentioned in the default set of rules or to specify rules that are different than the default rules, you need to specify a new rule in file [`rules.json`](https://github.com/facebook/mariana-trench/blob/main/configuration/rules.json), in order to instruct Mariana Trench to find data flow that matches the new rule.
- For example, to catch flows from `TestSensitiveUserInput` in the example above and the sink kind `Logging`, you can add the following rule to the default [`rules.json`](https://github.com/facebook/mariana-trench/blob/main/configuration/rules.json):
```json
{
"name": "TestRule",
"code": 18,
"description": "A test rule",
"sources": [
"TestSensitiveUserInput"
"TestSensitiveUserInput"
],
"sinks": [
"Logging"
"Logging"
]
}
```
}
```

</OssOnly>
1 change: 1 addition & 0 deletions assets/js/935f2afb.792c8ea3.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 94f7e52

Please sign in to comment.