Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 50d9ea7

Browse filesBrowse files
authored
Apply suggestions from code review
1 parent 34d1e43 commit 50d9ea7
Copy full SHA for 50d9ea7

1 file changed

+15-13Lines changed: 15 additions & 13 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎java/ql/src/semmle/code/java/security/SecurityFlag.qll‎

Copy file name to clipboardExpand all lines: java/ql/src/semmle/code/java/security/SecurityFlag.qll
+15-13Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,34 @@ abstract class FlagKind extends string {
1515
FlagKind() { any() }
1616

1717
/**
18-
* Returns a flag name of this type.
18+
* Gets a flag name of this type.
1919
*/
2020
bindingset[result]
2121
abstract string getAFlagName();
2222

2323
/** Gets a node representing a (likely) security flag. */
2424
DataFlow::Node getAFlag() {
25-
exists(VarAccess v | v.getVariable().getName() = getAFlagName() |
26-
result.asExpr() = v and v.getType() instanceof FlagType
25+
exists(DataFlow::Node flag |
26+
exists(VarAccess v | v.getVariable().getName() = getAFlagName() |
27+
flag.asExpr() = v and v.getType() instanceof FlagType
28+
)
29+
or
30+
exists(StringLiteral s | s.getRepresentedString() = getAFlagName() | flag.asExpr() = s)
31+
or
32+
exists(MethodAccess ma | ma.getMethod().getName() = getAFlagName() |
33+
flag.asExpr() = ma and
34+
ma.getType() instanceof FlagType
35+
)
36+
|
37+
flagFlowStep*(flag, result)
2738
)
28-
or
29-
exists(StringLiteral s | s.getRepresentedString() = getAFlagName() | result.asExpr() = s)
30-
or
31-
exists(MethodAccess ma | ma.getMethod().getName() = getAFlagName() |
32-
result.asExpr() = ma and
33-
ma.getType() instanceof FlagType
34-
)
35-
or
36-
flagFlowStep*(getAFlag(), result)
3739
}
3840
}
3941

4042
/**
4143
* Flags suggesting an optional feature, perhaps deliberately insecure.
4244
*/
43-
class SecurityFeatureFlag extends FlagKind {
45+
private class SecurityFeatureFlag extends FlagKind {
4446
SecurityFeatureFlag() { this = "SecurityFeatureFlag" }
4547

4648
bindingset[result]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.