mirage / ocaml-github

GitHub APIv3 OCaml bindings
ISC License
100 stars 61 forks source link

Poor error if chmod fails #195

Open talex5 opened 7 years ago

talex5 commented 7 years ago

I tried providing my github cookie as a Docker secret. Docker makes it appear inside the container as a world-readable file at /run/secrets/cookie.

It appears that ocaml-github checks the permissions, tries to chmod it (!), fails, throws away the error, and reports that the token doesn't exist. Quite confusing...

I guess this is the problem line: https://github.com/mirage/ocaml-github/blob/ef5c33bbdbe663d555c9c4b3c7334885b8a5ff3d/unix/github_cookie_jar.ml#L164

avsm commented 7 years ago

odd, why is it trying to chmod it...?

dsheets commented 7 years ago

It tries to chmod it to prevent overly readable secrets. In a past version, the default was world-readable secrets. The error behavior should definitely be different. PRs welcome.

avsm commented 7 years ago

Ah yes when I wrote the original jar I didn't set a umask on file creation -- thanks for clarifying!