Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Our linter's "safe" autofix would have silently disabled RBAC

Description and use

An auto‑fix linter can silently disable RBAC in an AI agent by altering a type annotation. A guard test ensures the annotation remains exact to prevent this.

Problem

A type annotation change that appears harmless can silently disable role‑based access control (RBAC) in a LangChain‑based AI agent, allowing privileged actions to run as admin.

Outcome

Adding a guard test that validates the exact type annotation prevents accidental RBAC bypass caused by automated linting fixes.

Workflow

  • 1. Identify functions with config: Annotated[..., InjectedToolArg] parameter.
  • 2. Run a static scanner to ensure the type is exactly RunnableConfig.
  • 3. Build a tool instance for each spelling (bare, widened, optional_form).
  • 4. Assert that the bare form receives injected config and the others do not.
  • 5. Add the guard test to CI pipeline.
  • 6. Keep a comment explaining the rule for developers.
  • 7. Monitor for framework changes that alter type matching logic.

Evidence

The guard is a test that asserts the annotation itself. It scans every config: Annotated[..., InjectedToolArg] parameter in the source and fails if any is not bare RunnableConfig.

Source

Plain ruff check --fix — the command people run without reading the diff — converts a working authorization boundary into a no‑op.

Source

  • Record date: 2026-09-22T08:15:41.077Z