Skip to content

Commit 8a89ea0

Browse files
committed
Initial commit
0 parents  commit 8a89ea0

File tree

22 files changed

+6988
-0
lines changed

22 files changed

+6988
-0
lines changed

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# OpenAI API key used for translation. Leave empty or omit to disable translation features.
2+
VITE_OPENAI_API_KEY=sk-your-openai-api-key-here

.github/workflows/deploy.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build-and-deploy:
19+
runs-on: ubuntu-latest
20+
environment:
21+
name: github-pages
22+
url: ${{ steps.deployment.outputs.page_url }}
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Setup pnpm
29+
uses: pnpm/action-setup@v4
30+
with:
31+
version: latest
32+
33+
- name: Setup Node.js
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: 20
37+
cache: pnpm
38+
cache-dependency-path: pnpm-lock.yaml
39+
40+
- name: Install dependencies
41+
run: pnpm install --frozen-lockfile
42+
43+
- name: Type check and build
44+
run: pnpm run build
45+
46+
- name: Setup Pages
47+
uses: actions/configure-pages@v5
48+
49+
- name: Upload artifact
50+
uses: actions/upload-pages-artifact@v3
51+
with:
52+
path: dist
53+
54+
- name: Deploy to GitHub Pages
55+
id: deployment
56+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
dist
3+
.env
4+
.DS_Store

.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
onlyBuiltDependencies:
2+
- esbuild
3+
- core-js

LICENSE

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
2+
3+
This license allows others to copy and redistribute the material in any medium or format as
4+
long as attribution is given to the original author and the use is non-commercial. Adaptations
5+
and modifications are permitted under the same terms, but any commercial use or distribution
6+
is prohibited without separate permission.
7+
8+
Full license text:
9+
https://creativecommons.org/licenses/by-nc/4.0/legalcode
10+
11+
---
12+
13+
© 2026 Vytenis Kučiauskas. All rights reserved.
14+
15+
This software is provided "as-is" without any express or implied warranty. In no event shall
16+
the authors be held liable for any damages arising from the use of this software.

README.md

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# 🛡️ Audit Report Generator
2+
3+
A browser-based tool for composing, previewing, and exporting security audit reports. Upload structured Markdown issue files, edit them in a live preview, translate content, and export polished PDF or DOCX reports — all client-side with zero backend.
4+
5+
## Features
6+
7+
- **Drag & drop Markdown upload** — bulk-import `.md` issue files that follow the expected template
8+
- **Live preview** — WYSIWYG preview grouped by category with a navigable Table of Contents
9+
- **Inline editing** — click any field (title, description, code, severity, etc.) to edit in place
10+
- **Severity badges** — color-coded Critical / High / Medium / Low / Info indicators
11+
- **Code highlighting** — syntax-highlighted code blocks via [highlight.js](https://highlightjs.org/)
12+
- **AI translation** — translate individual fields or entire pages via OpenAI (requires API key; controls are disabled when the key is not set)
13+
- **Finding ID reindexing** — bulk-reindex IDs with a configurable prefix and category-based numbering
14+
- **PDF export** — pixel-perfect A4 PDF with clickable TOC links (html2canvas + jsPDF)
15+
- **DOCX export** — structured Word document with TOC, bookmarks, and styled tables (docx + file-saver)
16+
- **Markdown export** — download individual issues back as `.md` files
17+
- **Bulk Markdown download** — download all issues (with edits) as a single `.zip` archive
18+
- **Auto-save** — all state is persisted to `localStorage` with debounced saving
19+
- **Dirty tracking** — per-field modification indicators with one-click restore to original
20+
- **Add blank pages** — create new issue pages from scratch without uploading a file
21+
- **Collapsible file list** — uploaded files panel collapses to save screen space
22+
- **Scroll to top** — floating button appears after scrolling down
23+
24+
## Tech Stack
25+
26+
| Layer | Technology |
27+
| ----------- | ----------------------------------- |
28+
| Framework | React 18 |
29+
| Language | TypeScript (strict mode) |
30+
| Build tool | Vite 6 |
31+
| Package mgr | pnpm |
32+
| PDF | html2canvas + jsPDF |
33+
| DOCX | docx + file-saver |
34+
| ZIP | JSZip + file-saver |
35+
| Syntax HL | highlight.js |
36+
| Translation | OpenAI API (`gpt-4o-mini`) |
37+
| Deployment | GitHub Pages (GitHub Actions CI/CD) |
38+
39+
## Getting Started
40+
41+
### Prerequisites
42+
43+
- [Node.js](https://nodejs.org/) >= 18
44+
- [pnpm](https://pnpm.io/) >= 8
45+
46+
### Install & Run
47+
48+
```sh
49+
pnpm install
50+
pnpm dev
51+
```
52+
53+
The app opens at [http://localhost:3000](http://localhost:3000).
54+
55+
### Build
56+
57+
```sh
58+
pnpm build
59+
```
60+
61+
Runs TypeScript type checking (`tsc --noEmit`) followed by `vite build`. Output goes to `dist/`.
62+
63+
### Preview Production Build
64+
65+
```sh
66+
pnpm preview
67+
```
68+
69+
## Markdown Template
70+
71+
Each issue `.md` file should follow this structure. A copy is embedded in the app (see `src/templates/template.md`) and can be downloaded from the UI.
72+
73+
### Template Fields
74+
75+
| Field | Description |
76+
| ------------------ | --------------------------------------------------------------- |
77+
| `Issue title` | Short name of the finding |
78+
| `Overall Risk` | Severity level: Critical, High, Medium, Low, or Info |
79+
| `Impact` | Impact rating |
80+
| `Exploitability` | How easily the issue can be exploited |
81+
| `Finding ID` | Unique identifier (e.g. `NFQ-0001`) |
82+
| `Component` | Affected file, service, or module |
83+
| `Category` | Grouping category (e.g. Security, Infrastructure, CI/CD) |
84+
| `Status` | Current status (e.g. New, In Progress, Resolved) |
85+
| `Additional Issue` | Optional extra rows in the severity table (`Title \| Severity`) |
86+
| `Impact details` | Bullet list of impacts |
87+
| `Description` | Detailed explanation with optional `Evidence:` link |
88+
| `Code example` | Fenced code block with language tag |
89+
| `Example scenario` | Realistic exploitation or failure scenario |
90+
| `Recommendation` | Bullet list of remediation steps |
91+
92+
## Translation (Optional)
93+
94+
The app can translate issue content to any language using the OpenAI API.
95+
96+
1. Create a `.env` file in this directory:
97+
98+
```sh
99+
VITE_OPENAI_API_KEY=sk-...
100+
```
101+
102+
2. Select a target language in the preview header (default: Lithuanian).
103+
104+
3. Use the 🌐 button on any field or page, or press <kbd>Cmd+Shift+L</kbd> / <kbd>Ctrl+Shift+L</kbd> while editing.
105+
106+
> **Note:** The API key is used client-side via `dangerouslyAllowBrowser`. This is acceptable for internal tooling but should not be used in public-facing deployments. Never commit your `.env` file.
107+
108+
## Deployment
109+
110+
The project includes a GitHub Actions workflow (`.github/workflows/deploy.yml`) that automatically builds and deploys to GitHub Pages on every push to `main`.
111+
112+
### Setup
113+
114+
1. Push this repository to GitHub.
115+
2. Go to **Settings → Pages** and set **Source** to **GitHub Actions**.
116+
3. Push to `main` — the workflow will build and deploy automatically.
117+
118+
## Project Structure
119+
120+
```
121+
web/
122+
├── index.html # Entry HTML
123+
├── package.json
124+
├── pnpm-lock.yaml
125+
├── tsconfig.json # TypeScript configuration (strict)
126+
├── vite.config.js # Vite config (base: "./" for Pages)
127+
└── src/
128+
├── main.tsx # React DOM entry point
129+
├── App.tsx # Main application component
130+
├── Editable.tsx # Inline-editable components (text, block, code, severity)
131+
├── parseIssue.ts # Markdown parser, grouping, severity helpers
132+
├── generatePdf.ts # PDF generation (html2canvas + jsPDF)
133+
├── generateDocx.ts # DOCX generation (docx library)
134+
├── translate.ts # OpenAI translation client
135+
├── types.ts # Shared TypeScript interfaces
136+
├── templates/template.md # Markdown issue template (source of truth)
137+
├── index.css # All styles
138+
└── vite-env.d.ts # Vite/TypeScript env declarations
139+
```
140+
141+
## License
142+
143+
Private — internal use only.

index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Audit Report Generator</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script type="module" src="/src/main.tsx"></script>
11+
</body>
12+
</html>

package.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "audit-report-generator",
3+
"private": true,
4+
"version": "1.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "tsc --noEmit && vite build",
9+
"preview": "vite preview"
10+
},
11+
"dependencies": {
12+
"docx": "^9.1.1",
13+
"file-saver": "^2.0.5",
14+
"highlight.js": "^11.11.1",
15+
"html2canvas": "^1.4.1",
16+
"jspdf": "^4.2.0",
17+
"jszip": "^3.10.1",
18+
"marked": "^14.1.4",
19+
"openai": "^6.22.0",
20+
"react": "^18.3.1",
21+
"react-dom": "^18.3.1"
22+
},
23+
"devDependencies": {
24+
"@types/file-saver": "^2.0.7",
25+
"@types/react": "^18.3.12",
26+
"@types/react-dom": "^18.3.1",
27+
"@vitejs/plugin-react": "^4.3.4",
28+
"typescript": "^5.7.0",
29+
"vite": "^6.0.0"
30+
}
31+
}

0 commit comments

Comments
 (0)