mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
add support for extracting .jsp files
This commit is contained in:
@@ -153,7 +153,7 @@ import com.semmle.util.trap.TrapWriter;
|
||||
* <li>All JavaScript files, that is, files with one of the extensions supported by {@link
|
||||
* FileType#JS} (currently ".js", ".jsx", ".mjs", ".cjs", ".es6", ".es").
|
||||
* <li>All HTML files, that is, files with with one of the extensions supported by {@link
|
||||
* FileType#HTML} (currently ".htm", ".html", ".xhtm", ".xhtml", ".vue", ".html.erb").
|
||||
* FileType#HTML} (currently ".htm", ".html", ".xhtm", ".xhtml", ".vue", ".html.erb", ".jsp").
|
||||
* <li>All YAML files, that is, files with one of the extensions supported by {@link
|
||||
* FileType#YAML} (currently ".raml", ".yaml", ".yml").
|
||||
* <li>Files with base name "package.json" or "tsconfig.json", and files whose base name
|
||||
|
||||
@@ -103,7 +103,7 @@ public class FileExtractor {
|
||||
|
||||
/** Information about supported file types. */
|
||||
public static enum FileType {
|
||||
HTML(".htm", ".html", ".xhtm", ".xhtml", ".vue", ".hbs", ".ejs", ".njk", ".erb") {
|
||||
HTML(".htm", ".html", ".xhtm", ".xhtml", ".vue", ".hbs", ".ejs", ".njk", ".erb", ".jsp") {
|
||||
@Override
|
||||
public IExtractor mkExtractor(ExtractorConfig config, ExtractorState state) {
|
||||
return new HTMLExtractor(config, state);
|
||||
|
||||
@@ -41,7 +41,7 @@ public class Main {
|
||||
* A version identifier that should be updated every time the extractor changes in such a way that
|
||||
* it may produce different tuples for the same file under the same {@link ExtractorConfig}.
|
||||
*/
|
||||
public static final String EXTRACTOR_VERSION = "2023-08-10";
|
||||
public static final String EXTRACTOR_VERSION = "2023-10-13";
|
||||
|
||||
public static final Pattern NEWLINE = Pattern.compile("\n");
|
||||
|
||||
|
||||
14
javascript/extractor/tests/vue/input/simple-jsp.jsp
Normal file
14
javascript/extractor/tests/vue/input/simple-jsp.jsp
Normal file
@@ -0,0 +1,14 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Hello World JSP</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<% String name = "John"; %>
|
||||
<p>Welcome <%= name %>!</p>
|
||||
<script>
|
||||
console.log(123);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
232
javascript/extractor/tests/vue/output/trap/simple-jsp.jsp.trap
Normal file
232
javascript/extractor/tests/vue/output/trap/simple-jsp.jsp.trap
Normal file
@@ -0,0 +1,232 @@
|
||||
#10000=@"/simple-jsp.jsp;sourcefile"
|
||||
files(#10000,"/simple-jsp.jsp")
|
||||
#10001=@"/;folder"
|
||||
folders(#10001,"/")
|
||||
containerparent(#10001,#10000)
|
||||
#10002=@"loc,{#10000},0,0,0,0"
|
||||
locations_default(#10002,#10000,0,0,0,0)
|
||||
hasLocation(#10000,#10002)
|
||||
#20000=@"global_scope"
|
||||
scopes(#20000,0)
|
||||
#20001=*
|
||||
#20002=@"script;{#10000},10,13"
|
||||
#20003=*
|
||||
lines(#20003,#20002,"","
|
||||
")
|
||||
#20004=@"loc,{#10000},10,13,10,12"
|
||||
locations_default(#20004,#10000,10,13,10,12)
|
||||
hasLocation(#20003,#20004)
|
||||
#20005=*
|
||||
lines(#20005,#20002," console.log(123);","
|
||||
")
|
||||
#20006=@"loc,{#10000},11,1,11,23"
|
||||
locations_default(#20006,#10000,11,1,11,23)
|
||||
hasLocation(#20005,#20006)
|
||||
indentation(#10000,11," ",6)
|
||||
#20007=*
|
||||
lines(#20007,#20002," ","")
|
||||
#20008=@"loc,{#10000},12,1,12,4"
|
||||
locations_default(#20008,#10000,12,1,12,4)
|
||||
hasLocation(#20007,#20008)
|
||||
numlines(#20002,3,1,0)
|
||||
#20009=*
|
||||
tokeninfo(#20009,6,#20002,0,"console")
|
||||
#20010=@"loc,{#10000},11,7,11,13"
|
||||
locations_default(#20010,#10000,11,7,11,13)
|
||||
hasLocation(#20009,#20010)
|
||||
#20011=*
|
||||
tokeninfo(#20011,8,#20002,1,".")
|
||||
#20012=@"loc,{#10000},11,14,11,14"
|
||||
locations_default(#20012,#10000,11,14,11,14)
|
||||
hasLocation(#20011,#20012)
|
||||
#20013=*
|
||||
tokeninfo(#20013,6,#20002,2,"log")
|
||||
#20014=@"loc,{#10000},11,15,11,17"
|
||||
locations_default(#20014,#10000,11,15,11,17)
|
||||
hasLocation(#20013,#20014)
|
||||
#20015=*
|
||||
tokeninfo(#20015,8,#20002,3,"(")
|
||||
#20016=@"loc,{#10000},11,18,11,18"
|
||||
locations_default(#20016,#10000,11,18,11,18)
|
||||
hasLocation(#20015,#20016)
|
||||
#20017=*
|
||||
tokeninfo(#20017,3,#20002,4,"123")
|
||||
#20018=@"loc,{#10000},11,19,11,21"
|
||||
locations_default(#20018,#10000,11,19,11,21)
|
||||
hasLocation(#20017,#20018)
|
||||
#20019=*
|
||||
tokeninfo(#20019,8,#20002,5,")")
|
||||
#20020=@"loc,{#10000},11,22,11,22"
|
||||
locations_default(#20020,#10000,11,22,11,22)
|
||||
hasLocation(#20019,#20020)
|
||||
#20021=*
|
||||
tokeninfo(#20021,8,#20002,6,";")
|
||||
#20022=@"loc,{#10000},11,23,11,23"
|
||||
locations_default(#20022,#10000,11,23,11,23)
|
||||
hasLocation(#20021,#20022)
|
||||
#20023=*
|
||||
tokeninfo(#20023,0,#20002,7,"")
|
||||
#20024=@"loc,{#10000},12,5,12,4"
|
||||
locations_default(#20024,#10000,12,5,12,4)
|
||||
hasLocation(#20023,#20024)
|
||||
toplevels(#20002,1)
|
||||
#20025=@"loc,{#10000},10,13,12,4"
|
||||
locations_default(#20025,#10000,10,13,12,4)
|
||||
hasLocation(#20002,#20025)
|
||||
#20026=*
|
||||
stmts(#20026,2,#20002,0,"console.log(123);")
|
||||
#20027=@"loc,{#10000},11,7,11,23"
|
||||
locations_default(#20027,#10000,11,7,11,23)
|
||||
hasLocation(#20026,#20027)
|
||||
stmt_containers(#20026,#20002)
|
||||
#20028=*
|
||||
exprs(#20028,13,#20026,0,"console.log(123)")
|
||||
#20029=@"loc,{#10000},11,7,11,22"
|
||||
locations_default(#20029,#10000,11,7,11,22)
|
||||
hasLocation(#20028,#20029)
|
||||
enclosing_stmt(#20028,#20026)
|
||||
expr_containers(#20028,#20002)
|
||||
#20030=*
|
||||
exprs(#20030,14,#20028,-1,"console.log")
|
||||
#20031=@"loc,{#10000},11,7,11,17"
|
||||
locations_default(#20031,#10000,11,7,11,17)
|
||||
hasLocation(#20030,#20031)
|
||||
enclosing_stmt(#20030,#20026)
|
||||
expr_containers(#20030,#20002)
|
||||
#20032=*
|
||||
exprs(#20032,79,#20030,0,"console")
|
||||
hasLocation(#20032,#20010)
|
||||
enclosing_stmt(#20032,#20026)
|
||||
expr_containers(#20032,#20002)
|
||||
literals("console","console",#20032)
|
||||
#20033=@"var;{console};{#20000}"
|
||||
variables(#20033,"console",#20000)
|
||||
bind(#20032,#20033)
|
||||
#20034=*
|
||||
exprs(#20034,0,#20030,1,"log")
|
||||
hasLocation(#20034,#20014)
|
||||
enclosing_stmt(#20034,#20026)
|
||||
expr_containers(#20034,#20002)
|
||||
literals("log","log",#20034)
|
||||
#20035=*
|
||||
exprs(#20035,3,#20028,0,"123")
|
||||
hasLocation(#20035,#20018)
|
||||
enclosing_stmt(#20035,#20026)
|
||||
expr_containers(#20035,#20002)
|
||||
literals("123","123",#20035)
|
||||
#20036=*
|
||||
entry_cfg_node(#20036,#20002)
|
||||
hasLocation(#20036,#20004)
|
||||
#20037=*
|
||||
exit_cfg_node(#20037,#20002)
|
||||
hasLocation(#20037,#20024)
|
||||
successor(#20026,#20032)
|
||||
successor(#20035,#20028)
|
||||
successor(#20034,#20030)
|
||||
successor(#20032,#20034)
|
||||
successor(#20030,#20035)
|
||||
successor(#20028,#20037)
|
||||
successor(#20036,#20026)
|
||||
toplevel_parent_xml_node(#20002,#20001)
|
||||
#20038=*
|
||||
template_placeholder_tag_info(#20038,#10000,"<%@ page contentType=""text/html;charset=UTF-8"" language=""java"" %>")
|
||||
#20039=@"loc,{#10000},1,1,1,65"
|
||||
locations_default(#20039,#10000,1,1,1,65)
|
||||
hasLocation(#20038,#20039)
|
||||
#20040=*
|
||||
xmlElements(#20040,"html",#10000,0,#10000)
|
||||
#20041=@"loc,{#10000},2,1,14,7"
|
||||
locations_default(#20041,#10000,2,1,14,7)
|
||||
xmllocations(#20040,#20041)
|
||||
#20042=*
|
||||
xmlElements(#20042,"body",#20040,1,#10000)
|
||||
#20043=@"loc,{#10000},6,3,13,9"
|
||||
locations_default(#20043,#10000,6,3,13,9)
|
||||
xmllocations(#20042,#20043)
|
||||
#20044=*
|
||||
template_placeholder_tag_info(#20044,#20042,"<% String name = ""John""; %>")
|
||||
#20045=@"loc,{#10000},8,5,8,31"
|
||||
locations_default(#20045,#10000,8,5,8,31)
|
||||
hasLocation(#20044,#20045)
|
||||
xmlElements(#20001,"script",#20042,2,#10000)
|
||||
#20046=@"loc,{#10000},10,5,12,13"
|
||||
locations_default(#20046,#10000,10,5,12,13)
|
||||
xmllocations(#20001,#20046)
|
||||
#20047=*
|
||||
xmlElements(#20047,"p",#20042,1,#10000)
|
||||
#20048=@"loc,{#10000},9,5,9,31"
|
||||
locations_default(#20048,#10000,9,5,9,31)
|
||||
xmllocations(#20047,#20048)
|
||||
#20049=*
|
||||
template_placeholder_tag_info(#20049,#20047,"<%= name %>")
|
||||
#20050=@"loc,{#10000},9,16,9,26"
|
||||
locations_default(#20050,#10000,9,16,9,26)
|
||||
hasLocation(#20049,#20050)
|
||||
scopes(#20000,0)
|
||||
#20051=@"script;{#10000},9,19"
|
||||
#20052=*
|
||||
lines(#20052,#20051," name ","")
|
||||
#20053=@"loc,{#10000},9,19,9,24"
|
||||
locations_default(#20053,#10000,9,19,9,24)
|
||||
hasLocation(#20052,#20053)
|
||||
indentation(#10000,9," ",1)
|
||||
numlines(#20051,1,1,0)
|
||||
#20054=*
|
||||
tokeninfo(#20054,6,#20051,0,"name")
|
||||
#20055=@"loc,{#10000},9,20,9,23"
|
||||
locations_default(#20055,#10000,9,20,9,23)
|
||||
hasLocation(#20054,#20055)
|
||||
#20056=*
|
||||
tokeninfo(#20056,0,#20051,1,"")
|
||||
#20057=@"loc,{#10000},9,25,9,24"
|
||||
locations_default(#20057,#10000,9,25,9,24)
|
||||
hasLocation(#20056,#20057)
|
||||
toplevels(#20051,4)
|
||||
hasLocation(#20051,#20053)
|
||||
#20058=@"module;{#10000},9,19"
|
||||
scopes(#20058,3)
|
||||
scopenodes(#20051,#20058)
|
||||
scopenesting(#20058,#20000)
|
||||
is_module(#20051)
|
||||
#20059=*
|
||||
stmts(#20059,2,#20051,0,"name")
|
||||
hasLocation(#20059,#20055)
|
||||
stmt_containers(#20059,#20051)
|
||||
#20060=*
|
||||
exprs(#20060,79,#20059,0,"name")
|
||||
hasLocation(#20060,#20055)
|
||||
enclosing_stmt(#20060,#20059)
|
||||
expr_containers(#20060,#20051)
|
||||
literals("name","name",#20060)
|
||||
#20061=@"var;{name};{#20058}"
|
||||
variables(#20061,"name",#20058)
|
||||
bind(#20060,#20061)
|
||||
#20062=*
|
||||
entry_cfg_node(#20062,#20051)
|
||||
#20063=@"loc,{#10000},9,19,9,18"
|
||||
locations_default(#20063,#10000,9,19,9,18)
|
||||
hasLocation(#20062,#20063)
|
||||
#20064=*
|
||||
exit_cfg_node(#20064,#20051)
|
||||
hasLocation(#20064,#20057)
|
||||
successor(#20059,#20060)
|
||||
successor(#20060,#20064)
|
||||
successor(#20062,#20059)
|
||||
toplevel_parent_xml_node(#20051,#20049)
|
||||
#20065=*
|
||||
xmlElements(#20065,"h1",#20042,0,#10000)
|
||||
#20066=@"loc,{#10000},7,5,7,25"
|
||||
locations_default(#20066,#10000,7,5,7,25)
|
||||
xmllocations(#20065,#20066)
|
||||
#20067=*
|
||||
xmlElements(#20067,"head",#20040,0,#10000)
|
||||
#20068=@"loc,{#10000},3,3,5,9"
|
||||
locations_default(#20068,#10000,3,3,5,9)
|
||||
xmllocations(#20067,#20068)
|
||||
#20069=*
|
||||
xmlElements(#20069,"title",#20067,0,#10000)
|
||||
#20070=@"loc,{#10000},4,5,4,34"
|
||||
locations_default(#20070,#10000,4,5,4,34)
|
||||
xmllocations(#20069,#20070)
|
||||
numlines(#10000,14,2,0)
|
||||
filetype(#10000,"html")
|
||||
Reference in New Issue
Block a user