mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Will need subsequent PRs fixing up test failures (due to deprecated methods moving around), but other than that everything should be straight-forward.
21 lines
437 B
Plaintext
21 lines
437 B
Plaintext
/**
|
|
* @id py/examples/private-access
|
|
* @name Private access
|
|
* @description Find accesses to "private" attributes (those starting with an underscore)
|
|
* @tags access
|
|
* private
|
|
*/
|
|
|
|
import python
|
|
|
|
predicate is_private(Attribute a) {
|
|
a.getName().matches("\\_%") and
|
|
not a.getName().matches("\\_\\_%\\_\\_")
|
|
}
|
|
|
|
from Attribute access
|
|
where
|
|
is_private(access) and
|
|
not access.getObject().(Name).getId() = "self"
|
|
select access
|