fix(security): persist IP filter config + enforce it in the authz pipeline (#6131) - #6132
Merged
Merged
Conversation
…eline (#6131) The IP blacklist/whitelist lived in a module-level in-memory _config only: the settings route mutated it but nothing persisted to the DB or loaded on startup, so every restart (i.e. every OmniRoute update) reset it to Disabled + empty lists — the user-reported symptom. Worse, checkIP/checkRequestIP were never wired into the request path, so listed IPs were never actually blocked. Part A (persistence): ipFilter.ts now lazily loads its config from the key_value table (namespace 'ipFilter') on first access and persists on every mutation (configure/add/remove). better-sqlite3 is synchronous, so this stays in the hot path with no startup wiring; tempBans stay ephemeral; DB failures degrade to in-memory only. Part B (enforcement): runAuthzPipeline now calls checkRequestIP for non-loopback requests, returning 403 before the route policy runs. Loopback is exempt so the local operator can never lock themselves out of the dashboard. TDD: ip-filter-persistence-6131.test.ts (config + blacklist survive a simulated restart; blocked IP still blocked) and authz/ip-filter-enforcement-6131.test.ts (blacklisted IP -> 403, clean IP passes, disabled never blocks, loopback exempt). Existing ip-filter + authz/pipeline suites stay green.
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…h the real DB Since #6131 the IP filter lazily loads/persists to the DB. Without DATA_DIR isolation ip-filter.test.ts touched ~/.omniroute (side-effect + a WAL-lock flake when run alongside other DB tests). Pin a throwaway DATA_DIR + reset per test.
Merged
tkgo11
pushed a commit
to tkgo11/OmniRoute
that referenced
this pull request
Sep 23, 2026
…eline (diegosouzapw#6131) (diegosouzapw#6132) Integrated into release/v3.8.44 — IP filter persistence + authz-pipeline enforcement (closes diegosouzapw#6131). HARD-neutro: validate-release-green on the merge shows the same 3 pre-existing base-reds as the release baseline (test-masking cycle-wide, unit red-herring, integration batch-E2E env); diegosouzapw#6131's own tests + ip-filter/pipeline suites all green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6131.
Problem (user-reported)
Two root causes in
open-sse/services/ipFilter.ts:_config; the settings route mutated it but nothing wrote to the DB or loaded on startup, so every restart (every update) reset it to Disabled + empty lists.checkIP/checkRequestIPwere never wired into the request pipeline, so listed IPs were never actually blocked.Fix
key_value(namespaceipFilter) on first access + persist on every mutation. better-sqlite3 is sync, so no startup wiring; tempBans stay ephemeral; DB errors degrade to in-memory only.runAuthzPipelinecallscheckRequestIPfor non-loopback requests → 403 before the route policy. Loopback is exempt so the local operator can never lock themselves out.Tests (TDD)
tests/unit/ip-filter-persistence-6131.test.ts— config + blacklist survive a simulated restart; blocked IP still blocked; whitelist mode; safe defaults.tests/unit/authz/ip-filter-enforcement-6131.test.ts— blacklisted IP → 403; clean IP passes; disabled never blocks; loopback exempt.ip-filter(16) +authz/pipeline(27) suites stay green.