{"id":21789,"library":"pysealer","title":"PySealer","description":"PySealer (v1.0.4) cryptographically signs Python functions and classes to provide defense-in-depth security against code injection and tampering. It allows developers to seal callables with HMAC signatures verified at runtime. Active development on GitHub, monthly releases.","status":"active","version":"1.0.4","language":"python","source_language":"en","source_url":"https://github.com/MCP-Security-Research/pysealer","tags":["cryptography","security","signing","integrity","code-protection"],"install":[{"cmd":"pip install pysealer","lang":"bash","label":"default"}],"dependencies":[],"imports":[{"note":"Correct import path for v1.0.x","symbol":"seal","correct":"from pysealer import seal"},{"note":"Verification function for sealed objects","symbol":"verify","correct":"from pysealer import verify"}],"quickstart":{"code":"from pysealer import seal, verify\nimport os\n\nkey = os.environ.get('SEAL_KEY', 'default-secret')\n\n@seal(key=key)\ndef safe_add(a, b):\n    return a + b\n\n# Verify and call\nresult = verify(safe_add, key=key)(2, 3)\nprint(result)  # 5","lang":"python","description":"Seal a function with HMAC key and verify before execution."},"warnings":[{"fix":"Use a named function or class defined via def or class statement.","message":"The `seal` decorator only works on plain functions and classes, not lambdas, partials, or built-in functions.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Store the key safely (e.g., environment variable, secrets manager) and never hardcode in source.","message":"If the key is lost, sealed objects become permanently unusable — there is no recovery or backdoor.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Replace `seal_with_env_var('MY_KEY')` with `seal(key=os.getenv('MY_KEY'))`.","message":"The function `seal_with_env_var()` is deprecated and will be removed in v2.0. Use `seal(key=os.getenv('KEY'))` instead.","severity":"deprecated","affected_versions":">=1.0.0 <2.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `verify(sealed_func, key=key)` instead of `sealed_func.verify(key)`.","cause":"Calling verify incorrectly; it's a standalone function, not a method.","error":"AttributeError: 'function' object has no attribute 'verify'"},{"fix":"Ensure the same key string is passed to both `seal` and `verify`.","cause":"Key used to verify does not match the key used to seal.","error":"ValueError: Invalid signature"},{"fix":"Use `@seal(key='your-key')` instead of bare `@seal`.","cause":"Calling seal() without the key argument.","error":"TypeError: seal() missing 1 required positional argument: 'key'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}