Skip to content

adding dav_chmod and dav_chown#79

Open
madara125 wants to merge 1 commit into
arut:masterfrom
madara125:master
Open

adding dav_chmod and dav_chown#79
madara125 wants to merge 1 commit into
arut:masterfrom
madara125:master

Conversation

@madara125

Copy link
Copy Markdown

Add chmod/chown support for WebDAV uploaded files

Description

This PR extends the nginx-dav-ext-module with three new directives that allow automatic permission management for files uploaded via WebDAV:

  • dav_chmod: Set file permissions (supports octal notation, e.g., 0660)
  • dav_chown_user: Set file owner (requires root privileges, included as a PoC)
  • dav_chown_group: Set file group (requires root privileges, included as a PoC)

Problem Solved

Currently, nginx WebDAV module creates files with default system umask permissions, offering no control over ownership or access rights. This limitation makes it difficult to:

  • Integrate WebDAV with automated workflows (e.g., Django/WordPress reading uploaded files)
  • Implement collaborative editing workflows with privacy controls
  • Apply security policies automatically to uploaded content

Implementation Details

  • Added ngx_http_dav_ext_post_content_handler that executes in NGX_HTTP_LOG_PHASE after file creation
  • Implemented octal permission parser for dav_chmod directive
  • Added dav_chown_user and dav_chown_group directives with proper user/group resolution
  • Minimal performance impact - only executes on successful PUT/MKCOL requests

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.

1 participant