[PR #3296] Allow ALL / AS0 ASN values in public resource policy rules #34672

Open
opened 2026-06-17 04:19:11 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fosrl/pangolin/pull/3296
Author: @Copilot
Created: 6/16/2026
Status: 🔄 Open

Base: devHead: copilot/public-resource-policy-asn-bug-fix


📝 Commits (4)

  • d6fe357 Initial plan
  • 5e26cea fix: allow ALL ASN values in policy rule validation
  • f3a52e3 refactor: normalize ASN validation value once
  • 7c15c42 test: add normalized ASN validation coverage

📊 Changes

3 files changed (+58 additions, -5 deletions)

View changed files

📝 server/lib/validators.test.ts (+41 -1)
📝 server/lib/validators.ts (+4 -1)
📝 src/components/resource-policy/policy-access-rule-validation.ts (+13 -3)

📄 Description

Public resource policies could not be saved when an ASN rule used ALL ASNs (ALL), because validation only accepted AS<number> values. This caused both create and edit flows to reject otherwise valid rules.

  • Validation alignment (client + server)

    • Updated ASN validation in the policy UI schema and backend rule validator to accept:
      • AS<number> (existing behavior)
      • ALL (explicit all-ASN selector)
      • AS0 (server-supported alias)
    • Normalized input via trim().toUpperCase() before evaluation so mixed case and whitespace variants are handled consistently.
  • Rule behavior consistency

    • Brings save-time validation in line with runtime rule evaluation (verifySession) where ALL / AS0 are already treated as wildcard ASN values.
  • Focused coverage

    • Extended validator tests to cover valid ALL, AS0, mixed-case/whitespace variants, and invalid ASN rejection.
const normalizedValue = value.trim().toUpperCase();

return /^AS\d+$/.test(normalizedValue) ||
       normalizedValue === "ALL" ||
       normalizedValue === "AS0"
    ? null
    : "Invalid ASN provided";

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fosrl/pangolin/pull/3296 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 6/16/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `copilot/public-resource-policy-asn-bug-fix` --- ### 📝 Commits (4) - [`d6fe357`](https://github.com/fosrl/pangolin/commit/d6fe357fcb47d5d52bc1509b00abb485a8ae7e7f) Initial plan - [`5e26cea`](https://github.com/fosrl/pangolin/commit/5e26ceaf02587aa310e2b85d15f7a7bd5037e5ce) fix: allow ALL ASN values in policy rule validation - [`f3a52e3`](https://github.com/fosrl/pangolin/commit/f3a52e31d13462c6c3dec905ee603d2ee5c98b83) refactor: normalize ASN validation value once - [`7c15c42`](https://github.com/fosrl/pangolin/commit/7c15c428b341c7f06d14703c07d29ad1ed8109b3) test: add normalized ASN validation coverage ### 📊 Changes **3 files changed** (+58 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `server/lib/validators.test.ts` (+41 -1) 📝 `server/lib/validators.ts` (+4 -1) 📝 `src/components/resource-policy/policy-access-rule-validation.ts` (+13 -3) </details> ### 📄 Description Public resource policies could not be saved when an ASN rule used `ALL ASNs (ALL)`, because validation only accepted `AS<number>` values. This caused both create and edit flows to reject otherwise valid rules. - **Validation alignment (client + server)** - Updated ASN validation in the policy UI schema and backend rule validator to accept: - `AS<number>` (existing behavior) - `ALL` (explicit all-ASN selector) - `AS0` (server-supported alias) - Normalized input via `trim().toUpperCase()` before evaluation so mixed case and whitespace variants are handled consistently. - **Rule behavior consistency** - Brings save-time validation in line with runtime rule evaluation (`verifySession`) where `ALL` / `AS0` are already treated as wildcard ASN values. - **Focused coverage** - Extended validator tests to cover valid `ALL`, `AS0`, mixed-case/whitespace variants, and invalid ASN rejection. ```ts const normalizedValue = value.trim().toUpperCase(); return /^AS\d+$/.test(normalizedValue) || normalizedValue === "ALL" || normalizedValue === "AS0" ? null : "Invalid ASN provided"; ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-06-17 04:19:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/pangolin#34672