Commit 358cfd6
refactor: Remove client-side PDF parsing and add URL support (#8)
* fix: API correctness issues (SSRF protection, docs alignment)
- Add allowUrlFetch option to client options (default: false)
- Block automatic URL fetching by default for SSRF protection
- Validate URL protocols (only http/https allowed)
- Add helper method normalizeFileInput() to client
- Update README.md with import statement in Quick Start
- Add SSRF protection documentation section to README
- Update and add tests for SSRF protection behavior
Security: SSRF protection requires explicit opt-in for URL fetching.
Users must set allowUrlFetch: true to enable client-side URL fetching.
* Remove client-side PDF parsing and add URL support to methods
- Remove getPdfPageCount, isValidPdf, and processRemoteFileInput functions
- Remove allowUrlFetch client option (SSRF protection by design)
- Most methods now accept FileInputWithUrl - URLs passed to server
- Leverage API's native negative index support (-1 = last page)
- sign() remains the only method requiring local files (API limitation)
- Reduces bundle size by ~400 lines of PDF parsing code
Co-Authored-By: Claude Opus 4.5 <[email protected]>
* Fix CI: Replace non-null assertions with undefined checks
ESLint forbids non-null assertions (!). Replaced array index accesses
with explicit undefined checks that TypeScript can verify.
Co-Authored-By: Claude Opus 4.5 <[email protected]>
* Fix code quality issues from PR review
- Replace unsafe type assertion (as unknown as T) with getRemoteUrl() helper
- Validate HTML assets upfront before calling registerAssets
- Add comprehensive tests for URL support in action file inputs
- Remove unused import and fix linting issues
All 266 tests pass. Fixes all issues identified in PR #8 review.
Co-Authored-By: Claude Haiku 4.5 <[email protected]>
---------
Co-authored-by: nickwinder <[email protected]>
Co-authored-by: Claude Opus 4.5 <[email protected]>1 parent f8c1f69 commit 358cfd6
File tree
13 files changed
+408
-938
lines changed- src
- __tests__
- unit
- builders
- types
13 files changed
+408
-938
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
68 | 97 | | |
69 | 98 | | |
70 | 99 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
236 | 235 | | |
237 | 236 | | |
238 | 237 | | |
239 | | - | |
240 | | - | |
241 | 238 | | |
242 | 239 | | |
243 | 240 | | |
244 | | - | |
245 | | - | |
| 241 | + | |
| 242 | + | |
246 | 243 | | |
247 | 244 | | |
248 | 245 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | 117 | | |
124 | 118 | | |
125 | 119 | | |
| |||
173 | 167 | | |
174 | 168 | | |
175 | 169 | | |
176 | | - | |
177 | | - | |
178 | 170 | | |
179 | 171 | | |
180 | 172 | | |
| |||
239 | 231 | | |
240 | 232 | | |
241 | 233 | | |
| 234 | + | |
242 | 235 | | |
243 | 236 | | |
244 | 237 | | |
| |||
1056 | 1049 | | |
1057 | 1050 | | |
1058 | 1051 | | |
1059 | | - | |
1060 | | - | |
| 1052 | + | |
1061 | 1053 | | |
1062 | 1054 | | |
1063 | 1055 | | |
| |||
1169 | 1161 | | |
1170 | 1162 | | |
1171 | 1163 | | |
1172 | | - | |
| 1164 | + | |
1173 | 1165 | | |
1174 | 1166 | | |
1175 | 1167 | | |
| 1168 | + | |
1176 | 1169 | | |
1177 | | - | |
| 1170 | + | |
1178 | 1171 | | |
1179 | 1172 | | |
1180 | | - | |
| 1173 | + | |
1181 | 1174 | | |
1182 | 1175 | | |
1183 | | - | |
| 1176 | + | |
1184 | 1177 | | |
1185 | 1178 | | |
1186 | 1179 | | |
| |||
0 commit comments