-
Notifications
You must be signed in to change notification settings - Fork 587
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly bind a metavariable in an import to the fully qualified name
Fixes #1771 This should also help #975 Test plan: $ semgrep -f /tmp/test2.yml tests/python/import_metavar_fullpath.py running 1 rules... tests/python/import_metavar_fullpath.py severity:error rule:tmp.import-auth: spooky import 12:import a.auth 14:import b.auth 16:import a.b.auth ran 1 rules on 1 files: 3 findings
- Loading branch information
Showing
4 changed files
with
50 additions
and
14 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# what actually matters in this test is the value binded to $X | ||
# in the .sgrep. It should be the full path! | ||
# use semgrep-core ... -pvar '$X' to print the value. | ||
|
||
#ERROR: match | ||
import a | ||
#ERROR: match | ||
import auth | ||
#ERROR: match | ||
import arbitrary_auth | ||
#ERROR: match | ||
import a.auth | ||
#ERROR: match | ||
import b.auth | ||
#ERROR: match | ||
import a.b.auth |
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 @@ | ||
import $X |