mockintosh icon indicating copy to clipboard operation
mockintosh copied to clipboard

Non-relative SSL cert path results in inaccessible exception

Open thecodenomad opened this issue 2 years ago • 3 comments

Environment: mockintosh==0.13.17 Docker version 20.10.12, build e91ed57 MacOS Monterey v.12.2.1

Executing mockintosh with non-relative cert paths result in a Certificate loading error.

Expectation: Specifying a full path to a cert file should work.

Actual:

mockintosh.exceptions.CertificateLoadingError:
Certificate loading error: Path `/my/docker/volume/config/certs/mockingjay.crt` is inaccessible!

Relative Path Restricting code: https://github.com/up9inc/mockintosh/blob/33008204dd56ec038ab5725615c9bfda0a685846/mockintosh/servers.py#L467

thecodenomad avatar Mar 16 '22 21:03 thecodenomad

This is by design. Since Mockintosh allows reloading configuration via API, it requires you to explicitly expose any resource files, by putting under working directory tree. Without that, anyone would be able to access any file on the computer. The solution is to move certificate file under working directory of Mockintosh.

undera avatar Mar 17 '22 09:03 undera

That is a fair point, but also feels a little PEBKAC. Are there many users that use mockintosh outside of a docker context? *Is that the suggested way of running it?

Also just wanted to update to say thanks for providing such a great tool!!

thecodenomad avatar Mar 18 '22 02:03 thecodenomad

I have no data on how many users are not using Docker. There is no particular need in running it via Docker, only the ability to not deal with Python ecosystem.

undera avatar Mar 18 '22 07:03 undera