## 3 Methodology
### XSS Triggering in Source Code
The results show that when the number of estimators is greater than 10, the F1 score will reach its convergence and no longer increases. For the support vector classifier, we use the polynomial kernel (\(K(x,z)=(\gamma x\cdot z+r)^{d}\)) as the kernel function of the classifier. Compared with radial basis functions, polynomial kernel functions can also produce excellent classification results for nonlinear data distributions without introducing exponential operations of higher powers while reducing time complexity. Plus, we select the \"degree\" parameter of the polynomial kernel function in cross-validation by setting the degree of 2 and increasing by step of 1. The F1 score converges and reaches its highest value at the degree of 8. \begin{table}
\begin{tabular}{l c c c c c c} \hline \hline \multirow{2}{*}{**Experiments**} & \multicolumn{2}{c}{**Precision**} & \multicolumn{2}{c}{**Recall**} & \multirow{2}{*}{**Macro F1**} & \multirow{2}{*}{**Mean AUC**} \\ \cline{2-2} \cline{5-6}  & **Safe** & & & & & \\ \hline OPCODE & 0.9402 & 0.6211 & 0.5348 & 0.9493 & 0.7146 & 0.7615 \\ \hline OPCODE+SOURCE & 0.9408 & 0.6209 & 0.5345 & 0.9495 & 0.7148 & 0.7633 \\ \hline OPCODE+SOURCE+FILTER & 0.9435 & 0.6968 & 0.7062 & 0.9236 & 0.7991 & 0.8483 \\ \hline
**OPCODE+SOURCE+FILTER+SINK** & **0.9813** & **0.8659** & **0.8739** & **0.9785** & **0.9216** & **0.9726** \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Performance of different experiments. The neural network classifier can directly use the input of two-dimensional word vectors. However, unlike traditional machine learning classifiers, the time complexity of training to convergence for DNN tends to explode as the number of layers increases linearly. Considering this factor, for the convolution network used in the experiment, we set 2 Conv1D layers and 1 maximal pooling layer as a group. By increasing the number of groups gradually and recording the change of F1 score, the F1 score converges when the number of groups equals 3. For classifiers consisting of LSTM networks, we implemented the network structure of the above experiments and recorded the change curves of accuracy and loss. The visualization of experimental data for the hyperparameter selection of each classifier is given by Figures 4 and 5. The results show that the classifiers with time series attributes (LSTM and Bi-LSTM) have reached a high metric, showed in Table 5. It only shows the metrics under the best hyperparameter combination. Additionally, the Bi-LSTM classifier has the ability of two-way sequence learning, which can be used to deduce the combination of FILTER and SOURCE from SINK. Thus, it has reached the highest among all metrics. It is worth noting that the SVM-based classifier (SVC) also achieves an excellent score in this experiment. That is closely related to the strong fitting ability of the kernel learning mode of SVC to nonlinear high-dimensional data. Figure 4: Hyperparameter selection A.

Figure 5: Hyperparameter selection B. On the other hand, we consider that the time consumption of neural networks in the training process is significantly higher than the traditional classifier. For the classifier based on a one-dimensional convolutional neural network, the network will reach its converge point after 20 rounds of training. For the classifier based on the LSTM network, we notice that its convergence time is often longer and more hardware resources are consumed. However, the purpose of the static code audit is to make coders improve the efficiency of vulnerability checks. Unlike the XSS attack load in network traffic, the static audit does not require that high instantaneity. Besides, the neural network classifier based on Bi-LSTM performs significantly better than other classifiers on our evaluations. As a conclusion, we suppose such a time consumption is reasonable and acceptable. Besides, the code audit is generally performed after the program source code is finished, which will not affect the application in the production environment.