Ejemplo n.º 1
0
    def after_handle(self):
        payload = self.response.payload
        response = replace_private_key(
            payload if isinstance(payload, basestring) else payload.getvalue())

        logger.info('cid:[{}], name:[{}], response:[{}]'.format(
            self.cid, self.name, response))
Ejemplo n.º 2
0
 def test_replace_private_key(self):
     self.maxDiff = maxint
     payload = '{"value": "-----BEGIN RSA PRIVATE KEY-----\\r\\nMIIJKQIBAAKCAgEA0nRSiWO6a68MQNxRcgUgDwHSB6ldSCAr6Xl9otadBN02fN6V\\r\\nZdFU4M5Gv+IEFpkgngStGHFyfAjX2pXXiL4Zpvggbzbiyg42y3s6vnE2I33NtEUd\\r\\nn3W5XiHBTUjzh7oETfK5lW1TnYXFBPBMSUjBzyQ1IUq9YZp3+HGLfB08ijsz7azZ\\r\\n35IvlTT12GbS09+85+Mtik+ABEtSiUbBpgZv\\/W0qNj35Rky1Q\\/U236QJOjPQzG8p\\r\\nE12ep1AQECsSWAv3VpQoLHQFLMrLsfHNKAkTFpE0p3z3vjtc9P\\/ihxf+b5bA0R4s\\r\\nmbfnG1HNauLs73Y6P2K7PRa+LoQe5C4ljJ6KFNakRYkieSs5Ic4kRZxdr5BgamuH\\r\\n5nXYbKmDs9wFYE3s4CpHpEJip377utnodXU2W3F67uS4GS6nmBDa07xPJD\\/2NV9E\\r\\n3xTXTJXhxDdqnheIhm5u1rXPbqqp6F12mSFanTgNEd2Fa17o8lzvwJ6xfVr9rm1a\\r\\nxROA1gv0SEJFV9pCMB3U3X9L3Kf+xqzO\\/kxQOx3dyEFYYvfSuVm1CW\\/VWcuDXiFv\\r\\nYdgjubNOkYjqjzrYq\\/4Ef47NekLBidD+K\\/+\\/YjnQ55e4KDe780iI8euuFANTM471\\r\\n6FzU0kqelo360mb5h16CIqVBmCDXTcntqtpnlq2Xu2fsz3AdyyFNvWyk2GECAwEA\\r\\nAQKCAgBzE+A9+CZr06Ajp1Vxv5O0IQ6z2cyEL\\/NTC3fDnw7lJgExbpTKxBhhhOny\\r\\n6qfJo5nOTkh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0G8ZH8RXDcXkxfkJWaTHvMGj8zDeV0pH0PffkFAkuf8l9Hb1Zx\\/OuILz9QpByUVp\\r\\n\\/C5aiDrcz6q1c2kyOF3W7Lcghq2NaCjvAoIBAQDcoBxNP6+km\\/AgTjIQMtU2GusZ\\r\\nxzIKyItpkjYON8GyYJGMTr8twqhhomsW8nrodZAeqo\\/nUvjKGWebjR2ohEsRfqgN\\r\\n6eMTmbEYZDjnxiQyFlc6BwUvRhlaVlFAh3AquYEGd5aKbt5+k9798j1EPhFODFLM\\r\\nhhs6wd00A0den+X\\/j8u6Hv6yIZC5w7E\\/BL+bGFKUSeJTQsVa8+IO\\/2sVXcNXKJtT\\r\\no2DjN0BYoLePapQ5QBimN8SzenAU32QHH+LSdnGHsT97F232p8eaM5quhTTJ7325\\r\\nOaOmzFG5jrdqyNeIOrFTk5nYyQvEpzAVFp87VdLikFMYMyeWC6dIF+9PDk6O\\r\\n-----END RSA PRIVATE KEY-----"}'  # noqa
     replaced = util.replace_private_key(payload)
     self.assertEquals(
         replaced,
         '{"value": "-----BEGIN RSA PRIVATE KEY-----\******n-----END RSA PRIVATE KEY-----"}'
     )
Ejemplo n.º 3
0
    def after_handle(self):
        payload = self.response.payload
        is_basestring = isinstance(payload, basestring)
        needs_meta = self.request.input.get('needs_meta', True)

        if needs_meta and hasattr(self, '_search_tool') and not is_basestring:
            payload.zato_meta = self._search_tool.output_meta

        logger.info('cid:`%s`, name:`%s`, response:`%s`', self.cid, self.name,
                    replace_private_key(get_response_value(self.response)))
Ejemplo n.º 4
0
    def before_handle(self, has_info=has_info):
        if has_info:
            request = dict(self.request.input)
            for k, v in request.items():

                v = replace_private_key(v)

                if 'password' in k:
                    request[k] = SECRET_SHADOW

            logger.info('cid:[%s], name:[%s], SIO request:[%s]', self.cid, self.name, request)
Ejemplo n.º 5
0
    def before_handle(self):
        if logger.isEnabledFor(logging.INFO):
            request = dict(self.request.input)
            for k, v in request.items():

                v = replace_private_key(v)

                if 'password' in k:
                    request[k] = SECRET_SHADOW

            logger.info('cid:[%s], name:[%s], SIO request:[%s]', self.cid, self.name, request)
Ejemplo n.º 6
0
    def before_handle(self):
        if logger.isEnabledFor(logging.INFO):
            request = dict(self.request.input)
            for k, v in request.items():

                v = replace_private_key(v)

                if 'password' in k:
                    request[k] = SECRET_SHADOW

            logger.info('cid:[%s], name:[%s], SIO request:[%s]', self.cid,
                        self.name, request)
Ejemplo n.º 7
0
    def before_handle(self):

        # Do not log BASE64-encoded messages
        if self.name == 'zato.service.invoke':
            return

        if self.server.is_admin_enabled_for_info:
            request = dict(self.request.input)
            for k, v in request.items():

                v = replace_private_key(v)

                if 'password' in k:
                    request[k] = SECRET_SHADOW

            logger.info('Request; service:`%s`, data:`%s` cid:`%s`, ',
                        self.name, request, self.cid)
Ejemplo n.º 8
0
    def after_handle(self):

        # Do not log BASE64-encoded messages
        if self.name == 'zato.service.invoke':
            return

        if self.server.is_admin_enabled_for_info:
            logger.info('Response; service:`%s`, data:`%s` cid:`%s`, ',
                        self.name,
                        replace_private_key(get_response_value(self.response)),
                        self.cid)

            payload = self.response.payload
            is_text = isinstance(payload, basestring)
            needs_meta = self.request.input.get('needs_meta', True)

            if needs_meta and hasattr(self, '_search_tool'):
                if not is_text:
                    payload.zato_meta = self._search_tool.output_meta
Ejemplo n.º 9
0
    def after_handle(self):
        payload = self.response.payload
        response = replace_private_key(payload if isinstance(payload, basestring) else payload.getvalue())

        logger.info('cid:[{}], name:[{}], response:[{}]'.format(self.cid, self.name, response))
Ejemplo n.º 10
0
 def test_replace_private_key(self):
     self.maxDiff = maxint
     payload = '{"value": "-----BEGIN RSA PRIVATE KEY-----\\r\\nMIIJKQIBAAKCAgEA0nRSiWO6a68MQNxRcgUgDwHSB6ldSCAr6Xl9otadBN02fN6V\\r\\nZdFU4M5Gv+IEFpkgngStGHFyfAjX2pXXiL4Zpvggbzbiyg42y3s6vnE2I33NtEUd\\r\\nn3W5XiHBTUjzh7oETfK5lW1TnYXFBPBMSUjBzyQ1I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N8SzenAU32QHH+LSdnGHsT97F232p8eaM5quhTTJ7325\\r\\nOaOmzFG5jrdqyNeIOrFTk5nYyQvEpzAVFp87VdLikFMYMyeWC6dIF+9PDk6O\\r\\n-----END RSA PRIVATE KEY-----"}'
     replaced = util.replace_private_key(payload)
     self.assertEquals(replaced, '{"value": "-----BEGIN RSA PRIVATE KEY-----\******n-----END RSA PRIVATE KEY-----"}')