-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
library_mono.js triggers apparent false-positive report from GitHub's codeql scan #59147
Comments
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsThis was originally reported at dotnet/aspnetcore#36529 It seems that if you add GitHub's CodeQL analysis (like this), then you will get a report of a vulnerability like this: https://github.com/damienbod/AspNetCore6Experiments/pull/7/checks?check_run_id=3607015850. Just in case that gets deleted, here's a screenshot: Notice that these are all from On investigation, this seems to map to CodeQL's rule for CWE-134. It gives an example of "bad" code in which user-supplied data becomes part of a format string: let user = req.query.user;
let ip = req.connection.remoteAddress;
console.log("Unauthorized access attempt by " + user, ip); I think the closest match to that pattern is here: runtime/src/mono/wasm/runtime/library_mono.js Line 1302 in 55622ab
There might be others, but this is the closest one I can find. Of course, it doesn't seem like this would actually be a vulnerability in a Blazor application, because Blazor never runs JavaScript code on the server, and I don't really think user-supplied input could get into this line of code anyway as the list of assets to load (and their URLs) is determined by compile-time code only. But it would be good to avoid confusing people and avoid this particular code pattern if it makes CodeQL stop raising an alert. It could probably be fixed by using the format string pattern they cite in the "good" example: console.log("Unauthorized access attempt by %s", user, ip); In my opinion this looks like a false alert and I wouldn't suggest it's urgent to work around, but cc @blowdart for info.
|
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Not ship blocking, but should be addressed before release |
Tagging subscribers to this area: @directhex Issue DetailsThis was originally reported at dotnet/aspnetcore#36529 It seems that if you add GitHub's CodeQL analysis (like this), then you will get a report of a vulnerability like this: https://github.com/damienbod/AspNetCore6Experiments/pull/7/checks?check_run_id=3607015850. Just in case that gets deleted, here's a screenshot: Notice that these are all from On investigation, this seems to map to CodeQL's rule for CWE-134. It gives an example of "bad" code in which user-supplied data becomes part of a format string: let user = req.query.user;
let ip = req.connection.remoteAddress;
console.log("Unauthorized access attempt by " + user, ip); I agree that this code is potentially buggy, since if I think the closest match to that pattern is here: runtime/src/mono/wasm/runtime/library_mono.js Line 1302 in 55622ab
There might be others, but this is the closest one I can find. It's possible that codeql is going to raise an alert for any use of Of course, it doesn't seem like this would actually be a vulnerability in a Blazor application, because:
But it would be good to avoid confusing people and avoid this particular code pattern if it makes CodeQL stop raising an alert. It could probably be fixed by using the format string pattern they cite in the "good" example: console.log("Unauthorized access attempt by %s", user, ip); In my opinion this looks like a false alert and I wouldn't suggest it's urgent to work around, but cc @blowdart for info.
|
ping @lewing in case this needs to flow into the product. |
@SteveSandersonMS I found two cases which appears to match the number of failures per file. I've opened #59839 for net6. |
@pavelsavara we should resolve this in main but I can wait till #59655 lands |
Fixes #59147 for release/6.0 a console method is called with both a concatenated format string and multiple arguments.
This was originally reported at dotnet/aspnetcore#36529
It seems that if you add GitHub's CodeQL analysis (like this), then you will get a report of a vulnerability like this: https://github.com/damienbod/AspNetCore6Experiments/pull/7/checks?check_run_id=3607015850. Just in case that gets deleted, here's a screenshot:
Notice that these are all from
dotnet.js
(which gets copied and renamed during the build but its contents aren't changed).On investigation, this seems to map to CodeQL's rule for CWE-134. It gives an example of "bad" code in which user-supplied data becomes part of a format string:
I agree that this code is potentially buggy, since if
user
contained%s
, then theip
value would be inserted into the middle of the console output instead of being appended to the end of it. Which would be strange.I think the closest match to that pattern is here:
runtime/src/mono/wasm/runtime/library_mono.js
Line 1302 in 55622ab
There might be others, but this is the closest one I can find. It's possible that codeql is going to raise an alert for any use of
console.log
that involves string concatenation instead of%s
-style tokens.Of course, it doesn't seem like this would actually be a vulnerability in a Blazor application, because:
But it would be good to avoid confusing people and avoid this particular code pattern if it makes CodeQL stop raising an alert. It could probably be fixed by using the format string pattern they cite in the "good" example:
In my opinion this looks like a false alert and I wouldn't suggest it's urgent to work around, but cc @blowdart for info.
The text was updated successfully, but these errors were encountered: