AuthInterceptor: strip query string before policy check
Request-target from getStartingLine().path includes the query string (e.g. "/set-password?token=abc"), causing exact-match public-path checks like `path == "/set-password"` in IAuthPolicy::isPublicPath to fail and the request to be rejected with 401. Strip the query string once at the top of intercept() so policies and access logs see clean paths. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
448cd9ef8c
commit
46971acf99
1 changed files with 5 additions and 1 deletions
|
|
@ -104,8 +104,12 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
const std::string path = request->getStartingLine().path.std_str();
|
||||
std::string path = request->getStartingLine().path.std_str();
|
||||
const std::string method = request->getStartingLine().method.std_str();
|
||||
// Strip query string — request-target includes it, but policy checks
|
||||
// (and access logs) want just the path.
|
||||
auto qpos = path.find('?');
|
||||
if (qpos != std::string::npos) path.resize(qpos);
|
||||
|
||||
if (m_policy->isPublicPath(path)) return nullptr;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue