Skip to content

prevent directory traversal in the web UI - #133

Merged
lstein merged 1 commit into
invoke-ai:mainfrom
bakkot:dir-traversal
Aug 28, 2022
Merged

lstein merged 1 commit into
invoke-ai:mainfrom
bakkot:dir-traversal

Conversation

@bakkot

@bakkot bakkot commented Aug 27, 2022

Copy link
Copy Markdown
Contributor

It's probably not a good idea to run the web UI anywhere an untrusted device could access it. But even so, best not to have this sort of vulnerability.

You might plausibly want to restrict this further, e.g. by not exposing stuff like dream_log.txt.

@dagf2101

Copy link
Copy Markdown

Can you please explain what was the issue and how it is fixed ?

@bakkot

bakkot commented Aug 27, 2022

Copy link
Copy Markdown
Contributor Author

The issue was that you could send the server a request like GET ./../whatever.txt and it would send you the file at stable-diffusion/../../whatever.txt, i.e., it allowed anyone to read any file off your system (as long as it could guess the MIME type, anyway). Browsers will generally normalize URLs like http://localhost/./../whatever.txt before sending, but you can still make such a request by talking to the server directly, for example using telnet.

The fix is to refuse to send files from outside the current directory.

@lstein

lstein commented Aug 28, 2022

Copy link
Copy Markdown
Collaborator

Oh god. Thanks for catching that. I've been very focused on the GFPGAN stuff and am only now turning to the web server.

@lstein
lstein merged commit ddc0e9b into invoke-ai:main Aug 28, 2022
@bakkot
bakkot deleted the dir-traversal branch August 28, 2022 22:32
austinbrown34 pushed a commit to cognidesign/InvokeAI that referenced this pull request Dec 30, 2022
prevent directory traversal in the web UI
JPPhoto pushed a commit to JPPhoto/InvokeAI that referenced this pull request Sep 14, 2026
…by-architecture

refactor(architectures): declare architecture facts in one file per architecture
JPPhoto pushed a commit to JPPhoto/InvokeAI that referenced this pull request Sep 14, 2026
…erver-driven-model-policies

Both branches had found and fixed the same two things independently; the merge
keeps this branch's versions, which are the better-structured ones:

- the guidance/cfg_scale choice, as `getRecordGuidanceValue` keyed on
  `guidanceLabel` rather than an inline ternary
- ernie-image's `scheduler_applies_to_graph`

Removed as obsolete here: invoke-ai#133's `capabilityContract.test.ts`, its snapshot and
`test_frontend_capability_parity.py`. They pinned webv2's `BASE_GENERATION` to
the registry, and this branch deletes that table in favour of reading the
capabilities endpoint — `test_capabilities_fixture.py` is the contract now, in
the other direction. Their oxfmt exclusion went with them.

Kept from invoke-ai#133 because this branch does not have it: the guidance slider could
not hold a value above its 10-wide track, so FLUX Fill's 30 clamped to 10 on
first blur. Its regression tests were folded into this branch's own guidance
describe block, dropping the three cases already covered there and re-pointing
the per-base sweep at the policy instead of the deleted table.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants