Skip to content

Security: Create new files without execution permission #2809

@nekr0z

Description

@nekr0z

Files created by PhotoPrism, such as the imported files ending up in the "originals" directory, album YAMLs under "storage/albums/folder", YAMLs under "storage/sidecar" folder, and many other, are created with executable bit set in permissions.

Steps to reproduce:

  1. Have a photo imported.
  2. Check permissions on the file that appeared in "originals".

Expected behavior:

The created files don't have the executable bit set unless they are executables.

Likely cause of the problem:

destFile, err := os.OpenFile(dest, os.O_RDWR|os.O_CREATE, os.ModePerm)
and
destFile, err := os.OpenFile(dest, os.O_RDWR|os.O_CREATE, os.ModePerm)
(and maybe other places) use os.ModePerm that is 0o777; need to use 0o666, since the file created is not intended to be an executable in either case.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingreleasedAvailable in the stable releasesecurityImpact on server or browser security

Type

No type

Projects

Status

Release 🌈

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions