nextcloud / nextcloud/server

[Bug]: Subsequent shares should respect the original expiration date

Open
#43,230 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 27-feedback bug feature: file sidebar feature: files feature: sharing
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description

Subsequent shares (share by a user that has received the shared file from another user) do not respect the original share's expiration date.
If user1 shares a file with user2 with expiration date 1 day in the future, user2 can, when the share is live, share it with user3 with an expiration date lasting much longer.

All the shares are visible to the original sharer with the expiration dates but it still would make sense to limit the expiration date by parent's expiration date.

Could be relevant: https://github.com/nextcloud/server/blob/master/apps/files_sharing/lib/Controller/ShareAPIController.php#L770-L777

(Share seems to fail with 'expiration date is in the past' error for 28 and master)

cc @artonge

Steps to reproduce
  1. Share a file from user1 to user2 with expiration date 1 day in future and share permissions
  2. Share the same file from user2 to user3 with expiration date more than 1 day in future and share permissions
Expected behavior

user2 is not able to share the file with longer expiration date (if the expiration date was set for the share initially)

Installation method

None

Nextcloud Server version

27

Operating system

None

PHP engine version

None

Web server

None

Database engine version

None

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report
{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "sqlite3",
        "version": "27.1.6.2",
        "overwrite.cli.url": "http:\/\/localhost",
        "updater.release.channel": "git",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "log_type": "errorlog",
        "maintenance": false,
        "loglevel": 0
    }
}
List of activated Apps
Enabled:
  - cloud_federation_api: 1.10.0
  - comments: 1.17.0
  - contactsinteraction: 1.8.0
  - dashboard: 7.7.0
  - dav: 1.27.0
  - federatedfilesharing: 1.17.0
  - federation: 1.17.0
  - files: 1.22.0
  - files_reminders: 1.0.0
  - files_sharing: 1.19.0
  - files_trashbin: 1.17.0
  - files_versions: 1.20.0
  - lookup_server_connector: 1.15.0
  - oauth2: 1.15.2
  - provisioning_api: 1.17.0
  - settings: 1.9.0
  - sharebymail: 1.17.0
  - systemtags: 1.17.0
  - theming: 2.2.0
  - twofactor_backupcodes: 1.16.0
  - updatenotification: 1.17.0
  - user_status: 1.7.0
  - weather_status: 1.7.0
  - workflowengine: 2.9.0
Disabled:
  - admin_audit: 1.17.0
  - encryption: 2.15.0
  - files_external: 1.19.0
  - testing: 1.17.0
  - user_ldap: 1.17.0
Nextcloud Signing status
integrity:check-core can not be used on git checkouts
Nextcloud Logs

No response

Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in apps/files_sharing/lib/Controller/ShareAPIController.php around lines 770-777 and trace how a subsequent share's expiration is validated against its parent share. Reproduce the user1-to-user2-to-user3 scenario, then verify that user2 cannot create a share lasting beyond the original expiration date.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authorization, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.