|
1 | | -# CIR Demo Workspace |
| 1 | +# CIR Demo |
2 | 2 |
|
3 | | -This workspace contains three projects: |
| 3 | +An interactive web-based platform for exploring C/C++ code analysis using Clang IR. This demo provides a syntax-highlighted code editor where you can write or load C++ examples, analyze them with [Theta](https://github.com/ftsrg/theta) via Clang-based tools, and visualize the results. |
4 | 4 |
|
5 | | -- `backend` - Node.js Express server that serves example C++ files and exposes endpoints to run clang-related commands (placeholders provided). |
6 | | -- `frontend` - React + Vite web UI with a syntax-highlighted C++ editor (Monaco), resizable panes, tabs for outputs, and Material-like UI. |
7 | | -- `xcfa-mapper` - A minimal C++ project that will eventually convert clang IR elements to "xcfa". Currently prints "work in progress". |
| 5 | +## What's Inside |
8 | 6 |
|
9 | | -See the README in each subfolder for usage details. |
10 | | -See the README in each subfolder for usage details. |
| 7 | +- **Web Interface**: React-based UI with Monaco editor for C++ code editing |
| 8 | +- **Analysis Backend**: Node.js server that processes code using Clang/LLVM toolchain and Theta |
| 9 | +- **XCFA Mapper**: Converts Clang IR to extended control flow automata (XCFA) format (in C syntax currently) |
| 10 | +- **Example Library**: Pre-loaded C++ examples demonstrating various language features (templates, inheritance, STL containers, etc.) |
11 | 11 |
|
12 | | -Deployment (Docker + TLS + Basic auth) |
13 | | -------------------------------------- |
| 12 | +## Getting Started |
14 | 13 |
|
15 | | -We provide simple helper scripts to run this workspace in Docker with TLS (self-signed) |
16 | | -and HTTP Basic authentication. |
| 14 | +### Prerequisites |
17 | 15 |
|
18 | | -1) Generate a self-signed certificate (default CN=localhost): |
| 16 | +- Docker and Docker Compose installed on your system |
19 | 17 |
|
20 | | - `./docker/generate-cert.sh` |
| 18 | +### Quick Start |
21 | 19 |
|
22 | | - Optionally set subject CN: |
| 20 | +1. **Start the application**: |
| 21 | + ```bash |
| 22 | + docker compose up -d |
| 23 | + ``` |
23 | 24 |
|
24 | | - `SUBJ="/CN=your.host.name" ./docker/generate-cert.sh` |
| 25 | +2. **Access the web interface**: |
| 26 | + - Open your browser and navigate to `https://localhost:3333` |
| 27 | + - Your browser will warn about the self-signed certificate—accept it to proceed |
| 28 | + - Login with the default credentials: |
| 29 | + - **Username**: `admin` |
| 30 | + - **Password**: `admin` |
25 | 31 |
|
26 | | -2) Generate credentials (username + password): |
| 32 | +3. **Start exploring**: |
| 33 | + - Load example C++ files from the library |
| 34 | + - Write your own C++ code in the editor |
| 35 | + - Run analysis tools and view the results |
27 | 36 |
|
28 | | - `./docker/generate-credentials.sh alice s3cr3t` |
| 37 | +### Stopping the Application |
29 | 38 |
|
30 | | - This writes: |
31 | | - - docker/nginx/.htpasswd (used by nginx) |
32 | | - - backend/config/credentials.json (used by backend Express middleware) |
| 39 | +```bash |
| 40 | +docker compose down |
| 41 | +``` |
33 | 42 |
|
34 | | -3) Make helper scripts executable (optional): |
| 43 | +## Notes |
35 | 44 |
|
36 | | - `./docker/setup-perms.sh` |
37 | | - |
38 | | -4) Build and start the stack: |
39 | | - |
40 | | - `docker compose build --no-cache` |
41 | | - `docker compose up -d` |
42 | | - |
43 | | -5) Visit the site at https://localhost:3333 (your browser will warn about the self-signed cert). Use the username/password from step 2. |
44 | | - |
45 | | -Notes |
46 | | -- The backend credentials file is stored as plaintext JSON for simplicity in this demo. For production, use Docker secrets or a secrets manager and store only password hashes. |
47 | | -- For production use a CA-signed certificate (Let's Encrypt / internal CA) instead of the self-signed cert. |
| 45 | +- The application uses a self-signed TLS certificate for HTTPS |
| 46 | +- Default credentials are for demonstration purposes only |
| 47 | +- All container images are pre-built and pulled automatically |
0 commit comments