From ccfcad42d6932e5b81bd34f181ac51422c3531c3 Mon Sep 17 00:00:00 2001 From: Nathan Randall Date: Wed, 22 Jan 2025 15:14:49 -0700 Subject: [PATCH 1/2] Add flowchart in new extractors/README.md Adds a mermaid (markdown-formatted) flowchart to show the flow of execution for the current (shell-script-based) extractor implementation. Updates the root `.gitignore` file for this project and adds: - `extractors/.gitignore` - 'javascript/frameworks/cap/test/.gitignore' --- .gitignore | 1 + extractors/.gitignore | 5 +++ extractors/README.md | 45 +++++++++++++++++++++++ javascript/frameworks/cap/test/.gitignore | 3 ++ 4 files changed, 54 insertions(+) create mode 100644 extractors/.gitignore create mode 100644 extractors/README.md create mode 100644 javascript/frameworks/cap/test/.gitignore diff --git a/.gitignore b/.gitignore index 690edd40..2480fd52 100644 --- a/.gitignore +++ b/.gitignore @@ -62,6 +62,7 @@ typings/ # Misc .DS_Store +.*.swp dist/ tmp/ diff --git a/extractors/.gitignore b/extractors/.gitignore new file mode 100644 index 00000000..352cb7fa --- /dev/null +++ b/extractors/.gitignore @@ -0,0 +1,5 @@ +# Files to ignore under this "extractors" directory + +## Ignore the debug directory +debug/ + diff --git a/extractors/README.md b/extractors/README.md new file mode 100644 index 00000000..6c738b03 --- /dev/null +++ b/extractors/README.md @@ -0,0 +1,45 @@ +# codeql-sap-js:extractors/README.md + +## CodeQL CDS Extractor : Flowchart + +The following flowchart shows the flow of execution for the current implementation of the extractor. + +```mermaid +flowchart TD + COM["`export _build_cmd=
$(pwd)/extractors/ +javascript/tools/ +pre-finalize.sh`"] + DCR[codeql database create
--command=$_build_cmd
--language=javascript
--search-path=./extractors/
--
/path/to/database] + DB@{ shape: cyl, label: "/path/to/database" } + DINIT[codeql database init] + CRE[codeql resolve extractor] + DTRAC[codeql database
trace-command] + SPF[[pre-finalize.sh]] + JSE[[javascript extractor]] + SIF[[index-files.sh]] + DIDX[codeql database index-files
--language=cds
--include-extension=.cds] + CC[[\`cds\` compiler]] + CDJ([.cds.json files]) + TF([CodeQL TRAP files]) + DBF[codeql database finalize
-- /path/to/database] + + COM ==> DCR + DCR ==> |run internal CLI
plumbing command| DINIT + DINIT ----> |--language=javascript| CRE + CRE -..-> |/extractor/path/javascript| DINIT + DINIT -.initialize database.-> DB + + DINIT ==> |run the
javascript extractor| JSE + SPF ==> |run the cds extractor| DIDX + JSE -.-> |extract javascript files:
_.html, .js, .json, .ts_| DB + DTRAC ==> |run the build --command| SPF + JSE ==> |run autobuild within
the javascript extractor| DTRAC + DIDX ==> |script discovered
via --search-path| SIF + SIF ==> |call the cds compiler| CC + CC ==> |compile .cds files to
create .cds.json files| CDJ + CDJ -.-> |extract .cds.json files
to database| DB + + CDJ ==> |generate .trap files| TF + TF ==> |finalize database once
pre-finalize completes| DBF + DBF ==> |import TRAP files,
then cleanup| DB +``` diff --git a/javascript/frameworks/cap/test/.gitignore b/javascript/frameworks/cap/test/.gitignore new file mode 100644 index 00000000..3954570a --- /dev/null +++ b/javascript/frameworks/cap/test/.gitignore @@ -0,0 +1,3 @@ +# Ignore package-lock.json files for tests. +package-lock.json + From 6596fd71bb258158b1cedd3a5210c3140c944f3b Mon Sep 17 00:00:00 2001 From: Nathan Randall Date: Thu, 23 Jan 2025 06:06:14 -0700 Subject: [PATCH 2/2] Fix syntax error in extractors mermaid diagram --- extractors/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extractors/README.md b/extractors/README.md index 6c738b03..79632120 100644 --- a/extractors/README.md +++ b/extractors/README.md @@ -18,7 +18,7 @@ pre-finalize.sh`"] JSE[[javascript extractor]] SIF[[index-files.sh]] DIDX[codeql database index-files
--language=cds
--include-extension=.cds] - CC[[\`cds\` compiler]] + CC[[cds compiler]] CDJ([.cds.json files]) TF([CodeQL TRAP files]) DBF[codeql database finalize
-- /path/to/database]