calendar icon indicating copy to clipboard operation
calendar copied to clipboard

Support webcal http auth & store credentials

Open tcitworld opened this issue 9 years ago • 38 comments

Ideally :

  • Have a checkbox "Provide credentials" beneath the url input field
  • Show login and password beneath when it's checked
  • Save credentials in the app. Secured enough ?
  • Perform the proxy request and provide these credentials in the headers

What do you think ? @georgehrke @raghunayyar

tcitworld avatar Sep 20 '16 09:09 tcitworld

Regarding security/storing of credentials @LukasReschke should have look too I guess.

raimund-schluessler avatar Sep 20 '16 09:09 raimund-schluessler

Well, you can already store credentials by putting them in the url with user:password@url, The problem is, that a user with whom the calendar is shared is will see the credentials. But as the webcal is fetched by the browser, you would not be able to share password protected webcal calendars (without sharing the auth as well)

georgehrke avatar Sep 20 '16 10:09 georgehrke

I wonder if webcal calendars should be shared anyway, since you can just give the link to other people.

tcitworld avatar Sep 20 '16 11:09 tcitworld

Sharing it is still way easier than telling someone to copy and paste that url into the new subscription field.

georgehrke avatar Sep 20 '16 11:09 georgehrke

Well, you can already store credentials by putting them in the url with user:password@url

Right now ? Doesn't work for me, maybe because it seems http:// gets added on front.

tcitworld avatar Sep 20 '16 12:09 tcitworld

I have also a problem, that I have to put ht eusername and password in the URL. ...and I have a non standard.port for my cloud.

This result in a URL für webdav: webdav://username:password/example.to:1234/cloud/remote.php/dav/calendar.ics

Outlook can't get the calendar. Error: "Der Internetkalender kann in Outlook nicht überprüft oder hinzugefügt werden. Setellen sie sicher, dass der Hyperlink ein gültiger Kalenderhyperlink ist.

Any suggestions? Or is this not supported (credentials + special port)

Tanarri avatar Sep 23 '16 06:09 Tanarri

It's supposed to be user:pass@host:port/path

georgehrke avatar Sep 23 '16 07:09 georgehrke

It doesn't work if I add https:// on front. Is only HTTP supported?

treiher avatar Dec 16 '16 15:12 treiher

I would like to subscribe to another Nextcloud calendar so I tried to subscribe with the following URL:

http://USERNAME:PASSWORD@HOST/remote.php/dav/calendars/USERNAME/CALENDARNAME?export

The first request works without any problems but any further requests are sent without a password. When I check the WebCal-Address it looks like this:

http://USERNAME@HOST/remote.php/dav/calendars/USERNAME/CALENDARNAME?export

Is there any security mechanisms which prevent that the password is remaining in the URL?

fabwu avatar Jan 10 '17 10:01 fabwu

@wuethrich44 Not that I know of, but you should publish the calendar on the other end and then subscribe to it's public url.

tcitworld avatar Jan 10 '17 10:01 tcitworld

@tcitworld Ok that could be an approach but I don't have admin rights in the other server so I can't make the calendar public.

fabwu avatar Jan 10 '17 12:01 fabwu

You don't need admin rights, just regular user access that you seem to have.

tcitworld avatar Jan 10 '17 13:01 tcitworld

As stated in Issue #287 it should be possible to retrieve a WebCal calendar via HTTPS. For me it does not work, if I need authentication at the same time.

If I subscribe to https://USERNAME:PASSWORD@HOST/url/to/calendar the App changes the URL after creation to https://USERNAME@HOST/url/to/calendar, which obviously ends in a The remote server did not give us access to the calendar (HTTP {403} error).

Am I doing something wrong? How can I subscribe to a calendar with authentication and HTTPS?

treiher avatar Jan 11 '17 15:01 treiher

I've observed the same behavior. I use the following link to share the calendar:

image

fabwu avatar Jan 11 '17 20:01 fabwu

For me , the password is intact as source in the oc_calendarsubscriptions table. But not in the url used for the proxy.

elgaard avatar Apr 24 '17 05:04 elgaard

Maybe the calender can check for the 401 code and then ask the user for user/password?

Beside this it would be cool if subscribing has an option to sync the remote calendar into a local one so one is able to share this calendar with others by using a local one...

laeubi avatar Feb 07 '18 11:02 laeubi

Maybe the calender can check for the 401 code and then ask the user for user/password?

Yes, that's what this ticket is about :)

Beside this it would be cool if subscribing has an option to sync the remote calendar into a local one so one is able to share this calendar with others by using a local one...

This would be an issue that belongs into the server repository. See: https://github.com/nextcloud/server/issues/1497 https://github.com/nextcloud/server/issues/1600

georgehrke avatar Feb 07 '18 11:02 georgehrke

For me , the password is intact as source in the oc_calendarsubscriptions table. But not in the url used for the proxy.

@elgaard It's because the method build of the sabre\uri library contains :

$authority = $parts['user'] . '@' . $authority;

and should maybe be :

$authority = $parts['user'] . ':' . $parts['pass'] . '@' . $authority;

I'v tried and i was able to import my calendar.

pepea28 avatar Mar 14 '18 16:03 pepea28

@pepea28 Would you care to open a PR to the https://github.com/sabre-io/uri/ repository ?

tcitworld avatar Mar 14 '18 16:03 tcitworld

So what is the state of this issue? (i.e. that the password is removed when it is requested by the proxy) I see none of your PRs are merged, @tcitworld…

Or is there at least any workaround one can try?

rugk avatar Oct 01 '18 14:10 rugk

FYI the Nextcloud "news" app does have a similar UI as proposed in the OP (with a field for username/password).

rugk avatar Oct 01 '18 14:10 rugk

I also need this feature. Could the according PRs please be merged?

protree avatar Dec 12 '18 19:12 protree

I also need this feature. Could the according PRs please be merged?

What PRs?

ChristophWurst avatar Jan 29 '21 15:01 ChristophWurst

https://github.com/nextcloud/3rdparty/pull/143

tcitworld avatar Jan 29 '21 16:01 tcitworld

It turns out that you can now actually use user:password with https links. I'm unable to reproduce the issue where sabre strips the password for https but not for http.

So the remaining part is storing the auth values separately but also the sharing. Even if we have a separate storage for credentials, you would currently have to expose them to the sharees so they are able to sync. Unless they have to submit their own password, but that kind of defeats the purpose of sharing. So that one make https://github.com/nextcloud/server/issues/1600 a lot more complex.

ChristophWurst avatar Feb 10 '21 10:02 ChristophWurst

That's odd, I don't see how this could work since not much has changed since then. Will try to reproduce.

Even if we have a separate storage for credentials, you would currently have to expose them to the sharees so they are able to sync.

Subscriptions are exposed as regular calendars inside this app because they are cached on server, so we could make sure they don't expose auth information (currently probably accessible through href and default displayname). We could do the same for any CalDAV client as long as the subscription URI contains credentials. In that case, we wouldn't need to worry about storing the auth values separately or how to handle sharing.

See https://github.com/nextcloud/server/blob/decb70b9ac6048e72305154af841271902f6b10c/apps/dav/lib/CalDAV/CalendarHome.php#L107-L116

tcitworld avatar Feb 10 '21 10:02 tcitworld

Okay, so you would allow sharees to see the cached calendar, but they will be unable to refresh it, right?

ChristophWurst avatar Feb 10 '21 14:02 ChristophWurst

No one can refresh the cached calendar subscriptions right now anyway.

This is either defined by the calendar data itself through REFRESH-INTERVAL or X-PUBLISHED-TTL icalendar keys, or fallback to the value defined by the calendarSubscriptionRefreshRate app setting (defaults to one week).

tcitworld avatar Feb 10 '21 15:02 tcitworld

Oh, then I simply read an outdated comment about the sync happening just in the browser. Thanks for the clarification.

ChristophWurst avatar Feb 10 '21 15:02 ChristophWurst

Didn't see an answer while scrolling this thread: what if my username is an email address? The Webcal log-in should be:

[email protected]:password@http://example.com/webdav

I think the email ampersand (@) confuses NextCloud. I get an error that says:

Please enter a valid link (starting with http://, https://, webcal://, or webcals://)

endo34 avatar Dec 10 '21 19:12 endo34