
class Processor(object):
    def __init__(self, client):
        self.client = client

    def process(self, data, **kwargs):
        resp = self.get_data(data)
        if resp:
            data = resp
        return data

class SantizePasswordsProcessor(Processor):
    """
    Asterisk out passwords from password fields in frames.
    """
    def process(self, data, **kwargs):
        if 'sentry.interfaces.Stacktrace' in data:
            if 'frames' in data['sentry.interfaces.Stacktrace']:
                for frame in data['sentry.interfaces.Stacktrace']['frames']:
                    if 'vars' in frame:
                        for k, v in frame['vars'].iteritems():
                            if 'password' in k or 'secret' in k:
                                # store mask as a fixed length for security
                                frame['vars'][k] = '*'*16
        return data


class Processor(object):
    def __init__(self, client):
        self.client = client

    def process(self, data, **kwargs):
        resp = self.get_data(data)
        if resp:
            data = resp
        return data


class SantizePasswordsProcessor(Processor):
    """
    Asterisk out passwords from password fields in frames.
    """
    def process(self, data, **kwargs):
        if 'sentry.interfaces.Stacktrace' in data:
            if 'frames' in data['sentry.interfaces.Stacktrace']:
                for frame in data['sentry.interfaces.Stacktrace']['frames']:
                    if 'vars' in frame:
                        for k, v in frame['vars'].iteritems():
                            lower_k = k.lower()
                            if 'password' in lower_k or 'secret' in lower_k:
                                # store mask as a fixed length for security
                                frame['vars'][k] = '*' * 16
        return data

Handle var names that are uppercase
Handle var names that are uppercase

+ 
  
  class Processor(object):
      def __init__(self, client):
          self.client = client
  
      def process(self, data, **kwargs):
          resp = self.get_data(data)
          if resp:
              data = resp
          return data
  
+ 
  class SantizePasswordsProcessor(Processor):
      """
      Asterisk out passwords from password fields in frames.
      """
      def process(self, data, **kwargs):
          if 'sentry.interfaces.Stacktrace' in data:
              if 'frames' in data['sentry.interfaces.Stacktrace']:
                  for frame in data['sentry.interfaces.Stacktrace']['frames']:
                      if 'vars' in frame:
                          for k, v in frame['vars'].iteritems():
+                             lower_k = k.lower()
-                             if 'password' in k or 'secret' in k:
+                             if 'password' in lower_k or 'secret' in lower_k:
                                  # store mask as a fixed length for security
-                                 frame['vars'][k] = '*'*16
+                                 frame['vars'][k] = '*' * 16
          return data
+ 
Handle var names that are uppercase
## Code Before:

class Processor(object):
    def __init__(self, client):
        self.client = client

    def process(self, data, **kwargs):
        resp = self.get_data(data)
        if resp:
            data = resp
        return data

class SantizePasswordsProcessor(Processor):
    """
    Asterisk out passwords from password fields in frames.
    """
    def process(self, data, **kwargs):
        if 'sentry.interfaces.Stacktrace' in data:
            if 'frames' in data['sentry.interfaces.Stacktrace']:
                for frame in data['sentry.interfaces.Stacktrace']['frames']:
                    if 'vars' in frame:
                        for k, v in frame['vars'].iteritems():
                            if 'password' in k or 'secret' in k:
                                # store mask as a fixed length for security
                                frame['vars'][k] = '*'*16
        return data
## Instruction:
Handle var names that are uppercase
## Code After:


class Processor(object):
    def __init__(self, client):
        self.client = client

    def process(self, data, **kwargs):
        resp = self.get_data(data)
        if resp:
            data = resp
        return data


class SantizePasswordsProcessor(Processor):
    """
    Asterisk out passwords from password fields in frames.
    """
    def process(self, data, **kwargs):
        if 'sentry.interfaces.Stacktrace' in data:
            if 'frames' in data['sentry.interfaces.Stacktrace']:
                for frame in data['sentry.interfaces.Stacktrace']['frames']:
                    if 'vars' in frame:
                        for k, v in frame['vars'].iteritems():
                            lower_k = k.lower()
                            if 'password' in lower_k or 'secret' in lower_k:
                                # store mask as a fixed length for security
                                frame['vars'][k] = '*' * 16
        return data
