Skip to content

Commit

Permalink
fix: renaming tagged faces in photos app (#102)
Browse files Browse the repository at this point in the history
* fix: renaming tagged faces in photos app

* fix: check for 921110 in test output
  • Loading branch information
EsadCetiner authored Nov 21, 2024
1 parent b56b5dd commit 7b90021
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/nextcloud-rule-exclusions-before.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2242,8 +2242,9 @@ SecRule REQUEST_FILENAME "@rx /remote\.php/dav/photos/[^/]+/(?:albums|sharedalbu
setvar:'tx.allowed_request_content_type=%{tx.allowed_request_content_type} |text/plain|'"

# Sorting photos based upon faces in Nextcloud Photos
# Renaming tagged faces
# Text/plain content is actually XML so we switch on XML parser for text/plain
SecRule REQUEST_FILENAME "@rx /remote\.php/dav/recognize/[^/]+/faces/(?:[0-9]+/)?$" \
SecRule REQUEST_FILENAME "@rx /remote\.php/dav/recognize/[^/]+/faces/(?:[^/]+/)?$" \
"id:9508953,\
phase:1,\
pass,\
Expand Down
52 changes: 52 additions & 0 deletions tests/regression/nextcloud-rule-exclusions-plugin/9508953.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
meta:
author: "Esad Cetiner"
description: "Nextcloud Photos"
enabled: true
name: 9508953.yaml
tests:
- test_title: 9508953-1
desc: Renaming tagged faces
stages:
- stage:
input:
dest_addr: 127.0.0.1
headers:
Host: localhost
User-Agent: OWASP CRS test agent
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: text/plain;charset=UTF-8
port: 80
method: PROPFIND
uri: /remote.php/dav/recognize/esadc/faces/Joe/
data: |
<?xml version="1.0"?>
<d:propfind xmlns:d="DAV:"
xmlns:oc="http://owncloud.org/ns"
xmlns:nc="http://nextcloud.org/ns"
xmlns:ocs="http://open-collaboration-services.org/ns">
<d:prop>
<d:getcontentlength />
<d:getcontenttype />
<d:getetag />
<d:getlastmodified />
<d:resourcetype />
<nc:face-detections />
<nc:face-preview-image />
<nc:metadata-photos-size />
<nc:metadata-photos-original_date_time />
<nc:metadata-files-live-photo />
<nc:metadata-blurhash/>
<nc:has-preview />
<nc:realpath />
<nc:hidden />
<oc:favorite />
<oc:fileid />
<oc:permissions />
<nc:nbItems />
</d:prop>
</d:propfind>
version: HTTP/1.1
output:
no_log_contains: |-
id "920420"|id "921110"

0 comments on commit 7b90021

Please sign in to comment.