MCPcopy
hub / github.com/authlib/authlib / check_sensitive_data

Method check_sensitive_data

authlib/jose/rfc7519/jwt.py:41–51  ·  view source on GitHub ↗

Check if payload contains sensitive information.

(self, payload)

Source from the content-addressed store, hash-verified

39 self._jwe = JsonWebEncryption(algorithms, private_headers=private_headers)
40
41 def check_sensitive_data(self, payload):
42 """Check if payload contains sensitive information."""
43 for k in payload:
44 # check claims key name
45 if k in self.SENSITIVE_NAMES:
46 raise InsecureClaimError(k)
47
48 # check claims values
49 v = payload[k]
50 if isinstance(v, str) and self.SENSITIVE_VALUES.search(v):
51 raise InsecureClaimError(k)
52
53 def encode(self, header, payload, key, check=True):
54 """Encode a JWT with the given header, payload and key.

Callers 1

encodeMethod · 0.95

Calls 1

InsecureClaimErrorClass · 0.85

Tested by

no test coverage detected