How to use the instana.util.strip_secrets function in instana

To help you get started, we’ve selected a few instana examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github instana / python-sensor / tests / test_secrets.py View on Github external
def test_contains_ignore_case_no_match(self):
        matcher = 'contains-ignore-case'
        kwlist = ['XXXXXX']

        query_params = "one=1&Two=two&THREE=&4='+'&five='okyeah'"

        stripped = strip_secrets(query_params, matcher, kwlist)

        self.assertEqual(stripped, "one=1&Two=two&THREE=&4='+'&five='okyeah'")
github instana / python-sensor / tests / test_secrets.py View on Github external
def test_bad_kwlist(self):
        matcher = 'equals'
        kwlist = None

        query_params = "one=1&Two=two&THREE=&4='+'&five='okyeah'"

        stripped = strip_secrets(query_params, matcher, kwlist)

        self.assertEqual(stripped, "one=1&Two=two&THREE=&4='+'&five='okyeah'")
github instana / python-sensor / tests / test_secrets.py View on Github external
def test_contains(self):
        matcher = 'contains'
        kwlist = ['fi']

        query_params = "one=1&Two=two&THREE=&4='+'&five='okyeah'"

        stripped = strip_secrets(query_params, matcher, kwlist)

        self.assertEqual(stripped, "one=1&Two=two&THREE=&4='+'&five=")
github instana / python-sensor / tests / test_secrets.py View on Github external
def test_regex(self):
        matcher = 'regex'
        kwlist = [r"\d"]

        query_params = "one=1&Two=two&THREE=&4='+'&five='okyeah'"

        stripped = strip_secrets(query_params, matcher, kwlist)

        self.assertEqual(stripped, "one=1&Two=two&THREE=&4=&five='okyeah'")
github instana / python-sensor / tests / test_secrets.py View on Github external
def test_equals_with_path_component(self):
        matcher = 'equals'
        kwlist = ['Two']

        query_params = "/signup?one=1&Two=two&THREE=&4='+'&five='okyeah'"

        stripped = strip_secrets(query_params, matcher, kwlist)

        self.assertEqual(stripped, "/signup?one=1&Two=&THREE=&4='+'&five='okyeah'")
github instana / python-sensor / instana / wsgi.py View on Github external
return res

        ctx = tracer.extract(ot.Format.HTTP_HEADERS, env)
        self.scope = tracer.start_active_span("wsgi", child_of=ctx)

        if hasattr(agent, 'extra_headers') and agent.extra_headers is not None:
            for custom_header in agent.extra_headers:
                # Headers are available in this format: HTTP_X_CAPTURE_THIS
                wsgi_header = ('HTTP_' + custom_header.upper()).replace('-', '_')
                if wsgi_header in env:
                    self.scope.span.set_tag("http.%s" % custom_header, env[wsgi_header])

        if 'PATH_INFO' in env:
            self.scope.span.set_tag('http.path', env['PATH_INFO'])
        if 'QUERY_STRING' in env and len(env['QUERY_STRING']):
            scrubbed_params = strip_secrets(env['QUERY_STRING'], agent.secrets_matcher, agent.secrets_list)
            self.scope.span.set_tag("http.params", scrubbed_params)
        if 'REQUEST_METHOD' in env:
            self.scope.span.set_tag(tags.HTTP_METHOD, env['REQUEST_METHOD'])
        if 'HTTP_HOST' in env:
            self.scope.span.set_tag("http.host", env['HTTP_HOST'])

        return self.app(environ, new_start_response)