You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,9 @@ docker run -p 8080:3000 lucientes
19
19
# With API key protection
20
20
docker run -p 8080:3000 -e API_KEY=secret lucientes
21
21
22
+
# With JavaScript enabled
23
+
docker run -p 8080:3000 -e API_KEY=secret -e ALLOW_JAVASCRIPT=true lucientes
24
+
22
25
# Test endpoints
23
26
curl -X POST http://localhost:8080/html-to-image -F "file=@test.html" --output out.png
24
27
curl -X POST http://localhost:8080/html-to-pdf -F "file=@test.html" --output out.pdf
@@ -39,6 +42,13 @@ PDF generation applies a DPI correction factor (96/72) to compensate for Puppete
39
42
-`PORT` - server port (default 3000)
40
43
-`API_KEY` - if set, requires `x-api-key` header on all requests
41
44
45
+
### Security Settings
46
+
47
+
-`ALLOW_JAVASCRIPT` - set to "true" to enable JS execution in HTML (default: disabled)
48
+
-`ALLOW_EXTERNAL_REQUESTS` - set to "true" to allow network requests from rendered pages (default: blocked)
49
+
-`MAX_DIMENSION` - maximum width/height in pixels (default: 4096)
50
+
-`PAGE_TIMEOUT_MS` - page rendering timeout in milliseconds (default: 30000)
51
+
42
52
## CI/CD
43
53
44
54
Docker images are automatically built and pushed to DockerHub (`maximiliana/lucientes`) on pushes to master via `.github/workflows/docker-publish.yml`.
Copy file name to clipboardExpand all lines: README.md
+39-6Lines changed: 39 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,12 @@ Lucientes is developed by the Spanish startup Maximiliana to support the "Atenta
17
17
- Simple and intuitive API.
18
18
- Built with Node.js, Express, and Puppeteer.
19
19
20
-
## 🚀 Getting Started
20
+
## ⚠️ Security warning
21
+
22
+
This service renders arbitrary HTML in a headless browser. **This is inherently risky.**
23
+
Lucientes includes some security layers to mitigate these risks, but no defense is perfect. **Use with caution and always require API key authentication in production.**
24
+
25
+
## 🚀 Getting started
21
26
22
27
### Prerequisites
23
28
@@ -33,14 +38,21 @@ Make sure you have Docker installed on your system.
33
38
34
39
2.**Run the Docker container**:
35
40
```sh
36
-
docker run -p 8080:3000 --env PORT=3000 maximiliana/lucientes
41
+
docker run -p 8080:3000 maximiliana/lucientes
42
+
```
43
+
44
+
3.**Run with API Key protection (recommended for production)**:
45
+
```sh
46
+
docker run -p 8080:3000 \
47
+
-e API_KEY=MY_SECRET_KEY \
48
+
maximiliana/lucientes
37
49
```
38
50
39
-
3.**Run with API Key protection**:
51
+
4.**Run with JavaScript enabled**:
40
52
```sh
41
53
docker run -p 8080:3000 \
42
-
-e PORT=3000 \
43
54
-e API_KEY=MY_SECRET_KEY \
55
+
-e ALLOW_JAVASCRIPT=true \
44
56
maximiliana/lucientes
45
57
```
46
58
@@ -146,8 +158,29 @@ Parameters (multipart form fields):
146
158
147
159
### Environment Variables
148
160
149
-
-`PORT`: The port on which the server will run (default 3000).
150
-
-`API_KEY`: If set, enables authentication; each request must include `x-api-key` header.
161
+
| Variable | Default | Description |
162
+
|----------|---------|-------------|
163
+
|`PORT`|`3000`| Server port |
164
+
|`API_KEY`| (none) | If set, requires `x-api-key` header on all requests |
165
+
|`ALLOW_JAVASCRIPT`|`false`| Set to `true` to enable JavaScript execution in HTML |
166
+
|`ALLOW_EXTERNAL_REQUESTS`|`false`| Set to `true` to allow network requests from rendered pages |
167
+
|`MAX_DIMENSION`|`4096`| Maximum width/height in pixels |
168
+
|`PAGE_TIMEOUT_MS`|`30000`| Page rendering timeout in milliseconds |
169
+
170
+
### Security measures
171
+
172
+
Lucientes implements several layers of security:
173
+
174
+
| Protection | Description |
175
+
|------------|-------------|
176
+
|**Non-root user**| The container runs as an unprivileged user (`pptruser`). |
177
+
|**JavaScript disabled**| JS execution is off by default. Enable only if needed with `ALLOW_JAVASCRIPT=true`. |
178
+
|**Network requests blocked**| External requests (fetch, images, iframes) are blocked by default. Enable with `ALLOW_EXTERNAL_REQUESTS=true`. |
179
+
|**Dimension limits**| Prevents memory exhaustion from extremely large images. |
180
+
|**Timeouts**| Prevents infinite loops and resource exhaustion. |
181
+
|**Timing-safe API key comparison**| Prevents timing attacks on API key validation. |
182
+
183
+
> **Note:** Chrome sandbox is disabled (`--no-sandbox`) for compatibility with containerized environments like Cloud Run. The other security measures compensate for this.
0 commit comments