Skip to content

Commit 928ef5f

Browse files
DavertMikclaude
andcommitted
fix(Obscura): pass --allow-file-access when launching obscura serve
0.2.2 gates DOM.setFileInputFiles behind --allow-file-access, so attachFile failed with "DOM.setFileInputFiles is disabled" on a self-launched server. The flag exists in 0.2.0 too, so passing it works against both. Also drops "file uploads" from the documented limitations: they work, and the two skipped #attachFile tests are skipped for an unrelated <select multiple> bug, not for lack of upload support. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017bdxGACghDuRVjn3hzmdy4
1 parent 066bdfc commit 928ef5f

2 files changed

Lines changed: 17 additions & 15 deletions

File tree

docs/helpers/Obscura.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ process lifecycle, the same way Playwright manages its own browser process.
2828
never spawns or kills anything, no matter what `binaryPath`/`port` are set to.
2929
* **SELF-LAUNCH**`endpoint` is unset and a binary can be resolved, in order: `binaryPath` in
3030
the config, then the `OBSCURA_PATH` environment variable, then `obscura` on `PATH`. The helper
31-
spawns `obscura serve --port <port> --allow-private-network` (`port` from the config, or a
32-
free port picked automatically), waits for it to answer, connects, and kills it in
33-
`_finishTest`.
31+
spawns `obscura serve --port <port> --allow-private-network --allow-file-access` (`port` from
32+
the config, or a free port picked automatically), waits for it to answer, connects, and kills
33+
it in `_finishTest`.
3434
* **COURTESY-ATTACH**`endpoint` is unset and no binary can be resolved, but something already
3535
answers `http://127.0.0.1:9222/json/version` (e.g. `obscura serve` started by hand, or by CI
3636
before this process ever ran). The helper attaches to it and never kills it — it isn't the
@@ -46,9 +46,10 @@ it directly) and the helper launches and tears it down for you automatically:
4646
curl -sL https://github.com/h4ckf0r0day/obscura/releases/download/v0.2.2/obscura-x86_64-linux.tar.gz | tar xz
4747
```
4848

49-
`--allow-private-network` is always passed by this helper (it's required to reach apps running
50-
on `localhost`/private IPs, e.g. a dev server on `127.0.0.1:8000` — Obscura blocks
51-
private-network requests by default).
49+
`--allow-private-network` and `--allow-file-access` are always passed by this helper: the first
50+
is required to reach apps running on `localhost`/private IPs, e.g. a dev server on
51+
`127.0.0.1:8000`, the second to let `attachFile` upload local files. Obscura blocks both by
52+
default.
5253

5354
## Config presets
5455

@@ -67,7 +68,7 @@ Set them explicitly in your own config to skip probing or to force a mode.
6768
## Limitations
6869

6970
* `input` is always `synthetic`, even on rendering builds — see `input` above.
70-
* No frames, popups, or file uploads.
71+
* No frames or popups.
7172
* On `-no-render` builds and v0.1.x: no screenshots, no visibility assertions
7273
(`seeElement`/`dontSeeElement` always throw) — only DOM presence
7374
(`seeElementInDOM`/`dontSeeElementInDOM`) is meaningful without a layout engine.

lib/helper/Obscura.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ const config = {}
4545
* never spawns or kills anything, no matter what `binaryPath`/`port` are set to.
4646
* - **SELF-LAUNCH** — `endpoint` is unset and a binary can be resolved, in order: `binaryPath` in
4747
* the config, then the `OBSCURA_PATH` environment variable, then `obscura` on `PATH`. The helper
48-
* spawns `obscura serve --port <port> --allow-private-network` (`port` from the config, or a
49-
* free port picked automatically), waits for it to answer, connects, and kills it in
50-
* `_finishTest`.
48+
* spawns `obscura serve --port <port> --allow-private-network --allow-file-access` (`port` from
49+
* the config, or a free port picked automatically), waits for it to answer, connects, and kills
50+
* it in `_finishTest`.
5151
* - **COURTESY-ATTACH** — `endpoint` is unset and no binary can be resolved, but something already
5252
* answers `http://127.0.0.1:9222/json/version` (e.g. `obscura serve` started by hand, or by CI
5353
* before this process ever ran). The helper attaches to it and never kills it — it isn't the
@@ -63,9 +63,10 @@ const config = {}
6363
* curl -sL https://github.com/h4ckf0r0day/obscura/releases/download/v0.2.2/obscura-x86_64-linux.tar.gz | tar xz
6464
* ```
6565
*
66-
* `--allow-private-network` is always passed by this helper (it's required to reach apps running
67-
* on `localhost`/private IPs, e.g. a dev server on `127.0.0.1:8000` — Obscura blocks
68-
* private-network requests by default).
66+
* `--allow-private-network` and `--allow-file-access` are always passed by this helper: the first
67+
* is required to reach apps running on `localhost`/private IPs, e.g. a dev server on
68+
* `127.0.0.1:8000`, the second to let `attachFile` upload local files. Obscura blocks both by
69+
* default.
6970
*
7071
* ## Config presets
7172
*
@@ -84,7 +85,7 @@ const config = {}
8485
* ## Limitations
8586
*
8687
* - `input` is always `synthetic`, even on rendering builds — see `input` above.
87-
* - No frames, popups, or file uploads.
88+
* - No frames or popups.
8889
* - On `-no-render` builds and v0.1.x: no screenshots, no visibility assertions
8990
* (`seeElement`/`dontSeeElement` always throw) — only DOM presence
9091
* (`seeElementInDOM`/`dontSeeElementInDOM`) is meaningful without a layout engine.
@@ -179,7 +180,7 @@ class Obscura extends CDPBrowser {
179180
const port = this.options.port || (await this._findFreePort())
180181
this.options.port = port
181182
this.serverError = null
182-
this.serverProcess = spawn(binaryPath, ['serve', '--port', String(port), '--allow-private-network'], { stdio: 'ignore' })
183+
this.serverProcess = spawn(binaryPath, ['serve', '--port', String(port), '--allow-private-network', '--allow-file-access'], { stdio: 'ignore' })
183184
this.serverProcess.on('error', err => {
184185
this.serverError = err
185186
})

0 commit comments

Comments
 (0)