Initial upload to Gitea

This commit is contained in:
antonn committed 2026-11-30 16:32:37 +00:00
1 parent 78193254ad
commit 8478998cae
1485 files changed
+461025 -42348

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
"use strict";
// Case-insensitive classification of the /api/nodes route namespace.
//
// Express matches routes case-insensitively by default (neither app enables
// "case sensitive routing"), so /API/NODES, /Api/Nodes and /api/nodes are
// dispatched to the same handlers. Any gate that classifies paths with a
// case-sensitive prefix match can therefore be bypassed by a case variant
// while the router still serves the real route. Both gate layers — the
// index.js pre-mount admin gate and the nodes.js in-app gate — must classify
// through these helpers.
//
// The OPEN-route allowlists (heartbeat, config.yml, node-bootstrap)
// deliberately keep their case-sensitive regexes: they grant
// pre-auth reachability, so a case variant that fails their match falls
// closed into the admin gate instead of widening the pre-auth surface.
const NODE_API_PREFIX = "/api/nodes";
const NODE_SERVER_API_PREFIX = "/api/nodes/server/";
function isNodeApiPath(p) {
return String(p || "").toLowerCase().startsWith(NODE_API_PREFIX);
}
function isNodeServerApiPath(p) {
return String(p || "").toLowerCase().startsWith(NODE_SERVER_API_PREFIX);
}
module.exports = { isNodeApiPath, isNodeServerApiPath };