mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
JS: Add test case for graph ql variableValues injection
This commit is contained in:
@@ -33,4 +33,24 @@ app.post('/graphql', async (req, res) => {
|
||||
variableValues: variables
|
||||
});
|
||||
res.json(result);
|
||||
|
||||
const root1 = {
|
||||
greet: ({ name, title }) => {
|
||||
return eval(name + title).toString(); // $ MISSING: Alert[js/code-injection]
|
||||
}
|
||||
};
|
||||
graphql({
|
||||
schema: buildSchema(`
|
||||
type Query {
|
||||
greet(name: String!, title: String): String
|
||||
}
|
||||
`),
|
||||
source: `
|
||||
query GreetUser($name: String!, $title: String) {
|
||||
greet(name: $name, title: $title)
|
||||
}
|
||||
`,
|
||||
rootValue: root1,
|
||||
variableValues: variables
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user