mirror of
https://github.com/github/codeql.git
synced 2026-04-24 16:25:15 +02:00
Implement checks for elements hidden by their xml attributes
This commit is contained in:
@@ -11,15 +11,10 @@ class AndroidLayoutXmlFile extends XmlFile {
|
||||
|
||||
/** A component declared in an Android layout file. */
|
||||
class AndroidLayoutXmlElement extends XmlElement {
|
||||
AndroidXmlAttribute id;
|
||||
AndroidLayoutXmlElement() { this.getFile() instanceof AndroidLayoutXmlFile }
|
||||
|
||||
AndroidLayoutXmlElement() {
|
||||
this.getFile() instanceof AndroidLayoutXmlFile and
|
||||
id = this.getAttribute("id")
|
||||
}
|
||||
|
||||
/** Gets the ID of this component. */
|
||||
string getId() { result = id.getValue() }
|
||||
/** Gets the ID of this component, if any. */
|
||||
string getId() { result = this.getAttribute("id").getValue() }
|
||||
|
||||
/** Gets the class of this component. */
|
||||
Class getClass() {
|
||||
|
||||
@@ -73,6 +73,14 @@ private module TextFieldTrackingConfig implements DataFlow::ConfigSig {
|
||||
/** Holds if the given may be masked. */
|
||||
private predicate viewIsMasked(AndroidLayoutXmlElement view) {
|
||||
DataFlow::localExprFlow(getAUseOfViewWithId(view.getId()), any(MaskCall mcall).getQualifier())
|
||||
or
|
||||
view.getAttribute("inputType")
|
||||
.(AndroidXmlAttribute)
|
||||
.getValue()
|
||||
.regexpMatch("(?i).*(text|number)(web)?password.*")
|
||||
or
|
||||
view.getAttribute("visibility").(AndroidXmlAttribute).getValue().toLowerCase() =
|
||||
["invisible", "gone"]
|
||||
}
|
||||
|
||||
/** Holds if the qualifier of `call` is also called with a method that may mask the information displayed. */
|
||||
|
||||
Reference in New Issue
Block a user