facebook/mariana-trench

How to check argument value with regex?

Opened this issue · 1 comments

Hi. How can I check some argument value with mariana?
For example, I need to check Cipher.getInstanse(v) argument value with some regex pattern (AES/CBC/* etc)
I'm defining this model for sink:

      "find": "methods",
      "where": [
        {
          "constraint": "is_static",
          "value": true
        },
        {
          "constraint": "signature",
          "pattern": "Ljavax/crypto/Cipher;\\.getInstance:\\(Ljava/lang/String;\\)Ljavax/crypto/Cipher;"
        }
      ],
      "model": {
        "for_all_parameters": [
          {
            "variable": "idx",
            "where": [

            ],
            "sinks": [
              {
                "kind": "CryptoTransformation",
                "port": "Argument(0)",
                "via_value_of": [
                  "Argument(0)"
                ]
              }
            ]
          }
        ]
      }

How can I check Argument(0) value with the regex?
Thanks

Hi @IgorInk,

This is not currently possible and is unlikely to be implemented soon. The model generation step (which parses the json) does not have information about arguments, it only has typing information.
I would recommend using via_value_of for now (as you did).