Commit Graph
134 Commits
Author SHA1 Message Date
Blacks-Army 8e2f9ea5ef Add HTTP method matching to resource rules
Resolves #1408.

A rule with match "METHOD" carries a comma-separated list of HTTP
methods in its value, e.g. "POST,PUT", and applies when the request
method is in that list. This makes it possible to leave GET public
while sending POST and PUT to auth, which rules could not express
before because both share the same path.

No new columns: the methods live in the existing rule value, so this
needs no migration and every existing rule keeps working unchanged.

The UI offers the ten registered methods. Blueprints and the API
accept any method token, so extension methods such as the WebDAV verbs
can be targeted too, and the UI preserves them when a rule set that
way is edited later.
2026-09-19 20:00:01 +02:00
miloschwartz aed325f273 switch to lru in memory cache and dont cache failed sessions 2026-09-14 16:48:07 -04:00
miloschwartz 0a8b5e46ca Bind share link sessions to the token's own resource 2026-08-17 14:24:21 -04:00
Owen 125091d719 Send email whitelist user downstream headers
Fix #1226
2026-08-14 10:51:59 -04:00
miloschwartz c33fa8782b Merge branch 'aig' of https://github.com/fosrl/pangolin into aig 2026-08-12 12:35:30 -04:00
miloschwartz 93cba1d098 support sending capability specific error codes 2026-08-12 12:34:25 -04:00
Owen d3a1f9798d Merge branch 'aig' of github.com:fosrl/pangolin into aig 2026-08-12 11:45:28 -04:00
miloschwartz 115c3cbf07 show sso page in browser for gateway resource 2026-08-12 11:32:22 -04:00
Owen bed5817da3 send, process, store, display virtual api key ai information in usage and sessions 2026-08-12 11:20:25 -04:00
miloschwartz 83035753af support bypass auth rules on gateway 2026-08-12 11:18:16 -04:00
miloschwartz 379b53bcca redirect to api key page when access gateway in browser 2026-08-12 11:15:50 -04:00
miloschwartz 49020fa6ea add virtual api key validation in verifySession 2026-08-12 10:38:26 -04:00
Owen 1a644b131d Pull the session cookie properly 2026-08-04 10:15:49 -04:00
Owen f079714caf Dont redirect when the browser agent is not real 2026-08-04 10:07:52 -04:00
Owen 9e2ec72ced Fix missing resource id in cache 2026-07-18 16:15:30 -04:00
miloschwartz bb9b94a983 add persistent session and users to access tokens 2026-07-17 13:39:09 -04:00
Owen 6d129c0738 Fix #3099 2026-07-08 21:44:20 -04:00
Fred KISSIE 1bd6f240cc ♻️ add Country is not rule to verifySession 2026-06-26 23:18:46 +02:00
kshitijshresth b136bd2246 Escape regex metacharacters in PATH rule wildcard matching
isValidUrlGlobPattern accepts characters like ( ) [ ] { } | . + ^ $ in PATH rule values, but isPathAllowed converted wildcard segments to regex without escaping them. A rule value such as /(api* produced an invalid regex and threw on every request to the resource, surfacing as a 500 from verifySession. Literal characters like . and + also changed matching semantics. isPathAllowed is extracted to server/lib/pathMatch.ts as a pure module, metacharacters are escaped before wildcard substitution, compiled segment regexes are cached, and the test suite now imports the real implementation instead of a stale copy, with added coverage for special characters.
2026-06-12 11:21:21 +03:00
Owen 9d88683fc5 Reset resource info when on inline policy 2026-06-09 21:28:25 -07:00
Owen 5a575c916b Handle backward compatability 2026-06-08 21:11:57 -07:00
Owen bc6fd0b399 Get user resources from the right table 2026-06-03 16:53:39 -07:00
Owen d00b737412 Pull the sso from the policies as well 2026-06-03 16:16:42 -07:00
Owen cc5bec1d83 Pull the rules and the policy information 2026-06-03 15:33:15 -07:00
Owen 8e9071a336 Converting to use both inline and shared policy 2026-06-03 14:41:43 -07:00
Owen 12cbd40596 Fix types 2026-06-02 16:56:58 -07:00
Owen 0943cf5d4c Dont strip session 2026-05-30 12:10:06 -07:00
Owen 76cd716caa Add user id 2026-05-29 10:57:16 -07:00
Owen f81f78f294 Merge branch 'dev' into resource-policies 2026-05-04 17:41:49 -07:00
Mustafa 8e1905a695 Exclude local/private/CGNAT IPs from COUNTRY=ALL and ASN=ALL/AS0 geo-blocking rules 2026-04-12 20:19:32 +02:00
Owen be3e066843 Merge branch 'dev' into feature/region-rules 2026-03-30 14:36:50 -07:00
Owen 757bb39622 Support overriding badger for testing 2026-03-28 21:24:13 -07:00
Owen 00ef6d617f Handle the roles better in the verify session 2026-03-28 21:24:13 -07:00
miloschwartz 0fecbe704b Merge branch 'dev' into multi-role 2026-03-24 22:01:13 -07:00
Owen 75f34ff127 Stub cache 2026-02-25 16:17:06 -08:00
Owen 63e208f4ec Use local cache in verify session 2026-02-24 19:56:16 -08:00
Owen f50d1549b0 Update cache to use redis 2026-02-24 19:50:42 -08:00
miloschwartz 20e547a0f6 first pass 2026-02-24 17:58:11 -08:00
Owen be89e5ca55 Fix issue with auto provisioning being overriden 2026-02-13 14:56:56 -08:00
Owen 47743a5fa8 Fix private import -> dynamic 2026-02-11 10:26:50 -08:00
Owen 0850a28d20 Add more tier matrix checks 2026-02-11 10:06:55 -08:00
Owen be60d66ce3 Switch to the new tier system and clean up checks 2026-02-11 10:06:03 -08:00
miloschwartz a56b058858 fix role name missing in forward headers 2026-01-13 15:28:02 -08:00
Owen f7fcde8312 Add max recursion depth to matchSegments 2025-12-31 10:40:16 -05:00
miloschwartz da112d3417 add stripPortFromHost and reuse everywhere 2025-12-23 12:35:03 -05:00
miloschwartz 71386d3b05 fix request ip port strip issue with badger >=1.3.0 2025-12-22 12:35:40 -05:00
Dennis e051142334 Add region-based resource rule 2025-12-22 17:44:56 +01:00
Dhananjay Mahtha 90c48f20e0 Fix: Prevent cache memory leak by adding maxKeys limit and conditional caching
- Add maxKeys limit (10,000) to NodeCache to prevent unbounded memory growth
- Skip caching undefined values when GeoIP/ASN lookups fail (e.g., when MaxMind DB not configured)
- Add periodic cache statistics logging every 5 minutes for monitoring
- Fixes memory leak where cache would grow indefinitely with high request volumes

The maxKeys limit uses LRU eviction, so oldest entries are automatically removed
when the limit is reached. With ~10k requests/day and 5min TTL, 10k keys provides
ample headroom while preventing OOM issues.

Fixes #2120
2025-12-21 17:08:27 -05:00
Owen eafcefbe45 Merge branch 'dev' of github.com:jln-brtn/pangolin into jln-brtn-dev 2025-12-20 15:34:32 -05:00
Thomas Wilde 4f154d212e Add ASN-based resource rule matching
- Add MaxMind ASN database integration
- Implement ASN lookup and matching in resource rule verification
- Add curated list of 100+ major ASNs (cloud, ISP, CDN, mobile carriers)
- Add ASN dropdown selector in resource rules UI with search functionality
- Support custom ASN input for unlisted ASNs
- Add 'ALL ASNs' special case handling (AS0)
- Cache ASN lookups with 5-minute TTL for performance
- Update validation schemas to support ASN match type

This allows administrators to create resource access rules based on
Autonomous System Numbers, similar to existing country-based rules.
Useful for restricting access by ISP, cloud provider, or mobile carrier.
2025-12-20 12:16:31 -05:00