Commit f687060
authored
fix(pandas-gbq): reject backticks in parse_table_id (#18156)
parse_table_id validates the table id but its regex only excludes "."
and ":" at certain positions, so a backtick passes through into the
parts that core/biglake.py and core/sample.py interpolate into a
backtick-quoted FROM `...` and run via bqclient.query. A backtick closes
the identifier quoting and lets the remainder of the id run as SQL, and
the public sample() entry point routes every table id through this one
helper, so an id like `p.c.n.t` ORDER BY (SELECT 1) --` reaches the
query. Reject backticks in parse_table_id where the id is already
validated; valid project/dataset/table names can't contain one, so
legitimate ids are unchanged.
- [ ] Make sure to open an issue as a
[bug/issue](https://github.com/googleapis/google-cloud-python/issues)
before writing your code! That way we can discuss the change, evaluate
designs, and agree on the general idea
- [x] Ensure the tests and linter pass
- [x] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate docs were updated (if necessary)1 parent dfb0e36 commit f687060
2 files changed
Lines changed: 13 additions & 0 deletions
File tree
- packages/pandas-gbq
- pandas_gbq/core
- tests/unit/core
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
56 | 64 | | |
57 | 65 | | |
58 | 66 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
| |||
0 commit comments