Skip to content

Add typed Access Rule conditions#7962

Draft
Hinton wants to merge 3 commits into
mainfrom
pam/typed-access-conditions
Draft

Add typed Access Rule conditions#7962
Hinton wants to merge 3 commits into
mainfrom
pam/typed-access-conditions

Conversation

@Hinton

@Hinton Hinton commented Jul 10, 2026

Copy link
Copy Markdown
Member

🎟️ Tracking

📔 Objective

📸 Screenshots

Hinton added 2 commits July 10, 2026 16:37
…hierarchies

Explicit selectors scoped to [JsonPolymorphic]/[JsonDerivedType] attributes
instead of Swashbuckle's default assembly-scanning selector, which pulls the
whole ResponseModel tree into the document and collides on same-named
ErrorResponseModel classes. The discriminator name selector falls back to
System.Text.Json's default "$type" so an opted-in hierarchy never emits oneOf
schemas without a discriminator.
…nion

Replaces the verbatim-JSON conditions contract with a typed union of
human_approval and ip_allowlist, discriminated by 'kind':

- 'kind' is accepted at any position (AllowOutOfOrderMetadataProperties),
  matching the SDK's serde tagging; a missing kind binds to the concrete
  base type and is rejected by validation with a structured 400 instead of
  throwing into a 500
- unknown kinds and unknown members fail deserialization (fail-closed 400)
- CidrValidator mirrors the SDK's is_valid_cidr rules, including rejection
  of IPv4-mapped IPv6 CIDRs; null-safe for bound list entries
- cidrs capped at 1-100 entries with a per-entry length cap; validation
  errors are indexed (Conditions[i].Cidrs[j]) and never echo user input
- omitting 'conditions' fails [Required]; an explicitly empty array remains
  valid per the documented contract
@Hinton Hinton changed the title Add typed conditions Add typed Access Rule conditions Jul 10, 2026
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.50350% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.08%. Comparing base (411d38a) to head (1ec6556).
⚠️ Report is 18 commits behind head on main.

Files with missing lines Patch % Lines
...s/Pam/Api/Models/Request/AccessRuleRequestModel.cs 95.38% 2 Missing and 1 partial ⚠️
...c/Services/Pam/Api/Models/Request/CidrValidator.cs 96.92% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7962      +/-   ##
==========================================
+ Coverage   61.49%   62.08%   +0.59%     
==========================================
  Files        2249     2278      +29     
  Lines       99057    99546     +489     
  Branches     8959     9004      +45     
==========================================
+ Hits        60917    61808     +891     
+ Misses      35989    35564     -425     
- Partials     2151     2174      +23     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant