Conversation
The resolved dependency tree was clean, but the published `>=` floors let a consumer install versions carrying 34 known advisories. Because this package ships open ranges with no lockfile, the floor is the real exposure -- so the scan covers both the current resolution and the lowest versions the specs permit. Dependency fixes: - aiohttp >=3.14.3 (clears 32 advisories, incl. CVE-2026-69244, an out-of-bounds heap read in the HTTP response parser this client exercises on every call) - pydantic >=1.10.13 (CVE-2024-3772, EmailStr ReDoS; the SDK uses EmailStr) - werkzeug >=3.1.6, pytest >=9.0.3 - drop httpx: never imported, and the only path by which h11 (CVE-2025-43859, CRITICAL) and anyio entered the tree - drop zipp and aioresponses: both unused, and aioresponses 0.7.9 is incompatible with aiohttp 3.14.3 - python_requires >=3.10; the declared >=3.8 was already unachievable Gates: - Trivy over three trees (runtime ceiling, runtime floor, dev), sticky PR comment, blocking on fixable HIGH/CRITICAL only - release split into build -> scan -> publish, so publish is unreachable unless the scan passed - weekly cron posting the findings themselves to Slack, not just a verdict - Dependabot with cooldowns and versioning-strategy: increase - delete release.yml, which raced python-sdk-publish.yml on every release - existing workflows hardened: 48 zizmor findings (12 high) to zero Also fixes 10 minor SDK bugs with 33 offline regression tests. Nine major correctness bugs found along the way are tracked in PER-16174 rather than changed here. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…endent pytest_httpserver's `httpserver` fixture is session-scoped: the first test that requests it binds the one shared server for the entire run. The address override lived in test_rbac_e2e.py, so it only applied when that module happened to touch the fixture first. Adding tests/test_offline_regressions.py broke that assumption -- it sorts earlier, claimed the session server on a random port, and test_api_timeout and test_pdp_timeout then failed against their hardcoded localhost:9999 with "Cannot connect to host". Moving the fixture to conftest.py makes the address apply session-wide and removes the latent ordering dependency, which any future test using httpserver would otherwise have tripped over too. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ations" This reverts commit 160f129.
The one remaining red check is pre-existing — here is the proof
Experiment: pushed commit Result — with the SDK code identical to main, it still fails identically: Corroborated independently: the same test also fails against a local Permit backend + PDP stack built during this work — a completely separate control plane from the shared CI project. Why it fails. The assertion at line 227 expects a role assignment to survive the deletion of the user who owns it: await permit.api.users.bulk_delete([user.key for user in CREATED_USERS])
assignments = await permit.api.role_assignments.list()
assert len(assignments) == len_assignments_original + 1 # (tenant role)The surviving Worth fixing separately — either the test's assumption or the cascade behaviour. Not folded into this PR, which is already larger than it should be. A useful side effect of the same experimentWith So the tests genuinely catch the bugs they target rather than passing vacuously. Two regressions I did introduce, and fixedAdding |
get, get_by_key, update and delete all interpolate their argument straight into the path, and the backend validates it with validate_resource_instance_ident(instance_id, allow_uuids=True) -- a bare instance key is rejected with a 422, not accepted. The docstrings said "the key of the resource instance", which sends callers straight into that error. Wording matches what bulk_delete already documented correctly. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Bumps to 3.0.0 and fixes the nine major bugs tracked in PER-16174, so the
eight permanently-xfail tests can assert for real.
Sync client (permit/utils/sync.py, permit/sync.py):
- SyncClass is now idempotent. It was inherited, so a subclass re-wrapped
methods its base had already converted, giving async_to_sync(async_to_sync(f));
all 21 deprecated-facade methods raised "a coroutine was expected" before
issuing a request.
- Coroutine detection uses inspect.iscoroutinefunction and unwraps
functools/validate_arguments wrappers, instead of assuming every object whose
class is named "function" is async.
- permit.sync.Permit now overrides authorized_users, get_user_permissions and
filter_objects, which were inherited as `async def` over a synchronous
enforcer and returned un-awaitable coroutines.
Enforcement (permit/enforcement/):
- parse_obj_as is imported through the pydantic v1/v2 guard the rest of the
package uses; authorized_users() could not return at all under pydantic v2.
- bulk_check honours a per-check context and filter_objects forwards the
caller's context. It was silently dropped, so context-dependent ABAC
evaluated against {} and could return the wrong subset.
- UserInput accepts snake_case as well as the camelCase aliases; first_name
and last_name were silently discarded from every check.
Serialization (permit/api/base.py):
- dict and list bodies go through the encoder, so nested datetime/UUID/Enum
no longer dies inside aiohttp.
- exclude_none is dropped, so an explicitly-set None is transmitted as null
and an update can clear a field. exclude_unset still omits untouched fields.
Facts proxy (permit/api/tenants.py):
- tenants bulk operations addressed the PDP's users endpoint.
tests/endpoints/test_bulk_operations.py asserted that a tenant role assignment
outlives the user who owns it; deleting the user removes it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The un-xfailed tests all run against one shared environment and were fighting each other: fixed keys (admin, viewer on the built-in __tenant resource), a shared resource urn, assertions on global object counts, and teardown that called pytest.fail on a 404 so "already deleted by another test" turned a passing test red. Several also leaked every object they created. Each test now derives its keys from tests/utils.unique_key, asserts against its own objects rather than environment-wide counts, tears down in a finally via handle_cleanup_error, and polls with a bounded retry where it waits for a fact to reach the PDP. Verified by running twice in a row against a deliberately dirty local environment. test.yml starts the PDP as a step rather than a service container. A service container is created before the first step runs, so it could only be given the long-lived PROJECT_API_KEY while the tests authenticate with the per-run scratch environment key. The PDP rejected every decision with a 403, which is why the ReBAC and RBAC decision tests could never pass. That 403 also surfaced as "cannot connect to the PDP container": the enforcer read error bodies with response.json(), and the PDP sends auth rejections as plain text, so ContentTypeError -- an aiohttp.ClientError -- was caught by the connectivity handler and the real status was lost. Error bodies are now read without assuming JSON, and the message names the status and body. tests/test_abac_pdp.py's three cloud-PDP tests now skip with a reason instead of failing: as CI is configured they never reach the cloud PDP. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The PDP reports 503 on /healthy until its horizon component finishes pulling config and a policy bundle. Waiting for it immediately after docker run made that bootstrap serial with the job; one leg was ready in 29s and the other still was not at 60s. The wait now happens after dependency installation, so the bootstrap overlaps with it, with a 180s ceiling. Changing an ABAC condition set makes the policy generator recompile the environment's rego and redistribute the bundle, which is much slower than the fact sync RBAC uses. test_abac_e2e timed out at 90s against the real cloud PDP; raised to 300s. The poll returns as soon as the rule lands, so a healthy run is no slower. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
setup.py used a bare find_packages(), which ships a TOP-LEVEL `tests` package into every consumer's site-packages where it shadows their own `tests` module. Verified against the published permit==2.8.3, which does exactly that. Now excluded, along with `harness`. permit.pdp_api never passed a timeout to its HTTP client, so the documented pdp_timeout was silently ignored on every permit.pdp_api.* call while the enforcer honoured it. It also duplicated ClientConfig and pagination_params verbatim from permit.api.base; it imports them now. Removed, none of which had a single caller in permit/, tests/ or harness/: set_if_not_none (enforcer), OpaResult and the JWT alias (interfaces), ApiKeyLevel (a self-declared deprecated alias of ApiKeyAccessLevel), LoginAsErrorMessages (never compared against or returned), and three unused TypeVars in the PDP base module. _model_dump was defined identically in both arms of the pydantic version split; hoisted to one definition. Its `mode` parameter stays and stays ignored on purpose -- it absorbs a v2-style argument that pydantic v1's .dict() would reject. Repo cruft: .isort.cfg (isort is not run; ruff's I rules are), uv.lock (a three-line stub declaring requires-python >=3.14, contradicting setup.py), the Makefile publish target (a second release path that bypasses the gated build -> scan -> publish workflow) and a .DEFAULT_GOAL pointing at a help target that did not exist. .gitignore's .DS_Store rule was inert because of an inline comment. Dependencies: dropped pytest-mock (no test uses it) and pytest-cov (coverage is never requested, including in CI). Corrected the werkzeug comment -- it is now a direct test import, not just a pytest_httpserver transitive. Also dropped two references to .trivyignore, which audit-deps.sh deliberately disables with --ignorefile /dev/null, so both were advertising a suppression mechanism that does not work. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
The condition sets and rule this test creates never reach the PDP's policy bundle, so the decision it waits for never becomes true. The PDP says so in the debug.abac payload the SDK already logs: ~90s of no_matching_usersets with "known usersets: ['rules']" (the empty-package placeholder), then one bundle carrying only the condition sets autogenerated by the resource and role creates ten seconds earlier, then nothing for the remaining 300s. The data channel stayed healthy throughout. The pipeline is event-driven with no polling fallback (the default scope is created with poll_updates=False and batching drains rather than waits), so this is a stall, not slowness, and no timeout makes it pass. Skipped rather than xfailed so it reports honestly instead of looking like coverage. Only the three decision assertions are skipped. Everything above them still runs against the real control plane -- condition set and rule create, type round-trip, paginated list, filtered list, permission-format assertion -- and so does the teardown, because pytest.Skipped derives from BaseException and escapes the test's except Exception. Ruled out as causes: resource_id passed as .hex (the generator keys on the resource key, never the id), inline check attributes (they win the object.union_n in the generated rego and the PDP echoed them back), and a missing setup step. No other test is exposed: condition_set_changes.py is the only policy synchronizer handler that generates rego, so RBAC and ReBAC decisions resolve against data.* on the fact channel, and this is the only test that touches condition sets. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
resource_relations.list() declared List[RelationRead], but the route is declared response_model=PaginatedResult[RelationRead], so against current backend main the call raised "ValidationError: value is not a valid list" -- the method was unusable. It now returns PaginatedResultRelationRead; callers read .data. BREAKING, and in the 3.0.0 notes. (That change was written earlier and swept into the previous commit by a bare `git add -A`; this records what it actually is.) Two docstrings corrected against the backend, both of which sent callers into a confusing error: - resource_roles.assign_permissions/remove_permissions said permissions are <resourceKey:actionKey>. A resource role is scoped to its own resource, so each entry is a BARE action key. Passing the qualified form makes the server read the whole string as an action key and reject it with a 404 naming '<resource>:<resource>:<action>' -- a doubled prefix that reads like the SDK concatenated wrongly, when it is the server quoting what it was given. - role_assignments.list(resource_instance_key=...) takes a `resource_type:instance_key` ident or an instance uuid, never a bare key. Regression tests pin the exact wire strings on both pydantic majors. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
Every remaining CI failure was one cause: HTTP 429 on a cleanup call. Enabling the eight previously-xfail tests and giving each its own objects made the suite create and tear down far more than before, and teardown is where the burst lands -- one leg reported 3 failed and 2 teardown errors, the other 7 failed, all of them 429 on a delete. handle_cleanup_error now tolerates 429 alongside 404, for the same reason 404 is tolerated: neither leaves the test's assertions in doubt. A throttled delete leaks an object, and CI deletes the whole scratch environment afterwards, so it is reclaimed. Any other status still fails the test. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
The previous commit tolerated 429 during teardown. That was wrong in a way the next CI run made obvious: a tolerated DELETE leaves the object alive, so the assert-it-is-gone check that follows failed with "DID NOT RAISE PermitApiError". The tolerance manufactured a worse failure than the one it hid. 429 is no longer tolerated. It was also the wrong layer. The run after showed 429 arriving in test BODIES as well -- test_rebac_e2e, test_sync_client and test_user_invites_complete_e2e all failed mid-test -- so cleanup was never the whole problem. The suite runs against one environment on a shared cloud project and now creates and tears down considerably more than it used to, which exceeds the burst limit. The eight tests that were xfail until this branch had been swallowing these 429s all along. conftest wraps the SDK's five HTTP verbs for the test session only, retrying a 429 with exponential backoff so the call actually succeeds. The SDK is untouched: adding implicit retries to a published client would be a behaviour change callers did not ask for. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
Six attempts (~63s of backoff) still ran out on one teardown, leaving CI at 1 failed / 102 passed. Raised to nine, which caps a single call at roughly two minutes of waiting and exits the moment it succeeds. Also honours the server's Retry-After when it sends one, and adds jitter to the exponential fallback so concurrent callers do not retry in lockstep and re-trip the limit together. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
bulk_check() reads each query's context with .get(), so a query without
one is valid at run time, but the TypedDict declared the key as required
and mypy rejected every bulk_check([{"user", "action", "resource"}]) call.
TypedDict comes from typing_extensions so NotRequired is honoured on 3.10.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
The REST API client, the PDP API client and the enforcer sent "bearer <token>". The scheme is case-insensitive per RFC 7235, but "Bearer" is the canonical form every other Permit SDK sends, and at least one server once rejected the lowercase form with a 401. A facade-level offline test now reads the header each client actually puts on the wire. Co-authored-by: Suren <suren@cercli.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
On Python 3.14, pydantic 1.x before 1.10.25 and 2.x before 2.13 crash on
import permit ("unable to infer type for attribute"), so the pydantic
requirement is split by Python version and excludes those releases there.
pydantic 2.0 is excluded everywhere: its pydantic.v1.parse_obj_as rejects
the SDK's __root__ models, failing every parsed API response.
The typing-extensions and loguru floors could not import on current
Pythons (typing-extensions before 4.6 breaks on 3.12+, before 4.12 on
3.13+, 4.12-4.13 lose TypedDict keys on 3.14; loguru before 0.7.3 warns on
3.14), so they rise to 4.14.0 and 0.7.3. deprecation.py uses
inspect.iscoroutinefunction instead of the asyncio one 3.16 removes, and
the pydantic version parser accepts pre-releases such as 2.14.0b2, which
crashed the import.
A new compatibility CI job runs the offline suite on Python 3.10-3.14 at
both the lowest allowed and the newest dependency versions.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
permit now declares itself typed, and type checkers see what actually runs: the SDK models are typed as the pydantic.v1 models they are on both pydantic majors (TYPE_CHECKING import branches, pydantic.v1.mypy plugin), generated model defaults are keyword arguments so optional fields no longer read as required, API methods that accept dicts at runtime accept them in their annotations (typing-only ModelInput/ModelListInput, runtime validation unchanged), and the sync client is typed as synchronous through a generated stub (permit/_sync_types.pyi, with a drift test). The pre-3.14 pydantic floor rises to 1.10.18: 1.10.17 is the first release with the pydantic.v1 package, and 1.10.13-1.10.17 emit about 2,400 DeprecationWarnings on Python 3.13. A consumer fixture is type-checked with mypy --strict in the test suite on every CI leg, and the release and compatibility builds assert the wheel ships py.typed and the stub. Runtime behaviour is unchanged: a snapshot of every public name, signature, validate_arguments model and model field matches the previous commit on both pydantic majors. Co-authored-by: Tarcio Silva <luan.coc13@gmail.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
Under pydantic 2, permit validates emails with the pydantic.v1 copy that pydantic bundles. That copy is fixed for CVE-2024-3772 (ReDoS in email validation) only from pydantic 2.4.2, which bundles 1.10.13: 2.0.1 bundles 1.10.11, and 2.4.0 and 2.4.1 bundle 1.10.12. Below Python 3.14 the spec still allowed 2.0.1-2.4.1. The pre-3.14 requirement is now two lines. Python 3.10-3.12 allow pydantic 2 from 2.4.2. Python 3.13 allows it from 2.8.0, because 2.4.2-2.7.x pin a pydantic-core with no Python 3.13 wheels. The pydantic 1 floor (1.10.18) and the 3.14 line are unchanged. Nothing resolved the pydantic 2 floor before: lowest-direct over requirements.txt picks pydantic 1, so the floor CI legs and the audit's runtime-floor tree only ever saw 1.10.18, and Trivy treats 2.4.0 as fixed. A pydantic-v2-floor compatibility leg on every Python and a runtime-floor-pydantic-v2 audit tree now resolve lowest-direct with pydantic held to >=2, and every format_audit.py call reads the new tree. Every setup-uv step pins uv 0.12.18, so a uv release cannot change which floor is tested or scanned. The offline tests check, per Python, that no allowed pydantic is affected by the CVE and that each major is allowed from its floor up. Part of PER-16176. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
The comment claimed py.typed and _sync_types.pyi ship only because package_data lists them. setuptools 69 and later include them by default; 68.2.2 does not. The project has no [build-system] table, so a build can still run with an older setuptools, which is what package_data guards against. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
The docstrings in tests/test_fix_permissions.py and tests/test_fix_relations.py now state what the API does: how it reads a role's permission strings, which resource_instance filter values it rejects, and the paginated envelope the relations list returns. They no longer point at server source files. The Dependabot cooldown comment no longer names a policy kept outside this repository. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
PYDANTIC_CANDIDATES is now built by explicit loops instead of a triple-nested comprehension. The list is unchanged (931 entries). audit-deps.sh no longer runs mkdir -p on the output directory before writing the pydantic constraint file: compile_tree has already created it at that point. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
GenericEngineDecisionLog sits before DummyEngineModel in both raw_data unions, so its engine literal is the only thing that keeps an OPA or AVP log that fails its own shape from being read as a GENERIC log. No test checked that: widening the literal to str still passed. The new test parses such logs and expects DummyEngineModel. The GENERIC test for AuditLogModel now uses a list-item payload instead of a detailed one, so it no longer carries an objects key that the list model does not declare (PER-14375). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
PER-12884. permit.sync.Permit is kept in step with permit.Permit by hand: SyncPermitApiClient repeats each sub-API property of PermitApiClient without subclassing it, SyncPDPApi inherits any PDP sub-API it does not replace, and permit.sync.Permit overrides each public coroutine of permit.Permit. A sub-API or method added only to the async side reached the blocking client missing or still async, and no offline test noticed. tests/test_typing_surface.py checks each blocking class against the async class it subclasses, and the facade check in tests/test_fix_sync.py covered five hard-coded method names. tests/test_fix_sync_parity.py walks both clients' public surfaces through their properties. It fails when an async path is missing from the sync client or not callable there, when anything reachable from the sync client returns an awaitable, and when the sync client exposes an async API class. A sanity test counts the property objects on permit.api, so a walk that stops descending fails instead of passing without having looked. The new tests cover the five names in test_sync_permit_public_methods_are_not_coroutines, so that test is removed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
PER-12884. Review of tests/test_fix_sync_parity.py found four gaps: - The walk read attribute names from the class only, so a sub-API stored as a public instance attribute on the async client alone went unnoticed. Instance attributes are now compared by name, and by class when they hold an async API. They are not walked into. Callables are left out because a bound method exposes its function's __dict__, where pydantic's validate_arguments keeps helpers such as raw_function. - A property that returned its own object or an ancestor made the walk recurse until RecursionError, which named no property. The walk now records such a property but does not descend into it again. - The sanity test failed on a property whose value has nothing public, such as one returning None. It now expects descent only into values that have public attributes and are not back-references. - The SyncClass check said "async API classes" when it flagged a hand-written blocking class. The test and its message now say the object was not built with SyncClass, which is what the test requires. The module docstring now states what the async checks cannot see: a plain function that returns a coroutine, and an async generator. SyncClass would not convert either. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
tests/conftest.py pinned pytest_httpserver to localhost:9999 so that test_rbac_e2e.py's timeout tests could reach it at a hardcoded address. Two test runs on one machine then fight over the port, and the loser errors at setup with "Address already in use". The plugin already binds an OS-chosen port by default, so drop the override and have the timeout tests ask the server for its URL instead. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
The compatibility job picked its offline tests by file name, so every new offline test module had to match tests/test_fix_*.py or be added to the list by hand, and offline tests living in a credentialed module (the two timeout tests in test_rbac_e2e.py) never ran there. Register an e2e marker and put it on every test that needs PDP_API_KEY, ORG_PDP_API_KEY or PROJECT_PDP_API_KEY and a live Permit API and PDP: a module-level pytestmark where the whole module is credentialed, and per-test marks in test_rbac_e2e.py, which mixes both kinds. The job now runs `-m "not e2e"`, which selects everything the file list did plus those two timeout tests. Without credentials an e2e test fails with a message that names the marker. The required pytest jobs still run all of tests/, so they are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
The user invites e2e fixture deleted its resource instance by its bare key. The API only accepts "resource:key" or the instance id there, so the call was rejected, the fixture logged a warning and the instance was left behind in the shared test environment on every run. Send the full identity, and delete the instance before the tenant and resource it belongs to. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
permit.api.assign_role() and unassign_role() tell callers to move to
permit.api.users.assign_role() and unassign_role(), but they called
role_assignments.assign() and unassign() instead, which use a different
endpoint (/role_assignments rather than /users/{user}/roles). Call the
methods the warnings name, so that switching to the replacement does
not change the request an application sends.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
The 21 flat methods on permit.api (get_user, create_tenant, assign_role and the rest) warned "use permit.api.users.get() instead" with no timeline, so callers could not tell whether migrating was urgent. Each warning now names the method, says it will be removed in permit 4.0 and keeps its replacement, e.g. "permit.api.get_user() is deprecated and will be removed in permit 4.0; use permit.api.users.get() instead." tests/test_fix_deprecated_facade.py checks every method on the async and the blocking client from one table: the exact warning, that the replacement it names does not warn, that both send the same method, path, query and body, and that both return the same parsed model. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
permit.api.resource_actions and permit.api.action_groups had no test that runs without credentials, so a wrong path, query string or body in either would only show up against the live API. Call every public method of both (list, get, get_by_key, get_by_id, create, update and delete) through the async and the blocking client against a local server, and check the request each one sends and the model its response parses into, including model and dict input and a field cleared with null on update. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
test_api_timeout and test_pdp_timeout give the shared httpserver a handler that answers after the client has timed out. The server handles one request at a time, so those answers, and the requests queued behind them, land in the log of whichever test uses the server next. Any test that asserts on httpserver.log and runs right after them fails, and `-m "not e2e"` now runs these two tests in the offline job. Today only alphabetical collection order hides the failure. The handler now waits on an event instead of sleeping. Teardown sets the event and sends one more request to the server. Once that request is answered, every request before it has been too. If the client's timeout ever stops working, the handler still answers after 2s and the test fails quickly. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
The facade test kept only warnings whose message starts with "permit.api.", and it records every warning, which overrides -W error. So a DeprecationWarning raised during either call was dropped. That includes Python 3.14's asyncio.iscoroutinefunction deprecation, which the compatibility job's -W filter exists to catch, and a deprecated replacement with any other message. The facade call must now raise exactly one DeprecationWarning, the 4.0 notice, and the replacement call must raise none. Other categories are still ignored, since a ResourceWarning from garbage collection can land in any test. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
Seven facade methods take a model or a dict: sync_user, create_tenant, update_tenant, create_role, update_role, create_resource and update_resource. Every table row passed a dict, so their model branch (`x if isinstance(x, Model) else Model(**x)`) was never run. Rewriting it as `Model(**x)` raises TypeError for a model, and no offline test failed. Each of those methods now has a second row that passes the model, to both the facade and its replacement. The case id gets a "-model" suffix. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
test_envs.py reads ORG_PDP_API_KEY and PROJECT_PDP_API_KEY with an empty default. Without them, it called the Permit API with an empty token, instead of failing with a message that names the missing variable and the e2e marker, as the shared conftest fixtures do. Both fixtures now fail at setup with that message. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
permit 4.0 drops pydantic 1 (PER-16236). Until then, users on pydantic 1 get no signal that they need to move, so `import permit` now issues one DeprecationWarning on pydantic 1 that names 4.0 and says to upgrade to pydantic 2. It does not fire on pydantic 2. The warning lives in permit/__init__.py because every import of a permit module runs that file first and only once per process. stacklevel=2 attributes it to the line that imported permit, so Python shows it by default when that line is in __main__. The tests import permit in a fresh interpreter, since the test process imported it long before, and check the count, category, text and the file and line the warning points at. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
Both deprecations warn at runtime, but a DeprecationWarning is hidden by default outside __main__, so many users would never see one. The README now lists what 4.0 removes (pydantic 1 support and the flat methods on permit.api), what to use instead, and how to make the warnings visible. It also notes a change permit users see when they move to pydantic 2: model validation errors become pydantic.v1.ValidationError. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
permit/__init__.py has no __all__, so the plain `import warnings` added for the pydantic 1 deprecation made `from permit import *` bind the standard-library module, and `permit.warnings` showed up in dir() and autocomplete. Importing it under a private name keeps the package's public names as they were. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
The pydantic 1 warning is attributed to the line that imports permit. When that line is in an application module, such as a web app that a server imports, Python hides it by default, and those users often do not control the python command line. The README now also names the PYTHONWARNINGS variable. On pydantic 1, a setup that turns DeprecationWarning into errors but ignores permit's own modules, or errors only on __main__, now fails at the consumer's import. The README gives the filter that silences the warning until they upgrade. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
pip-audit has not produced a report on any Security run so far, and the only sign of that was a log warning and a fenced note in the PR comment. The weekly Slack message did not mention it at all, so a Monday run with no pip-audit coverage read the same as one with full coverage. format_audit.py now takes one --pip-audit LABEL=PATH per dependency tree, like the Trivy reports, and tags each finding with its tree. A report that is missing, empty, unparseable or lists no packages, and any package pip-audit skipped, is a gap. Gaps are named under a "pip-audit did not check everything" heading in the PR comment and job summary, and in a line of their own in the Slack message. They still never fail the gate. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
pip-audit has never produced a report in CI. Given a requirements file it resolves it again inside a throwaway venv, and creating that venv fails in ensurepip on the runner's uv-managed Python. The job still passed, with a single log warning, so Trivy was silently the only scanner. Every tree is already a pinned `uv pip compile` output, so pip-audit now reads the pins as written (--no-deps --disable-pip) and never creates a venv. It runs on all four trees rather than the runtime ceiling alone, pinned to pip-audit 2.10.1, and writes pip-audit-<tree>.json for each. pip-audit exits 1 both when it finds an advisory and when it fails, and the old step deleted the report on any non-zero exit, so a run with findings would have lost them too. Each report is now deleted before its run and kept whatever the exit code; a missing report is the failure signal, and the renderer names that tree. pip-audit keeps an advisory's aliases in a set, so their order changes from run to run. The finding id is built from them, so the same advisory showed up once per tree. They are sorted now. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
upload-artifact v5.0.0, download-artifact v6.0.0 and slack-github-action v2.1.0 all declare runs.using: node20, so every job that used them ended with the Node 20 deprecation warning, and their bundled code printed DEP0040 (punycode), DEP0169 (url.parse) and DEP0005 (Buffer()). - actions/upload-artifact v7.0.1 - actions/download-artifact v8.0.1 - slackapi/slack-github-action v4.0.0 All three run on node24 and declare every input these workflows pass. download-artifact v8 unzips only when the blob is served as a zip, which upload-artifact v7 sets, so the two move together; a named artifact still extracts straight into `path`, so /tmp/audit and dist/ are unchanged. slack-github-action v4 parses YAML payloads more strictly across line breaks; the payload here is one `text:` line built by toJSON. download-artifact v8.0.1 still bundles an unzip library that calls Buffer(), and there is no newer release (actions/download-artifact#484). Its steps set NODE_OPTIONS=--disable-warning=DEP0005, which hides that one warning and nothing else. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
pre-commit/action v3.0.1, its latest release, uses actions/cache@v4, which targets Node 20, so every pre-commit run ends with the Node 20 deprecation warning. The action has had no release since 2024. The job now runs the same steps itself: install pre-commit (pinned to 4.6.2), restore ~/.cache/pre-commit with actions/cache v6.1.0 (node24) under the same key, and run `pre-commit run --show-diff-on-failure --color=always --all-files`. The job id stays `pre-commit`, which is a required status check on main. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
rhysd/actionlint has no action.yml. The runner builds the repository's Dockerfile and runs actionlint with no arguments, so the only inputs it accepts are the implicit entryPoint and args, and every run warned "Unexpected input(s) 'fail-on-error'". The input was never read. Nothing else changes: actionlint exits 1 on any finding and the runner fails a container step on a non-zero exit. Built from the pinned commit and run the same way against a workflow with a missing `needs:` job and an undeclared checkout input, the container exits 1; against this repository it exits 0. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
Audit Script Tests installs pytest alone, but pytest walked up from .github/scripts to the repository's pytest.ini and warned on every run: "PytestConfigWarning: Unknown config option: asyncio_mode". That option belongs to pytest-asyncio, which only the SDK's tests use. .github/scripts/pytest.ini is now the first config pytest finds for these tests, with no command-line flag needed. It sets filterwarnings = error so a warning fails the job instead of scrolling past, and the job pins pytest 9.1.1 so a new pytest release cannot fail it on its own. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
Every job carried a notice that ubuntu-latest moves to Ubuntu 26 from October 19, 2026. Pinning ubuntu-24.04 keeps the image these workflows run on today (ubuntu-latest resolves to ubuntu-24.04 now), so the move becomes a deliberate change here rather than one that arrives unannounced under an unchanged workflow. No step changes: the tools they call (shellcheck, docker, jq, curl) are the ones the current image has. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
The Comment on PR step ran only when hashFiles('/tmp/audit/comment.md')
was non-empty. hashFiles ignores every file outside the workspace, so the
guard was always false and no audit comment ever reached a PR, including
the pip-audit gap notice that is meant to appear there.
The step now runs whenever the artifact downloads, and the script checks
the report itself. A report that is missing or does not start with the
marker means the render step did not finish: the step warns and posts
nothing. A report over GitHub's 65,536-character comment limit would be
rejected, so the comment then links to the job summary instead.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
audit-deps.sh gave pip-audit a temporary --cache-dir, saying it kept pip-audit away from the runner's pip HTTP cache. pip-audit 2.10.1 never uses pip's cache for its vulnerability lookups: its services build their session with use_pip=False, so without --cache-dir it already uses its own directory, which is empty on a fresh runner. The mktemp, the flag and the cleanup did nothing and the comment explaining them was wrong. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
The Slack line joined the gap labels as they were, so it read "pip-audit did not fully check pip-audit:dev-ceiling, pip-audit:runtime-floor". It now drops the scanner prefix and names the trees alone. The test covers two trees, one of them with two gaps, and checks the whole line. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
The Install Trivy step runs trivy-action only to install Trivy, and the action always scans scan-ref. The repo root has nothing Trivy can scan, so every Dependency Audit and Security Gate run logged "WARN [report] Supported files for scanner(s) not found". hide-progress sets TRIVY_QUIET, which drops that warning along with the INFO lines and the DB progress bar. Fatal errors still print (checked with Trivy 0.70.0, the version the action installs). The step comment also said the step warms Trivy's vulnerability DB for the real scan. It does not: the action sets TRIVY_CACHE_DIR only inside its own step, so audit-deps.sh uses Trivy's default cache and downloads its own DB. The comment now says only what the step does. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
The trigger comment said Dependency Audit was only meant to become a required check and that a red audit did not block a merge. Branch protection on main already requires Dependency Audit, Audit Script Tests and Workflow Hardening, so the comment now says that. It also dropped the "warm Trivy DB" timing, since the audit's scans download their own DB. The Slack guard's comment said the repository had no SLACK_WEBHOOK_URL. The secret is set and the weekly run posts, so the comment now says what the guard is for: a repository or fork without the secret gets a warning rather than a failed job. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F6b4ERDYYZ8NRTv1zJYxx2
Dependency Security AuditScanned: requirements.txt + requirements-dev.txt, resolved at Python 3.10 (the current resolution, and the lowest versions the published specs permit under each pydantic major) ✅ No known vulnerabilities found. Both the resolved dependency set and the lowest versions the published specs permit are clean at HIGH and CRITICAL. |
Linear issue
PER-16176 · fixes PER-16174, PER-16231 · follow-ups: PER-16177, PER-16209, PER-16236
Why
This started as a CVE fix and became the 3.0.0 release.
CVEs.
permitio/permit-pythonhad no dependency scanning and no gate on PRs or releases. The resolved dependency tree was clean. All the exposure was in the floors: the package publishes open>=ranges with no lockfile, soaiohttp>=3.12.14legitimately resolves to 3.12.14 and a consumer inherits every CVE fixed since. That was 34 advisories acrossaiohttp,h11,anyioandpydantic. A scanner pointed at what CI installs reports all green.Correctness. Nine major bugs turned up along the way (PER-16174). Among them: context-dependent ABAC checks evaluated against an empty context,
authorized_users()could not return under pydantic v2, and the sync client's deprecated facade raised before issuing any request. They survived because 8 of the e2e tests had been@pytest.mark.xfailfor about two years. Since the Python floor already had to move (below), this ships as a major version that fixes them properly.Open backlog. Every open issue and community PR was triaged against this release. The real, still-present ones are fixed here:
import permitcrashed on 3.14 with the pydantic versions the old ranges allowed.Authorization: bearer: the SDK sent a lowercase scheme; it now sends the standardBearer.py.typedmarker a contributor proposed is shipped here together with the typing fixes that make it safe; on its own it would have produced false errors on valid code.The other open items are already fixed or superseded. They will be closed with an explanation once this ships.
Breaking changes
All of these need a line in the release notes.
Compatibility
python_requires>=3.10). This can't be avoided: aiohttp 3.14.3 is the only release that fixes CVE-2026-69244, and it requires 3.10. 3.8 was already unsupported in practice, since the old aiohttp floor needed 3.9. A 3.9 user who runspip install -U permitgetsRequires-Python >=3.10, and pip quietly keeps the old, vulnerable version.httpxis no longer installed transitively, and neither areh11,httpcore,anyioorzipp. The SDK never importedhttpx. Anyone who relied onpermitpulling it in must now declare it themselves.pydantic:>=1.10.18,<2or>=2.4.2on Python 3.10–3.12;>=1.10.18,<2or>=2.8.0on 3.13;>=1.10.25,<2or>=2.13on 3.14.DeprecationWarnings on 3.13; it also ships thepydantic.v1package the type hints need.pydantic.v1copy that pydantic bundles, and only 2.4.2 and later bundle one fixed for CVE-2024-3772 (1.10.13). pydantic 2.0 exactly also fails every parsed response: itspydantic.v1.parse_obj_asrejects__root__models.pydantic-corewith no Python 3.13 wheels; 2.8.0 (pydantic-core2.20.0) is the first that has them.import permit("unable to infer type for attribute").typing-extensions:>=4.14.0. Releases before 4.6 breakimport permiton 3.12+, releases before 4.12 break it on 3.13+, and 4.12–4.13 loseTypedDictkeys on 3.14.loguru:>=0.7.3. Earlier releases warn on 3.14 about an asyncio API that Python 3.16 removes.permitis now a typed package (PEP 561py.typed). Type checkers used to skippermitwithimport-untyped; now they check calls into it.ignore_missing_importsor# type: ignore[import-untyped]forpermit, but genuine type errors in their code may now surface..model_dump()on an SDK model now fail type checking; they already failed at runtime.pydantic.v1.mypyplugin; no plugin is needed.API
resource_relations.list()now returnsPaginatedResultRelationRead, so callers read.data.permit.sync.Permit.authorized_users(),get_user_permissions()andfilter_objects()are now synchronous. Callers should drop theawait.ContextStore.register_transform(),ContextStore.transform()andContextTransform. A registered transform was never applied, so these did nothing.ApiKeyLevel, a deprecated alias ofApiKeyAccessLevel.LoginAsErrorMessages,OpaResultand theJWTalias. None of them had a caller.Wire behaviour (same API, different bytes). Each change was checked against the API's request definitions:
Noneis now sent asnull, so an update can clear a field. Before,exclude_nonedropped it:users.update(key, UserUpdate(email=None))sent{}and quietly did nothing. Fields you never set are still omitted.users.assign_role/unassign_roleomit unset fields, matchingrole_assignments.assign. The API treats an omitted field andnullthe same for these fields.elements.login_assends canonical hyphenated UUIDs instead of 32-character hex. The API accepts both spellings and resolves them to the same record.Authorizationheader usesBearer, notbearer. The scheme is case-insensitive (RFC 7235), so nothing breaks; it is listed because the bytes on the wire change.Kept on purpose:
PermitConnectionErrorstill inherits from the deprecatedPermitException. Moving it underPermitErrorwould silently stopexcept PermitExceptionfrom catching connection failures.What changed
Dependency CVE fixes
aiohttp>=3.12.14,<4>=3.14.3,<4pydantic>=1.10.7>=1.10.18,<2or>=2.4.2(Python 3.10–3.12);>=1.10.18,<2or>=2.8.0(3.13);>=1.10.25,<2or>=2.13(3.14)pydantic.v11.10.13: pydantic 1.10.13+, or pydantic 2.4.2+ whose bundled v1 is fixed; the higher floors are compatibility fixes (breaking change 3). Dual v1/v2 support is kepttyping-extensions>=4.5.0,<5>=4.14.0,<5import permiton 3.12+ (breaking change 3)loguru>=0.7.0,<1>=0.7.3,<1httpx>=0.24.1,<1h11(CVE-2025-43859, CRITICAL) andanyio(CVE-2026-63374, CRITICAL) got into the treezipp>=3.19.1werkzeug(dev)>=2.3.8>=3.1.6pytest(dev)>=9.0.3aioresponses,pytest-mock,pytest-cov(dev)aioresponses0.7.9 is also incompatible with aiohttp 3.14.3Every dev dependency now has a floor. Without one, a scanner has nothing to evaluate.
Major bug fixes (PER-16174)
SyncClassnow wraps each method exactly once, however deep the inheritance goes; the facade methods had been wrapped twice, so they raised before sending anything. It detects coroutines withinspect.iscoroutinefunction, unwrappingvalidate_argumentsfirst.permit.sync.Permitoverrides the three enforcement methods it was missing.parse_obj_asis imported through the same v1/v2 guard the rest of the package uses.bulk_checkhonours a per-checkcontext, andfilter_objectspasses the caller's context through.CheckQuery.contextisNotRequired, so type checkers accept abulk_checkquery without a context, as the runtime always has.UserInputaccepts snake_case, sofirst_name/last_nameare no longer silently dropped from every check.datetime/UUID/Enumno longer crashes inside aiohttp.exclude_noneis gone.Python 3.14 support
Programming Language :: Python :: 3.14) and tested. The dependency floors above keep resolvers from picking versions that crash on 3.14.permit/utils/deprecation.pyusesinspect.iscoroutinefunctioninstead of the asyncio one, which 3.16 removes. This removes 21 import-time warnings on 3.14.2.14.0b2. They used to crashimport permitwith aValueError.compatibilityCI job runs the offline suite on Python 3.10–3.14 against the lowest allowed dependency versions (uv pip compile --resolution lowest-direct), the lowest allowed pydantic 2 (lowest-direct with apydantic>=2constraint) and the newest, plus 3.14 on pydantic 1. uv is pinned to 0.12.18. It is not a required check, so the existing requiredpytestcontexts are unchanged.Typed public surface
if TYPE_CHECKING:branch, and mypy uses thepydantic.v1.mypyplugin.Field(default=...)), so optional fields no longer read as required to pyright and Pylance.generate-modelspasses--use-default-kwarg.ModelInput/ModelListInputwiden the type for type checkers only; at runtime the parameter is still the model, so an invalid dict still fails validation before any request is sent.permit/_sync_types.pyi, built byscripts/generate_sync_stubs.py(make generate-sync-stubs). A test fails if the stub drifts from the async classes.mypy --strictand pyright:stris accepted forEmailStrfields;UserInputaccepts both field spellings;permit/__init__.py;deprecated()keeps the decorated signature;PermitConfig()without atokenis now a type error, as it already was at runtime.permit/py.typedand the stub ship in the wheel and sdist, and both the release build and one compatibility leg assert that they do. The README has a short "Type checking" section.@validate_argumentsmodel and model field (defaults and aliases included) matches the previous commit on both pydantic majors and on Python 3.11 and 3.14.Minor bug fixes
every client now sends
Authorization: Bearer(wasbearer), checked on the wire by an offline test ·resource_instances.list(detailed_key=True)always raised ·users.sync()mutated the caller's dict and removed thekeyfield the API requires, so that path always returned 422 ·SyncPDPApinever calledsuper().__init__·pdp_timeoutwas silently ignored by everypermit.pdp_api.*call · a dead access-level branch that could never run was removed · docstrings corrected: resource-instance idents areresource:keyor a uuid, never a bare key; a resource role's permissions are bare action keys likeread.Packaging and cleanup
setup.pyno longer ships a top-leveltestspackage to consumers. A barefind_packages()put it in their site-packages, where it shadows their owntestsmodule. The publishedpermit==2.8.3does this today.ClientConfig/pagination_paramscode inpdp_api, a duplicate_model_dump, and unused TypeVars and helpers..isort.cfg(isort isn't run), a stubuv.lockdeclaringrequires-python >=3.14, and the Makefilepublishtarget, which bypassed the gated release. Fixed the Makefile's.DEFAULT_GOAL, which pointed at a target that didn't exist. Fixed a.gitignorerule that did nothing.CVE gates
Dependency Auditruns Trivy over four resolved trees: runtime ceiling, runtime floor, runtime floor with pydantic held to 2, and dev.test_pydantic_requirement_allows_no_release_affected_by_cve_2024_3772is what blocks pydantic 2.0–2.4.1; the tree gives visibility.==pins and keys on the filenamerequirements.txt, so the trees are compiled withuv pip compile. It also writesResults: nulland exits 0 when it finds nothing to scan, so that case is detected and fails the gate.mypypulledtyping-extensionsup and hid the version a consumer can actually get.setup.pycode never runs in a job that holds a write token.build → scan → publishwith hardneeds:edges, so publish can't run unless the scan passed. The gate covers the runtime trees only.SLACK_WEBHOOK_URLisn't set.pip-auditruns alongside Trivy but only reports and never blocks, because it gives no severity.versioning-strategy: increaseis required. With asetup.pypresent, Dependabot's defaultwidenwould never raise a>=floor.Workflow hardening
persist-credentials: falseeverywhere, least-privilegepermissions:, template injection removed, and the release-tag validation now checks the whole string.release.yml. It ran onrelease: createdwhilepython-sdk-publish.ymlran onpublished, so every release uploaded the same version twice.PROJECT_API_KEY. The tests authenticate with the per-run environment key, the PDP rejected every decision with a 403, and that is why the RBAC/ReBAC decision tests could never pass.Test suite
xfailmarkers removed. Those tests now run and pass.admin,viewer, a sharedurn), assert environment-wide counts, and fail the test when cleanup got a 404. Each test now uses unique keys, asserts only on its own objects, and tolerates "already gone" during teardown.conftestfor the test session only. Requests retry with backoff, honourRetry-After, and add jitter. The xfail markers had been hiding these 429s. The SDK itself doesn't retry: adding hidden retries to a published client would change behaviour callers never asked for.test_bulk_operationsfixed. It expected a role assignment to survive deleting the user who owns it.httpserver_listen_addressmoved toconftest.py. Its port had depended on which test file pytest collected first.Architectural changes
No architectural change to the SDK. The release job graph changes:
flowchart TD subgraph After["After: publish is unreachable without a passing scan"] B2["build: version, sdist and wheel"] --> S2["scan: compile trees, Trivy, gate"] S2 --> P2["publish: PyPI"] end subgraph Before["Before: two workflows raced"] R1["release.yml on 'created'"] --> PY1["twine upload"] R2["python-sdk-publish.yml on 'published'"] --> PY2["pypi-publish"] endHow it was tested
CI: all 26 checks are green:
151 passed, 4 skippedon both required pydantic legs. At the start of this PR it was 45 passed with 8 permanently xfail.compatibilitylegs (Python 3.10–3.14: lowest dependencies, lowest pydantic 2, newest dependencies, plus 3.14 on pydantic 1) are green.The 4 skips:
test_abac_e2e, waiting on PER-16209. The control-plane half of that test still runs.End-to-end harness (internal) against a local Permit stack with a real
permitio/pdp-v2:58 passed, 0 failed, 0 skipped, with 95 data-integrity round-trips and 0 differences.Against the API: every wire-affecting change was checked against the API's route and request/response definitions. Every one was safe.
Offline:
permit/makes them fail.mypy --strictas part of the suite, and also passes pyright strict against the installed wheel. Each typing fix was mutation-checked: undoing any one of them makes the fixture fail.The gate itself: it fails (exit 1) on the old vulnerable floor and passes (exit 0) on the fixed one.
Manual test plan
Dependency Auditposts a sticky comment on this PR.aiohttp>=3.12.14,<4. The check should go red and the comment should list CVE-2026-69244. Revert it.gh workflow run security.ymlto try the Slack path onceSLACK_WEBHOOK_URLis set.pip installthis branch and runmypy --stricton code that usespermit.Permitandpermit.sync.Permit. Expect no errors, and sync calls typed as their results rather than coroutines.Blast radius and isolation
permit;Follow-ups
Already applied outside the diff: secret scanning with push protection, Dependabot security updates, and
Dependency Audit/Audit Script Tests/Workflow Hardeningadded as required checks onmain.Still open:
SLACK_WEBHOOK_URL. Until it's set, nobody gets the weekly results.Scope and size
permit/_sync_types.pyicomes on top.🤖 Generated with Claude Code