Skip to content

Commit 73b1812

Browse files
committed
Extract .xsaccess files as JSON
1 parent 60970ff commit 73b1812

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@
159159
* <li>Files with base name "package.json" or "tsconfig.json", and files whose base name
160160
* is of the form "codeql-javascript-*.json".
161161
* <li>JavaScript, JSON or YAML files whose base name starts with ".eslintrc".
162+
* <li>JSON files whose base name is ".xsaccess".
162163
* <li>All extension-less files.
163164
* </ul>
164165
*
@@ -393,9 +394,10 @@ private void setupFilters() {
393394
for (FileType filetype : defaultExtract)
394395
for (String extension : filetype.getExtensions()) patterns.add("**/*" + extension);
395396

396-
// include .eslintrc files, package.json files, tsconfig.json files, and
397-
// codeql-javascript-*.json files
397+
// include .eslintrc files, .xaccess files, package.json files,
398+
// tsconfig.json files, and codeql-javascript-*.json files
398399
patterns.add("**/.eslintrc*");
400+
patterns.add("**/.xaccess");
399401
patterns.add("**/package.json");
400402
patterns.add("**/tsconfig*.json");
401403
patterns.add("**/codeql-javascript-*.json");

javascript/extractor/src/com/semmle/js/extractor/FileExtractor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ protected boolean contains(File f, String lcExt, ExtractorConfig config) {
184184
if (super.contains(f, lcExt, config)) return true;
185185

186186
// detect JSON-encoded configuration files whose name starts with `.` and ends with `rc`
187-
// (e.g., `.eslintrc` or `.babelrc`)
188-
if (f.isFile() && f.getName().matches("\\..*rc")) {
187+
// (e.g., `.eslintrc` or `.babelrc`) as well as `.xsaccess` files
188+
if (f.isFile() && f.getName().matches("\\..*rc|\\.xsaccess")) {
189189
try (BufferedReader br = new BufferedReader(new FileReader(f))) {
190190
// check whether the first two non-empty lines look like the start of a JSON object
191191
// (two lines because the opening brace is usually on a line by itself)

javascript/extractor/test/com/semmle/js/extractor/test/AutoBuildTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,10 @@ public void hiddenFolders() throws IOException {
461461

462462
@Test
463463
public void hiddenFiles() throws IOException {
464-
Path eslintrc = addFile(true, LGTM_SRC, ".eslintrc.json");
464+
Path eslintrc = addFile(true, LGTM_SRC, ".eslintrc.json", ".xsaccess");
465465
hide(eslintrc);
466+
Path xsaccess = addFile(true, LGTM_SRC, ".xsaccess");
467+
hide(xsaccess);
466468
runTest();
467469
}
468470

0 commit comments

Comments
 (0)