forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEjbGraphics.ql
More file actions
33 lines (30 loc) · 1.18 KB
/
EjbGraphics.ql
File metadata and controls
33 lines (30 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
* @name EJB uses graphics
* @description An EJB should not use AWT or other graphics functionality.
* Such operations are normally performed by an end-user interface
* that accesses a server but not by the server itself.
* @kind problem
* @problem.severity error
* @precision low
* @id java/ejb/graphics
* @tags reliability
* external/cwe/cwe-575
*/
import java
import semmle.code.java.frameworks.javaee.ejb.EJB
import semmle.code.java.frameworks.javaee.ejb.EJBRestrictions
/*
* JSR 220: Enterprise JavaBeansTM,Version 3.0
* EJB Core Contracts and Requirements
* Section 21.1.2 Programming Restrictions
*
* - An enterprise bean must not use the AWT functionality to attempt to output information to a
* display, or to input information from a keyboard.
*
* Most servers do not allow direct interaction between an application program and a keyboard/display
* attached to the server system.
*/
from Callable origin, ForbiddenGraphicsCallable target, Call call
where ejbCalls(origin, target, call)
select origin, "EJB should not use AWT or other graphics functionality by $@.", call,
target.getDeclaringType().getName() + "." + target.getName()