Skip to content

Commit d883d15

Browse files
authored
Improve blog post (#147)
* :focus: Fixed blog and image * fixed blog post and index page
1 parent 03eb73c commit d883d15

File tree

3 files changed

+42
-20
lines changed

3 files changed

+42
-20
lines changed
152 KB
Loading

docs/src/content/docs/blog/codeql-oss-alternative.mdx

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,56 +13,55 @@ import PostHogLayout from '../../../layouts/PostHogLayout.astro';
1313

1414
## What is Code PathFinder?
1515

16-
Code PathFinder is a code analysis tool that helps you find exact code pattern and paths in your codebase. While there are several ways to
17-
grep source code, having source code broken down into individual entities, building graph & edges which helps in building
16+
Code PathFinder is a code analysis tool that helps you find exact code patterns and paths in your codebase. While there are several ways to
17+
grep source code, having source code broken down into individual entities, building graphs & edges which help in establishing
1818
relationships between entities, imitates the way a human reads code.
1919

20+
### How do security engineers interact with codebases today?
2021

21-
### How do security engineers interact with codebase today?
22-
23-
If you generically think about how engineers interact with codebase, it is something like this:
22+
If you think about how engineers generally interact with a codebase, it typically follows this process:
2423

2524
1. Start by searching for a symbol
2625
2. Resolve the symbol to an entity such as a class or function
2726
3. Find the entity's definition
2827
4. Find the entity's references across the codebase and often across multiple repositories
2928
5. Determine the flow of the code
3029
- 5A. Have a source in mind such as user inputs, database, or a file or even network operations
31-
- 5B. Have a sink in mind such as above symbols definition
30+
- 5B. Have a sink in mind such as the above symbol's definition
3231
- 5C. Determine the flow of the code including method jumps, method calls, and method returns
33-
- 5D. Identify if there is any blocker in between such as conditions, loops, etc
32+
- 5D. Identify if there are any blockers in between such as conditions, loops, etc.
3433
6. Identify the variables that are modified and the variables that are used within the flow
3534

36-
Representing it technically as a graph, can be more useful in finding the flow of the code. Moreover, the relationship as edges
35+
Representing this process technically as a graph can be more useful in finding the flow of the code. Moreover, the relationships as edges
3736
between entities can be used as conditions to focus on the paths that are relevant to the source and sink.
3837

39-
For example, Find code pattern where `Socket` class is instantiated and `send` method is called on it and get me all enclosing methods.
38+
For example, to find a code pattern where the `Socket` class is instantiated and the `send` method is called on it, and to get all enclosing methods, you could use:
39+
4040

41-
```sql
4241
SELECT MethodInvocation AS mi, MethodDeclaration AS md, ClassInstanceExpr AS ci
4342
WHERE
4443
ci.getClassInstanceExpr().getClassName() = "Socket" &&
4544
mi.getMethodName() = "send" && mi.getEnclosingMethod() = md
4645
mi.getMethodInvocation().getObject() = ci
4746
SELECT MethodDeclaration AS md, MethodInvocation AS mi
48-
```
49-
The above query will return all the enclosing methods of the `send` method in the `Socket` class and invoked call to `send` method.
50-
The above entities such as `MethodInvocation`, `MethodDeclaration`, `ClassInstanceExpr` are called as entities and they are represented as nodes in the graph.
51-
The edges between the nodes are represented as relationships between the entities.
47+
48+
The above query will return all the enclosing methods of the `send` method in the `Socket` class and invoked calls to the `send` method.
49+
The entities such as `MethodInvocation`, `MethodDeclaration`, and `ClassInstanceExpr` are called entities and are represented as nodes in the graph.
50+
The edges between the nodes represent relationships between the entities.
5251

5352
### How does Code PathFinder work?
5453

5554
Code Pathfinder uses tree-sitter to parse the source code and build a graph of the code. The graph is then used to find answers to queries.
5655
Similar to SQL, Code Pathfinder uses a query language to filter and apply conditions to the graph nodes logically. Sometimes, it generates
57-
cartesian product of the graph nodes to retrieve all possible combinations and apply the conditions in order to find the paths in code.
58-
While there are lot of APIs yet to be implemented, lacks support for classes and inheritance, Code Pathfinder is currently equipped with
56+
a cartesian product of the graph nodes to retrieve all possible combinations and applies the conditions in order to find the paths in code.
57+
While there are still many APIs yet to be implemented and it lacks support for classes and inheritance, Code Pathfinder is currently equipped with
5958
the following features:
6059

6160
- Predicates
6261
- Complex conditions
6362
- Aliases
6463

64+
![Code-Pathfinder Process Illustration](/assets/codepathfinder-process.png)
65+
6566
If you are interested in contributing to Code Pathfinder, please check out the [Code Pathfinder](https://github.com/shivasurya/code-pathfinder) repository.
6667
Give it a try and file an issue if you find any bugs or have any suggestions.
67-
68-

docs/src/content/docs/index.mdx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,22 @@ import PostHogLayout from '../../layouts/PostHogLayout.astro';
2323
<PostHogLayout>
2424
</PostHogLayout>
2525

26+
2627
```shell
2728
Code-PathFinder Console:
2829
> FROM method_declaration AS md
2930
WHERE md.getVisibility() == "public" && md.getName() == "main"
3031
SELECT md, "Listing all main methods"
3132

3233
public static void main(String[] args) {
33-
System.out.println("\"Set thy heart upon thy work, but never on its reward.\" - Bhagavad Gita, Chapter 2, Verse 47");
34+
System.out.println("\"Set thy heart upon thy work,");
35+
System.out.println("but never on its reward.\" - Bhagavad Gita, Chapter 2, Verse 47");
3436
}
3537
```
3638

39+
<div style="text-align: center;">
3740
## Features
38-
41+
</div>
3942
<CardGrid stagger>
4043
<Card title="Craft Queries" icon="pencil">
4144
Strengthen your code’s integrity with robust security checks and insights.
@@ -50,3 +53,23 @@ public static void main(String[] args) {
5053
Detect and prevent vulnerabilities by tracing sensitive data paths.
5154
</Card>
5255
</CardGrid>
56+
57+
<br/>
58+
<div style="text-align: center;">
59+
## Latest Blog Posts
60+
61+
</div>
62+
63+
64+
<CardGrid>
65+
<div style="border-radius: 10px; overflow: hidden; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);">
66+
<img src="/assets/cpf-illustration.jpg" alt="Getting Started" style="width: 100%; height: 200px; object-fit: cover;" />
67+
<div style="padding: 16px;">
68+
<h4>CodeQL Opensource Alternative</h4>
69+
<a href="/blog/codeql-oss-alternative" style="display: inline-block; background-color: #4CAF50; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px; margin-top: 10px;">
70+
<span style="font-size: 1.2em;">More →</span>
71+
</a>
72+
</div>
73+
</div>
74+
</CardGrid>
75+

0 commit comments

Comments
 (0)