def test_sanitize_credit_card_within_value(self):
        proc = SensitiveDataFilter()
        result = proc.sanitize('foo', "'4571234567890111'")
        assert result == FILTER_MASK

        proc = SensitiveDataFilter()
        result = proc.sanitize('foo', "foo 4571234567890111")
        assert result == FILTER_MASK
Exemple #2
0
    def test_sanitize_credit_card_within_value(self):
        proc = SensitiveDataFilter()
        result = proc.sanitize('foo', "'4242424242424242'")
        self.assertEquals(result, proc.MASK)

        proc = SensitiveDataFilter()
        result = proc.sanitize('foo', "foo 4242424242424242")
        self.assertEquals(result, proc.MASK)
Exemple #3
0
    def test_sanitize_credit_card_within_value(self):
        proc = SensitiveDataFilter()
        result = proc.sanitize('foo', "'4242424242424242'")
        self.assertEquals(result, FILTER_MASK)

        proc = SensitiveDataFilter()
        result = proc.sanitize('foo', "foo 4242424242424242")
        self.assertEquals(result, FILTER_MASK)
Exemple #4
0
    def test_sanitize_credit_card_within_value(self):
        proc = SensitiveDataFilter()
        result = proc.sanitize('foo', "'4571234567890111'")
        assert result == FILTER_MASK

        proc = SensitiveDataFilter()
        result = proc.sanitize('foo', "foo 4571234567890111")
        assert result == FILTER_MASK
Exemple #5
0
 def test_sanitize_url(self):
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', 'pg://*****:*****@localhost/1')
     self.assertEquals(result, 'pg://*****:*****@localhost/1' % proc.MASK)
     # Make sure we don't mess up any other url.
     # This url specifically if passed through urlunsplit(urlsplit()),
     # it'll change the value.
     result = proc.sanitize('foo', 'postgres:///path')
     self.assertEquals(result, 'postgres:///path')
Exemple #6
0
 def test_sanitize_url(self):
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', 'pg://*****:*****@localhost/1')
     self.assertEquals(result, 'pg://*****:*****@localhost/1' % proc.MASK)
     # Make sure we don't mess up any other url.
     # This url specifically if passed through urlunsplit(urlsplit()),
     # it'll change the value.
     result = proc.sanitize('foo', 'postgres:///path')
     self.assertEquals(result, 'postgres:///path')
 def test_sanitize_url(self):
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', 'pg://*****:*****@localhost/1')
     assert result == 'pg://*****:*****@localhost/1' % FILTER_MASK
     result = proc.sanitize('foo', "foo 'redis://*****:*****@localhost:6379/0' bar")
     assert result == "foo 'redis://*****:*****@localhost:6379/0' bar" % FILTER_MASK
     result = proc.sanitize('foo', "'redis://*****:*****@localhost:6379/0'")
     assert result == "'redis://*****:*****@localhost:6379/0'" % FILTER_MASK
     result = proc.sanitize('foo', "foo redis://redis:foo@localhost:6379/0 bar")
     assert result == "foo redis://redis:%s@localhost:6379/0 bar" % FILTER_MASK
     result = proc.sanitize(
         'foo', "foo redis://redis:foo@localhost:6379/0 bar pg://matt:foo@localhost/1"
     )
     assert result == "foo redis://redis:%s@localhost:6379/0 bar pg://matt:%s@localhost/1" % (
         FILTER_MASK, FILTER_MASK
     )
     # Make sure we don't mess up any other url.
     # This url specifically if passed through urlunsplit(urlsplit()),
     # it'll change the value.
     result = proc.sanitize('foo', 'postgres:///path')
     assert result == 'postgres:///path'
     # Don't be too overly eager within JSON strings an catch the right field.
     result = proc.sanitize(
         'foo',
         '{"a":"https://localhost","b":"foo@localhost","c":"pg://*****:*****@localhost/1","d":"lol"}'
     )
     assert result == '{"a":"https://localhost","b":"foo@localhost","c":"pg://*****:*****@localhost/1","d":"lol"}' % FILTER_MASK
 def test_sanitize_url(self):
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', 'pg://*****:*****@localhost/1')
     assert result == 'pg://*****:*****@localhost/1' % FILTER_MASK
     result = proc.sanitize('foo',
                            "foo 'redis://*****:*****@localhost:6379/0' bar")
     assert result == "foo 'redis://*****:*****@localhost:6379/0' bar" % FILTER_MASK
     result = proc.sanitize('foo', "'redis://*****:*****@localhost:6379/0'")
     assert result == "'redis://*****:*****@localhost:6379/0'" % FILTER_MASK
     result = proc.sanitize('foo',
                            "foo redis://redis:foo@localhost:6379/0 bar")
     assert result == "foo redis://redis:%s@localhost:6379/0 bar" % FILTER_MASK
     result = proc.sanitize(
         'foo',
         "foo redis://redis:foo@localhost:6379/0 bar pg://matt:foo@localhost/1"
     )
     assert result == "foo redis://redis:%s@localhost:6379/0 bar pg://matt:%s@localhost/1" % (
         FILTER_MASK, FILTER_MASK)
     # Make sure we don't mess up any other url.
     # This url specifically if passed through urlunsplit(urlsplit()),
     # it'll change the value.
     result = proc.sanitize('foo', 'postgres:///path')
     assert result == 'postgres:///path'
     # Don't be too overly eager within JSON strings an catch the right field.
     result = proc.sanitize(
         'foo',
         '{"a":"https://localhost","b":"foo@localhost","c":"pg://*****:*****@localhost/1","d":"lol"}'
     )
     assert result == '{"a":"https://localhost","b":"foo@localhost","c":"pg://*****:*****@localhost/1","d":"lol"}' % FILTER_MASK
Exemple #9
0
 def test_sanitize_url(self):
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', 'pg://*****:*****@localhost/1')
     self.assertEquals(result, 'pg://*****:*****@localhost/1' % FILTER_MASK)
     # Make sure we don't mess up any other url.
     # This url specifically if passed through urlunsplit(urlsplit()),
     # it'll change the value.
     result = proc.sanitize('foo', 'postgres:///path')
     self.assertEquals(result, 'postgres:///path')
     result = proc.sanitize('foo',
                            "foo 'redis://*****:*****@localhost:6379/0' bar")
     self.assertEquals(
         result,
         "foo 'redis://*****:*****@localhost:6379/0' bar" % FILTER_MASK)
     result = proc.sanitize('foo', "'redis://*****:*****@localhost:6379/0'")
     self.assertEquals(result,
                       "'redis://*****:*****@localhost:6379/0'" % FILTER_MASK)
     result = proc.sanitize('foo',
                            "foo redis://redis:foo@localhost:6379/0 bar")
     self.assertEquals(
         result, "foo redis://redis:%s@localhost:6379/0 bar" % FILTER_MASK)
     result = proc.sanitize(
         'foo',
         "foo redis://redis:foo@localhost:6379/0 bar pg://matt:foo@localhost/1"
     )
     self.assertEquals(
         result,
         "foo redis://redis:%s@localhost:6379/0 bar pg://matt:%s@localhost/1"
         % (FILTER_MASK, FILTER_MASK))
 def test_sanitize_url(self):
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', 'pg://*****:*****@localhost/1')
     self.assertEquals(result, 'pg://*****:*****@localhost/1' % FILTER_MASK)
     # Make sure we don't mess up any other url.
     # This url specifically if passed through urlunsplit(urlsplit()),
     # it'll change the value.
     result = proc.sanitize('foo', 'postgres:///path')
     self.assertEquals(result, 'postgres:///path')
     result = proc.sanitize('foo', "foo 'redis://*****:*****@localhost:6379/0' bar")
     self.assertEquals(result, "foo 'redis://*****:*****@localhost:6379/0' bar" % FILTER_MASK)
     result = proc.sanitize('foo', "'redis://*****:*****@localhost:6379/0'")
     self.assertEquals(result, "'redis://*****:*****@localhost:6379/0'" % FILTER_MASK)
     result = proc.sanitize('foo', "foo redis://redis:foo@localhost:6379/0 bar")
     self.assertEquals(result, "foo redis://redis:%s@localhost:6379/0 bar" % FILTER_MASK)
     result = proc.sanitize('foo', "foo redis://redis:foo@localhost:6379/0 bar pg://matt:foo@localhost/1")
     self.assertEquals(result, "foo redis://redis:%s@localhost:6379/0 bar pg://matt:%s@localhost/1" % (FILTER_MASK, FILTER_MASK))
 def test_doesnt_scrub_not_scrubbed(self):
     proc = SensitiveDataFilter(include_defaults=True)
     assert proc.sanitize('is_authenticated', 'foobar') == FILTER_MASK
     assert proc.sanitize('is_authenticated', 'null') == 'null'
     assert proc.sanitize('is_authenticated', True) is True
 def test_authorization_scrubbing(self):
     proc = SensitiveDataFilter(include_defaults=True)
     assert proc.sanitize('authorization', 'foobar') == FILTER_MASK
     assert proc.sanitize('auth', 'foobar') == FILTER_MASK
     assert proc.sanitize('auXth', 'foobar') == 'foobar'
 def test_should_have_mysql_pwd_as_a_default(self):
     proc = SensitiveDataFilter(include_defaults=True)
     assert proc.sanitize('MYSQL_PWD', 'the one') == FILTER_MASK
     assert proc.sanitize('mysql_pwd', 'the two') == FILTER_MASK
 def test_authorization_scrubbing(self):
     proc = SensitiveDataFilter(include_defaults=True)
     assert proc.sanitize('authorization', 'foobar') == FILTER_MASK
     assert proc.sanitize('auth', 'foobar') == FILTER_MASK
     assert proc.sanitize('auXth', 'foobar') == 'foobar'
 def test_does_not_sanitize_timestamp_looks_like_card(self):
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', '1453843029218310')
     assert result == '1453843029218310'
Exemple #16
0
 def test_sanitize_credit_card_mastercard(self):
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', '5555555555554444')
     assert result == FILTER_MASK
 def test_doesnt_scrub_not_scrubbed(self):
     proc = SensitiveDataFilter(include_defaults=True)
     assert proc.sanitize("is_authenticated", "foobar") == FILTER_MASK
     assert proc.sanitize("is_authenticated", "null") == "null"
     assert proc.sanitize("is_authenticated", True) is True
 def test_sanitize_credit_card_visa(self):
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', '4111111111111111')
     assert result == FILTER_MASK
 def test_should_have_mysql_pwd_as_a_default(self):
     proc = SensitiveDataFilter(include_defaults=True)
     assert proc.sanitize("MYSQL_PWD", "the one") == FILTER_MASK
     assert proc.sanitize("mysql_pwd", "the two") == FILTER_MASK
 def test_should_have_mysql_pwd_as_a_default(self):
     proc = SensitiveDataFilter(include_defaults=True)
     assert proc.sanitize('MYSQL_PWD', 'the one') == FILTER_MASK
     assert proc.sanitize('mysql_pwd', 'the two') == FILTER_MASK
Exemple #21
0
 def test_sanitize_credit_card(self):
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', '4242424242424242')
     self.assertEquals(result, proc.MASK)
Exemple #22
0
 def test_sanitize_credit_card_amex(self):
     # AMEX numbers are 15 digits, not 16
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', '378282246310005')
     assert result == FILTER_MASK
Exemple #23
0
 def test_does_not_sanitize_timestamp_looks_like_card(self):
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', '1453843029218310')
     assert result == '1453843029218310'
Exemple #24
0
 def test_sanitize_credit_card_discover(self):
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', '6011111111111117')
     assert result == FILTER_MASK
Exemple #25
0
 def test_sanitize_credit_card(self):
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', '4242424242424242')
     self.assertEquals(result, FILTER_MASK)
Exemple #26
0
 def test_sanitize_credit_card_amex(self):
     # AMEX numbers are 15 digits, not 16
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', '424242424242424')
     self.assertEquals(result, FILTER_MASK)
 def test_sanitize_credit_card_mastercard(self):
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', '5555555555554444')
     assert result == FILTER_MASK
 def test_doesnt_scrub_not_scrubbed(self):
     proc = SensitiveDataFilter(include_defaults=True)
     assert proc.sanitize('is_authenticated', 'foobar') == FILTER_MASK
     assert proc.sanitize('is_authenticated', 'null') == 'null'
     assert proc.sanitize('is_authenticated', True) is True
Exemple #29
0
 def test_sanitize_credit_card_visa(self):
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', '4111111111111111')
     assert result == FILTER_MASK
Exemple #30
0
 def test_sanitize_credit_card_amex(self):
     # AMEX numbers are 15 digits, not 16
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', '424242424242424')
     self.assertEquals(result, proc.MASK)
 def test_sanitize_credit_card_amex(self):
     # AMEX numbers are 15 digits, not 16
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', '378282246310005')
     assert result == FILTER_MASK
 def test_sanitize_credit_card_discover(self):
     proc = SensitiveDataFilter()
     result = proc.sanitize('foo', '6011111111111117')
     assert result == FILTER_MASK
 def test_sanitize_credit_card(self):
     proc = SensitiveDataFilter()
     result = proc.sanitize("foo", "4571234567890111")
     assert result == FILTER_MASK