Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 41 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,26 +248,28 @@ atom -o app.atom -l java --export-atom --export-dir <export dir> --with-data-dep

## Environment variables

| Variable | Description |
| ------------------------------ | --------------------------------------------------------------------------------------------------- |
| **CHEN_IGNORE_TEST_DIRS** | Set to true to ignore `test` directories. Only supported for Python for now. |
| **CHEN_PYTHON_IGNORE_DIRS** | Comma-separated list of directories to ignore for Python. |
| **CHEN_DELOMBOK_MODE** | Delombok mode for the Java frontend (`no-delombok`, `default`, `types-only`, `run-delombok`). |
| **CHEN_INCLUDE_PATH** | Include directories for the C frontend. Separate paths with `:` or `;`. |
| **ATOM_TOOLS_OPENAPI_FORMAT** | OpenAPI format for atom-tools. Default: `openapi3.1.0`; alternative: `openapi3.0.1`. |
| **ATOM_TOOLS_WORK_DIR** | Working directory for atom-tools. Defaults to atom input path. |
| **ATOM_SCALASEM_WORK_DIR** | Working directory for scalasem. Defaults to atom input path. |
| **ATOM_SCALASEM_SLICES_FILE** | Slices file name. Defaults to `semantics.slices.json`. |
| **ATOM_JVM_ARGS** | Overrides the JVM arguments, including heap memory values, constructed by the atom Node.js wrapper. |
| **ATOM_JAVA_HOME** | Java 21 or above to be used by atom. |
| **PHP_CMD** | Overrides the PHP command used by the PHP frontend. |
| **PHP_PARSER_BIN** | Overrides the php-parse command used by the PHP frontend. |
| **SCALA_CMD** | Overrides the scala command. |
| **SCALAC_CMD** | Overrides the scalac command used by the scala frontend. |
| **ASTGEN_IGNORE_DIRS** | Comma-separated list of directories to ignore by the JavaScript astgen pre-processor command. |
| **ASTGEN_IGNORE_FILE_PATTERN** | File pattern to ignore by the JavaScript astgen pre-processor command. |
| **JAVA_CMD** | Overrides the java command. |
| **RUBY_CMD** | Overrides the Ruby command. |
| Variable | Description |
| ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **CHEN_IGNORE_TEST_DIRS** | Set to true to ignore `test` directories. Only supported for Python for now. |
| **CHEN_PYTHON_IGNORE_DIRS** | Comma-separated list of directories to ignore for Python. |
| **CHEN_DELOMBOK_MODE** | Delombok mode for the Java frontend (`no-delombok`, `default`, `types-only`, `run-delombok`). |
| **CHEN_INCLUDE_PATH** | Include directories for the C frontend. Separate paths with `:` or `;`. |
| **CHEN_ASTGEN_OUT** | Existing astgen output directory. Improves performance for JavaScript, TypeScript, and Flow during repeated invocations by reusing existing AST json data. |
| **ATOM_TOOLS_OPENAPI_FORMAT** | OpenAPI format for atom-tools. Default: `openapi3.1.0`; alternative: `openapi3.0.1`. |
| **ATOM_TOOLS_WORK_DIR** | Working directory for atom-tools. Defaults to atom input path. |
| **ATOM_SCALASEM_WORK_DIR** | Working directory for scalasem. Defaults to atom input path. |
| **ATOM_SCALASEM_SLICES_FILE** | Slices file name. Defaults to `semantics.slices.json`. |
| **ATOM_JVM_ARGS** | Overrides the JVM arguments, including heap memory values, constructed by the atom Node.js wrapper. |
| **ATOM_JAVA_HOME** | Java 21 or above to be used by atom. |
| **PHP_CMD** | Overrides the PHP command used by the PHP frontend. |
| **PHP_PARSER_BIN** | Overrides the php-parse command used by the PHP frontend. |
| **SCALA_CMD** | Overrides the scala command. |
| **SCALAC_CMD** | Overrides the scalac command used by the scala frontend. |
| **ASTGEN_IGNORE_DIRS** | Comma-separated list of directories to ignore by the JavaScript astgen pre-processor command. |
| **ASTGEN_IGNORE_FILE_PATTERN** | File pattern to ignore by the JavaScript astgen pre-processor command. |
| **ASTGEN_INCLUDE_NODE_MODULES_BUNDLES ** | Also include source code from node_modules directory. Makes the flows more complete at the cost of increased memory use. |
| **JAVA_CMD** | Overrides the java command. |
| **RUBY_CMD** | Overrides the Ruby command. |

## atom Specification

Expand Down Expand Up @@ -345,6 +347,25 @@ devenv --option config.profile:string ruby shell
devenv --option config.profile:string php shell
```

## Troubleshooting

### atom file is incomplete for large projects

astgen might require a generous heap of memory for large JavaScript projects, especially flow projects. Use the environment variable `NODE_OPTIONS` to increase the memory available.

```bash
export NODE_OPTIONS="--expose-gc --max-old-space-size=16288"
```

For large projects such as React 19, astgen requires over 80 GB of heap memory! Use the environment variable `CHEN_ASTGEN_OUT` to make atom and chen, reuse any existing directory containing astgen generated json and typemap files.

To improve the accuracy further, include source code from the `node_modules` directory by setting `ASTGEN_INCLUDE_NODE_MODULES_BUNDLES`.

```bash
export ASTGEN_INCLUDE_NODE_MODULES_BUNDLES=true
export ASTGEN_IGNORE_DIRS=""
```

## Enterprise support

Enterprise support including custom language development and integration services is available via AppThreat Ltd.
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ThisBuild / organization := "io.appthreat"
ThisBuild / version := "2.4.5"
ThisBuild / scalaVersion := "3.7.4"

val chenVersion = "2.5.7"
val chenVersion = "2.5.8"

lazy val atom = Projects.atom

Expand Down
1 change: 0 additions & 1 deletion docs/docs/atom-tools/Features/convert.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@ Help:
**Example**

> `atom-tools convert -i usages.slices.json -f openapi3.0.1 -o openapi_usages.json -t java -s https://myserver.com`

21 changes: 11 additions & 10 deletions docs/docs/atom-tools/Features/filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ title: Filter
The filter command can be run on its own to produce a filtered slice or used before another command
to filter a slice before executing another command against the results.

>**Filters operate on an inclusive-or basis. If you want to operate on an 'and' basis,
> **Filters operate on an inclusive-or basis. If you want to operate on an 'and' basis,
> [chain](#chaining-filter-commands) the filter commands.**

**Mode**

The default mode creates a regular expression from the value given. Fuzzy mode is specified using
the -f option and a number between 0-100 indicating how close the result must be to be a match.
Note that to exactly match the specified input, you need to either include regex anchors at the
the -f option and a number between 0-100 indicating how close the result must be to be a match.
Note that to exactly match the specified input, you need to either include regex anchors at the
beginning and end or use -f 100 (to specify a 100% match).

`filter -f 100 --criteria filename=path/to/file/server.ts -i usages.json`
Expand All @@ -27,7 +27,7 @@ Regex word boundaries can be used if you only want to be exact about the filenam

This will filter files named server.ts - without the \b, files like ftpserver.ts would also be matched.

>Note: You can search for a file name without including the path if needed and fuzzing ratios will be computed based
> Note: You can search for a file name without including the path if needed and fuzzing ratios will be computed based
> only on the file name.

##### Chaining filter commands
Expand All @@ -45,7 +45,8 @@ This would be equivalent to

##### Available attributes (not case-sensitive):

*For usages slices*
_For usages slices_

- callName
- fileName
- fullName
Expand All @@ -54,14 +55,14 @@ This would be equivalent to
- signature

| attribute | locations searched | reachables locations |
|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------|
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------- | --- | --- |
| callName | objectSlices.usages.argToCalls<br/>objectSlices.usages.invokedCalls<br/>userDefinedTypes.procedures, | |
| fileName | objectSlices<br/>userDefinedTypes | | |
| fileName | objectSlices<br/>userDefinedTypes | | |
| fullName | objectSlices | |
| name | objectSlices.usages.targetObj<br/>objectSlices.usages.definedBy<br/>userDefinedTypes.fields | |
| purl | | reachables.purls<br/>reachables.flows.tags |
| resolvedMethod | objectSlices.usages.targetObj<br/>objectSlices.usages.definedBy<br/>objectSlices.usages.argToCalls<br/>objectSlices.usages.invokedCalls<br/>userDefinedTypes.procedures | |
| signature | objectSlices | | | |
| signature | objectSlices | | | |

#### Searching reachables for package name/version

Expand Down Expand Up @@ -126,7 +127,7 @@ the following:**_

`atom-tools filter --criteria fileName!=server.ts usages.slices.json convert -f openapi3.0.1 -o openapi_usages.json -t java `

****_Multiple filter criteria may be included. The following example will produce a filtered slice based
only on server.ts and router.ts slices._****
\***\*_Multiple filter criteria may be included. The following example will produce a filtered slice based
only on server.ts and router.ts slices._\*\***

`atom-tools filter --criteria fileName=server.ts,callName=router.ts usages.slices.json`
3 changes: 2 additions & 1 deletion docs/docs/atom-tools/Features/query.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ title: Query Endpoints
---

## Query Endpoints

Query endpoints generates a list of endpoints and returns the output directly to the console.

>Note: To suppress logging messages and ONLY output the results, use --quiet/-q
> Note: To suppress logging messages and ONLY output the results, use --quiet/-q

**_Examples_**

Expand Down
3 changes: 2 additions & 1 deletion docs/docs/atom-tools/Features/validate.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ Options:
--no-ansi Disable ANSI output.
-n, --no-interaction Do not ask any interactive question.
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.

Help:
Validate source file line numbers in an atom usages or reachables slice.
```

**Example**

> `atom-tools validate-lines -t java -j project_json_report.json -i usages.slices.json -d /home/my_project_dir`
2 changes: 1 addition & 1 deletion docs/docs/atom-tools/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ Available commands:
list Lists commands.
query-endpoints List elements to display in the console.
validate-lines Check the accuracy of the line numbers in an atom slice.
```
```
4 changes: 2 additions & 2 deletions docs/docs/atom-tools/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ the [AppThreat/atom](https://github.com/AppThreat/atom?tab=readme-ov-file) GitHu

Atom can easily be installed from
a [native image](https://github.com/AppThreat/atom#atom-native-image) or via
npm
npm

```bash
npm install -g @appthreat/atom
```
Expand All @@ -25,4 +26,3 @@ npm install -g @appthreat/atom
```bash
pip install atom-tools
```

Loading