policy
๐ค AI-Generated Content
This documentation was generated with AI assistance and is still being audited. Some, or potentially a lot, of this information may be inaccurate. Learn more.
flavor.config.policy
¶
FlavorPack launch-time policy: schema, parsing, and merge logic.
Classes¶
EffectivePolicy
¶
Merged policy: the stricter of package + operator wins per field.
EnforcementPolicy
¶
OperatorPolicy
¶
Operator overlay from policy.json.
PackagePolicy
¶
Constraints declared by the package builder in pyproject.toml.
Functions¶
enforce_policy
¶
enforce_policy(
policy: EffectivePolicy,
build_timestamp: int,
has_sbom: bool,
key_trusted: bool,
) -> list[str]
Enforce the effective launch policy for the current runtime environment.
Returns a list of warning messages for checks in 'warn' mode. Raises ValueError for checks in 'deny' mode. Checks in 'allow' mode are silently skipped.
Source code in flavor/config/policy.py
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | |
get_current_platform
¶
Return the normalized FlavorPack platform string for the current host.
Source code in flavor/config/policy.py
is_privileged_user
¶
Return True when the current process is privileged/root.
load_operator_policy
¶
Load the operator policy file(s).
System policy is loaded first, then user policy overrides it. If neither file exists, returns a permissive default.
Source code in flavor/config/policy.py
merge_policy
¶
Merge package-declared and operator policies. Stricter always wins.
Source code in flavor/config/policy.py
parse_package_policy
¶
Parse [tool.flavor.policy] dict from pyproject.toml into a PackagePolicy.