Skip to content

bug(auth): preserve security alternatives and combinations #122

Description

@samzong

Summary

OpenAPI security requirements can express alternatives between requirement objects and combinations of multiple schemes within one requirement. Lathe currently removes the scheme names and flattens all scopes into one list, so the generated catalog and runtime cannot preserve those semantics.

Reproduction

Use an operation whose security declaration contains:

  • two Security Requirement Objects, meaning either credential set may satisfy the operation; or
  • one Security Requirement Object containing two schemes, meaning both are required.

Generate the CLI and inspect commands show ... --json.

Actual behavior

  • internal/codegen/rawir.RawSecurityReq stores only scopes.
  • Backend conversion iterates each map but discards every security scheme identifier.
  • internal/codegen/normalize/normalize.go::deriveSecurity merges all scopes into one sorted slice.
  • pkg/runtime.SecurityHint exposes only Public and Scopes.
  • Runtime host configuration constructs one authenticator rather than selecting a satisfiable alternative or applying a required combination.

Expected behavior

The generated contract should preserve scheme identity, alternative requirements, and required combinations. Runtime execution should select a satisfiable alternative and apply every scheme required by that alternative. Catalog and Skill output must expose the same requirement structure to agents.

Acceptance criteria

  • IR and generated specs distinguish OR alternatives from AND combinations.
  • Scheme names and locations survive parsing without exposing credential values.
  • Anonymous alternatives are represented correctly.
  • Runtime fails before sending when no alternative is satisfiable.
  • Tests cover bearer/API-key alternatives and a two-scheme combination.
  • Any catalog or generated schema change is versioned explicitly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions