C-6: ConnectorRuntime enforces capability_mask per operation.
READ-only ACs cannot invoke MUTATE operations (wipe, lock, retire).
C-7: AC validated against database (exists, active, not expired)
before connector invocation.
C-9: Delegated AC capability bounded by delegator's capability.
C-10: Command counter uses atomic SQL increment with limit check.
M-23: expire_stale() uses same atomic SQL pattern.
H-1: Sensitive credential fields hidden from repr/logs via repr=False.
H-2: Stub backend requires ALLOW_STUB_CREDENTIALS=true to activate.
H-3: Kerberos backend raises CredentialResolutionError instead of
returning stub ticket.
H-4: Chronicle INTENT emitted before execution, RESULT after.
H-5: device_id validated as UUID before Graph API URL interpolation.
H-8: ConnectorRuntime enforces governance for all connector invocations.
Signed-off-by: Tyler King <tking@guildhouse.dev>
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
"""Provides a function to report all internal modules for using freezing
|
|
tools."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from collections.abc import Iterator
|
|
import types
|
|
|
|
|
|
def freeze_includes() -> list[str]:
|
|
"""Return a list of module names used by pytest that should be
|
|
included by cx_freeze."""
|
|
import _pytest
|
|
|
|
result = list(_iter_all_modules(_pytest))
|
|
return result
|
|
|
|
|
|
def _iter_all_modules(
|
|
package: str | types.ModuleType,
|
|
prefix: str = "",
|
|
) -> Iterator[str]:
|
|
"""Iterate over the names of all modules that can be found in the given
|
|
package, recursively.
|
|
|
|
>>> import _pytest
|
|
>>> list(_iter_all_modules(_pytest))
|
|
['_pytest._argcomplete', '_pytest._code.code', ...]
|
|
"""
|
|
import os
|
|
import pkgutil
|
|
|
|
if isinstance(package, str):
|
|
path = package
|
|
else:
|
|
# Type ignored because typeshed doesn't define ModuleType.__path__
|
|
# (only defined on packages).
|
|
package_path = package.__path__
|
|
path, prefix = package_path[0], package.__name__ + "."
|
|
for _, name, is_package in pkgutil.iter_modules([path]):
|
|
if is_package:
|
|
for m in _iter_all_modules(os.path.join(path, name), prefix=name + "."):
|
|
yield prefix + m
|
|
else:
|
|
yield prefix + name
|