facebook/mariana-trench

Stuck creating generators: Found 0 issues

serrapa opened this issue · 0 comments

Hello everyone, I need some help because I cannot detect a simple data flow.

I have this piece of source code:

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Intent intent = this.getIntent();
        Uri uri_data = intent.getData();
        Log.d("TEST", uri_data.toString());
    }

I am trying to catch the data flow that should have the return value of the getData method as a source and every argument of the d method as sinks. Below the json generators:

// Source.json:

{
  "model_generators": [
    {
        "find": "methods",
        "where": [
          { 
            "constraint": "any_of", 
            "inners": [
              {
                "constraint": "parent",
                "inner": { "constraint": "name", "pattern": "Landroid/content/Intent;" }
              },
              {
                "constraint": "parent",
                "inner": {
                  "constraint": "extends",
                  "inner": { "constraint": "name", "pattern": "Landroid/content/Intent;" }
                }
              }
            ]
          },
          { 
            "constraint": "any_of", 
            "inners": [
              { "constraint": "name", "pattern": "get.*Extra" },
              { "constraint": "name", "pattern": "getData" }
            ]
          }
          
        ],
        "model": {
          "sources": [ 
            { 
              "kind": "IntentData", 
              "port": "Return"
            } 
          ]
        },
        "verbosity": 1
    }]
}
// Sink.json

{
    "model_generators": [
        {
            "find": "methods",
            "where": [
                {
                    "constraint": "parent",
                    "inner": { "constraint": "name", "pattern": "Landroid/util/Log;" }
                }
            ],
            "model": {
                "for_all_parameters": [
                    {
                        "variable": "x",
                        "sinks": [
                            { "kind": "Logging", "port": "Argument(x)" }
                        ]
                    }
                ]
            },
            "verbosity" : 1
        }
    ]
}

Here the rule added to the rules.json file:

{
    "name": "Rule X",
    "code": 10,
    "description":"xxxx",
    "sources": [
      "IntentData"
    ],
    "sinks": [
      "Logging"
    ]
  }

Mariana found 0 issues, but I cannot understand what's wrong.