-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
JS: Add view-component-input threat model #18466
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
30d192a
JS: Move getName() to a shared location
asgerf 01f7d45
JS: Add meta query for reporting threat model sources
asgerf b015c88
JS: Add view-component-input threat model
asgerf 327bdc0
JS: Use TypeScript types to restrict ViewComponentInputs in general
asgerf 3061d51
JS: Add ThreatModelSource#isCilentSideSource()
asgerf d647c7b
JS: Replace 'instanceof ClientSideRemoteFlowSource'
asgerf e5c0390
Add view-component-input for testing
asgerf 4161f45
Revert "Add view-component-input for testing"
asgerf 8771bf8
Mention view-component-input in docs and threat model grouping
asgerf 051fa66
JS: Add change note
asgerf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
javascript/ql/lib/semmle/javascript/ViewComponentInput.qll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Provides a classes and predicates for contributing to the `view-component-input` threat model. | ||
*/ | ||
|
||
private import javascript | ||
|
||
/** | ||
* An input to a view component, such as React props. | ||
*/ | ||
abstract class ViewComponentInput extends ThreatModelSource::Range { | ||
final override string getThreatModel() { result = "view-component-input" } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 11 additions & 11 deletions
22
javascript/ql/test/library-tests/frameworks/Angular2/sink.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
javascript/ql/test/library-tests/frameworks/Vue/single-file-component-3-script.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
var x = require('x'); | ||
|
||
module.exports = { | ||
data: function() { return { dataA: 42 } } | ||
props: ['input'], | ||
data: function() { return { dataA: 42 + this.input } } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
javascript/ql/test/library-tests/frameworks/Vue/single-file-component-6.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<template> | ||
<p v-html="input"/> | ||
</template> | ||
<script setup> | ||
const { input } = defineProps(['input']); | ||
</script> | ||
<style> | ||
</style> |
12 changes: 12 additions & 0 deletions
12
javascript/ql/test/library-tests/frameworks/Vue/single-file-component-7.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<template> | ||
<p v-html="input"/> | ||
</template> | ||
<script setup> | ||
const { input, numericInput, booleanInput } = defineProps({ | ||
input: String, | ||
numericInput: Number, | ||
booleanInput: Boolean, | ||
}); | ||
</script> | ||
<style> | ||
</style> |
12 changes: 12 additions & 0 deletions
12
javascript/ql/test/library-tests/frameworks/Vue/single-file-component-8.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<template> | ||
<p v-html="input"/> | ||
</template> | ||
<script setup lang="ts"> | ||
const { input, numericInput, booleanInput } = defineProps<{ | ||
input: string, | ||
numericInput: number, | ||
booleanInput: boolean, | ||
}>(); | ||
</script> | ||
<style> | ||
</style> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all of these are named "sink", but they're sources, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're like React props, they're just passed in from the instantiation site. When I initially wrote this test long ago, I had omitted the
@Input()
decorator on these fields, which you're supposed to put on such input fields in Angular (not sure if they're strictly required though).If the threat model is enabled they become sources (in addition to having incoming flow from instantiation sites). The unit test now reports which nodes are associated with this threat model, but the threat model is not actually enabled, so the data flow test doesn't treat them as taint sources.