Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3e09d86

Browse files
Jami CogswellJami Cogswell
authored andcommitted
adding starter files
1 parent 0ac8b7c commit 3e09d86

7 files changed

Lines changed: 91 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<!DOCTYPE qhelp PUBLIC
2+
"-//Semmle//qhelp//EN"
3+
"qhelp.dtd">
4+
<qhelp>
5+
6+
<overview>
7+
<p>TODO: Replace the following
8+
When a debugger is enabled it could allow for entry points in the application or reveal sensitive information.</p>
9+
10+
</overview>
11+
<recommendation>
12+
13+
<p>TODO: Replace the following
14+
In Android applications either set the <code>android:debuggable</code> attribute to <code>false</code>
15+
or do not include it in the manifest. The default value when not included is <code>false</code>.</p>
16+
17+
</recommendation>
18+
<example>
19+
20+
<p>TODO: Replace the following
21+
In the example below, the <code>android:debuggable</code> attribute is set to <code>true</code>.</p>
22+
23+
<!--<sample src="DebuggableTrue.xml" />-->
24+
25+
<p>The corrected version sets the <code>android:debuggable</code> attribute to <code>false</code>.</p>
26+
27+
<!--<sample src="DebuggableFalse.xml" />-->
28+
29+
</example>
30+
<references>
31+
32+
<li>
33+
TODO: REPLACE LINKS. Android Developers:
34+
<a href="https://developer.android.com/guide/topics/manifest/application-element#debug">The android:debuggable attribute</a>.
35+
</li>
36+
37+
</references>
38+
</qhelp>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* @name Implicitly imported Android component
3+
* @description TODO after more background reading
4+
* @kind problem (TODO: confirm after more background reading)
5+
* @problem.severity warning (TODO: confirm after more background reading)
6+
* @security-severity 0.1 (TODO: run script)
7+
* @id java/android/implicitly-imported-component
8+
* @tags security
9+
* external/cwe/cwe-926
10+
* @precision TODO after MRVA
11+
*/
12+
13+
import java
14+
import semmle.code.xml.AndroidManifest
15+
16+
// TODO: change query
17+
from AndroidXmlAttribute androidXmlAttr
18+
where
19+
androidXmlAttr.getName() = "debuggable" and
20+
androidXmlAttr.getValue() = "true" and
21+
not androidXmlAttr.getLocation().getFile().getRelativePath().matches("%build%")
22+
select androidXmlAttr, "The 'android:debuggable' attribute is enabled."
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: newQuery
3+
---
4+
* Added a new query, `java/android/implicitly-imported-component`, to detect if an Android component can become implicitly exported.

java/ql/test/query-tests/security/CWE-926/ImplicitlyExportedAndroidComponentTest.expected

Whitespace-only changes.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import java
2+
import semmle.code.xml.AndroidManifest
3+
import TestUtilities.InlineExpectationsTest
4+
5+
// TODO: update for implicit export query
6+
class DebuggableAttributeTrueTest extends InlineExpectationsTest {
7+
DebuggableAttributeTrueTest() { this = "DebuggableAttributeEnabledTest" }
8+
9+
override string getARelevantTag() { result = "hasDebuggableAttributeEnabled" }
10+
11+
override predicate hasActualResult(Location location, string element, string tag, string value) {
12+
tag = "hasDebuggableAttributeEnabled" and
13+
exists(AndroidXmlAttribute androidXmlAttr |
14+
androidXmlAttr.getName() = "debuggable" and
15+
androidXmlAttr.getValue() = "true" and
16+
not androidXmlAttr.getLocation().getFile().getRelativePath().matches("%build%")
17+
|
18+
androidXmlAttr.getLocation() = location and
19+
element = androidXmlAttr.toString() and
20+
value = ""
21+
)
22+
}
23+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public class Test {
2+
3+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/google-android-9.0.0

0 commit comments

Comments
 (0)