Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[JavaScript] How to disable the exported function's parameter as tainted? #18726

Unanswered
Anemone95 asked this question in Q&A
Discussion options

Hi, when we scan the following code for example:

module.exports = (p1)=>{eval(p1)}

CodeQL will make p1 as a "source" when doing taint analysis, but in my scenario, I don't need this. Is that possible to disable this feature?

You must be logged in to vote

Replies: 2 comments

Comment options

Hi @Anemone95

I've asked the CodeQL JavaScript team to have a look at your question.

You must be logged in to vote
0 replies
Comment options

Hi @Anemone95,

Just to clarify a few things:

  • Most queries do not consider library inputs as taint sources, but there are some that do.
  • Library inputs are parameters to functions that could be called from a dependent package. That is, being exported from a module is not enough, the function has to be exposed somehow from the main file of a package.json file.

I don't think any of our queries would actually flag the function you showed here. The js/unsafe-code-construction query comes close, but it only flags cases where the data has passed through a string concatenation first. That might be what you're seeing. In this case you may consider disabling that specific query.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /