Skip to content

Commit d5a1018

Browse files
committed
Reorganize documentation of taint analysis
1 parent 2a74a95 commit d5a1018

File tree

1 file changed

+61
-51
lines changed

1 file changed

+61
-51
lines changed

Diff for: docs/en/taint-analysis.adoc

+61-51
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,16 @@ This documentation is dedicated to providing guidance on using our taint analysi
99

1010
== Enabling Taint Analysis
1111

12+
Taint analysis can be enabled in one of two ways, or both approaches together:
13+
14+
* using the YAML configuration file.
15+
16+
* using the programmatic configuration provider.
17+
18+
=== YAML Configuration File
19+
1220
In Tai-e, taint analysis is designed and implemented as a plugin of pointer analysis framework.
13-
To enable taint analysis, simply start pointer analysis with option `taint-config`, for example:
21+
To enable taint analysis with the YAML configuration file, simply start pointer analysis with option `taint-config`, for example:
1422

1523
[source]
1624
----
@@ -23,6 +31,58 @@ In the upcoming section, we will provide a comprehensive guide on crafting a con
2331
TIP: You could use various pointer analysis techniques to obtain different precision/efficiency tradeoffs.
2432
For additional details, please refer to <<pointer-analysis-framework#pointer-analysis-framework,Pointer Analysis Framework>>.
2533

34+
35+
==== Interactive Mode
36+
37+
Interactive mode enables users to modify the taint configuration file(s) and re-run taint analysis without needing to re-run the whole program analysis.
38+
39+
This feature significantly speeds up both taint configuration development/debugging and production scenarios that running multiple configuration sets.
40+
41+
To enable interactive mode, append additional `taint-interactive-mode:true` option when starting the taint analysis, for example:
42+
43+
[source]
44+
----
45+
-a pta=...;taint-config:<path/to/config>;taint-interactive-mode:true;...
46+
----
47+
48+
Once the taint analysis completes, Tai-e will enter an interactive state where you can:
49+
50+
1. Modify the taint configuration file(s) and press `r` in the console to re-run the taint analysis with your updated configuration.
51+
2. Press `e` in the console to exit interactive mode.
52+
53+
54+
=== Programmatic Taint Configuration Provider
55+
56+
In addition to the YAML configuration file, Tai-e also supports programmatic taint configuration.
57+
58+
To enable it, start pointer analysis with option `taint-config-providers`, for example:
59+
60+
[source]
61+
----
62+
-a pta=...;taint-config-providers:[my.example.MyTaintConfigProvider];...
63+
----
64+
65+
The class `my.example.MyTaintConfigProvider` should extend the interface `pascal.taie.analysis.pta.plugin.taint.TaintConfigProvider`.
66+
67+
[source,java,subs="verbatim"]
68+
----
69+
package my.example;
70+
71+
public class MyTaintConfigProvider extends TaintConfigProvider {
72+
public MyTaintConfigProvider(ClassHierarchy hierarchy, TypeSystem typeSystem) {
73+
super(hierarchy, typeSystem);
74+
}
75+
76+
@Override
77+
protected List<Source> sources() { return List.of(); }
78+
79+
@Override
80+
protected List<Sink> sinks() { return List.of(); }
81+
// ...
82+
}
83+
----
84+
85+
2686
== Configuring Taint Analysis
2787

2888
In this section, we present instructions on configuring sources, sinks, taint transfers, and sanitizers for the taint analysis using a YAML configuration file.
@@ -368,56 +428,6 @@ Users can simply place all relevant configuration files within a designated dire
368428
TIP: The taint analysis will traverse the directory iteratively during the configuration loading process.
369429
Therefore, you have the flexibility to organize the configuration files as you see fit, including placing them in multiple subdirectories if desired.
370430

371-
=== Programmatic Taint Configuration Provider
372-
373-
In addition to the YAML configuration file, Tai-e also supports programmatic taint configuration.
374-
375-
To enable it, start pointer analysis with option `taint-config-providers`, for example:
376-
377-
[source]
378-
----
379-
-a pta=...;taint-config-providers:[my.example.MyTaintConfigProvider];...
380-
----
381-
382-
The class `my.example.MyTaintConfigProvider` should extend the interface `pascal.taie.analysis.pta.plugin.taint.TaintConfigProvider`.
383-
384-
[source,java,subs="verbatim"]
385-
----
386-
package my.example;
387-
388-
public class MyTaintConfigProvider extends TaintConfigProvider {
389-
public MyTaintConfigProvider(ClassHierarchy hierarchy, TypeSystem typeSystem) {
390-
super(hierarchy, typeSystem);
391-
}
392-
393-
@Override
394-
protected List<Source> sources() { return List.of(); }
395-
396-
@Override
397-
protected List<Sink> sinks() { return List.of(); }
398-
// ...
399-
}
400-
----
401-
402-
=== Interactive Mode
403-
404-
Interactive mode enables users to modify the taint configuration file(s) and re-run taint analysis without needing to re-run the whole program analysis.
405-
406-
This feature significantly speeds up both taint configuration development/debugging and production scenarios that running multiple configuration sets.
407-
408-
To enable interactive mode, append additional `taint-interactive-mode:true` option when starting the taint analysis, for example:
409-
410-
[source]
411-
----
412-
-a pta=...;taint-config:<path/to/config>;taint-interactive-mode:true;...
413-
----
414-
415-
Once the taint analysis completes, Tai-e will enter an interactive state where you can:
416-
417-
1. Modify the taint configuration file(s) and press `r` in the console to re-run the taint analysis with your updated configuration.
418-
2. Press `e` in the console to exit interactive mode.
419-
420-
421431
== Output of Taint Analysis
422432
Currently, the output of the taint analysis consists of two parts: console output and taint flow graph.
423433

0 commit comments

Comments
 (0)