# An Approach to Analyze Vulnerability of Information Flow in Software Architecture
## 3 Proposed Approach
### Algorithm for Determining Vulnerability of Information Flow in Architecture  
There are two major tasks in locating vulnerabilities based on the service invocation diagram: First, find all paths of information flow and propagation. Second, based on the confidentiality or integrity level of each vertex on the paths as well as the direction of information flow between adjacent vertices, locate vulnerabilities by looking for vertices that violate the security policies of information flow proposed above. In this paper, two algorithms are designed to identify and locate vulnerabilities in the service invocation diagram based on confidentiality and integrity policies. Key points of the algorithms are as follows:  
* Use all vertices with an in degree of 0 as initial vertices, and sort them. * Find paths that begin with these vertices with an in degree of 0 one by one. Stop until no vertices interact with these vertices. Then output these paths. Although the reading and writing operation (denoted by \"r and \"w\") will cause loops in the diagram, there is no need to iterate these loops when finding paths, because by traversing the loop once, services pairs that violate security policies will be located. So, when finding paths, we only consider the loops once. * Use these paths and determination rules under the goals of confidentiality or integrity as input. Compare the confidentiality or integrity levels of two adjacent vertices. For example, if the path is N\({}_{1}\), N\({}_{3}\), N\({}_{5}\), N\({}_{6}\), N\({}_{9}\), then compare with N\({}_{1}\)N\({}_{3}\), N\({}_{3}\)N\({}_{5}\), N\({}_{5}\)N\({}_{6}\), N\({}_{6}\)N\({}_{9}\), respectively, in which N stands for a node. * Save and output the vertices that conflict with determination rules, as well as their interaction relationships, until all vertices of each path are compared. Algorithm 1 is the algorithm for determining the vulnerability of information flow in architecture under the confidentiality policies. Algorithm 2 is the algorithm for determining the vulnerability of information flow in architecture under the confidentiality policies. ```
1:Input a graph, \(G\); initialize a list of paths allPaths and list of vulnerable nodes vNodes
2:\(i\gets 0\)
3:for each node \(n\) in \(G\)do
4:if in-degree of \(n\)=0 then
5:while adjacent node \(j\) of node \(n\) exists do
6:\(i\leftarrow\) FindPath(\(i\),\(n\),\(allPaths\))
7:\(i\gets i\)+1
8:endwhile
9:endif
10:endfor
11:for each path \(p\) in allPathsdo
12:for k \(\leftarrow\) 0 to p.length-2 do
13:if security level of \(p\)[k]<\(p\)[k+1] then
14: add \(p\)[\(k\)] in vNodes
15: add \(p\)[\(k\)+1] in vNodes
```  
**Algorithm 1** Determining vulnerability under confidentiality policies \begin{table}
\begin{tabular}{c c c c} \hline \hline \multirow{2}{*}{**Entity Impacted When Service Security is Compromised**} & \multicolumn{3}{c}{**Severity Level**} \\ \cline{2-4}  & **Medium** & **Critical** & **Extreme** \\ \hline Software system & Level 1 & Level 2 & Level 3 \\ \hline User & Level 2 & Level 3 & Level 4 \\ \hline Organization to which software system belongs & Level 3 & Level 4 & Level 5 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Determination matrix for service security level.