github / github/codeql

C# False Positive Suggestion PathBase

Open
#13,709 1 comment 0 reactions 0 assignees View on GitHub
acknowledged C# false-positive
Dominant language
CodeQL
Stars
10.1k
Forks
2.1k
Avg merge
2d 15h
Merged PRs (30d)
141

Description

**Description of the false positive**

Context.Request.PathBase should not be included as a Remote Flow Source. From my understanding of PathBase, PathBase is usually decided by the server/proxy and therefore is not controllable by a user, but a requirement for accessing an endpoint. Below is an alert I received from the C# XSS query that took PathBase as its source.

**Code samples or links to source code**

```csharp
var bundleAsset = GetOrCreateBundle(bundleKey, CreateCssAsset, sources);

var pathBase = _actionContextAccessor.ActionContext?.HttpContext.Request.PathBase ?? PathString.Empty; <--- PathBase here
result.AppendFormat("",
MimeTypes.TextCss, pathBase, bundleAsset.Route, bundleAsset.GenerateCacheKey(httpContext, woConfig));
```

Contributor guide

Open the contributing guide

Research direction

Start with the C# XSS query and its modeling of Context.Request.PathBase as a Remote Flow Source. Confirm how PathBase is classified, then verify that the shown value is no longer treated as a source; the issue provides no file or test path, so repository search is needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.