Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow web cron via POST #14190

Closed
Findus23 opened this issue Mar 12, 2019 · 5 comments · Fixed by #17703
Closed

Allow web cron via POST #14190

Findus23 opened this issue Mar 12, 2019 · 5 comments · Fixed by #17703
Assignees
Labels
c: Security For issues that make Matomo more secure. Please report issues through HackerOne and not in Github. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.

Comments

@Findus23
Copy link
Member

I just noticed that the Web Cron Docs recommends accessing this URL (I just updated it to include https)
https://matomo.your-server.example/path/to/piwik/misc/cron/archive.php?token_auth=XYZ

Sending the admin token via GET isn't ideal, but it seems to be hardcoded:

if(!isset($_GET['token_auth'])) {

Would it be possible to update the script to support POST (and mention it in the docs) or maybe even recommend people to directly call CoreAdminHome.runCronArchiving?

@Findus23 Findus23 added the c: Security For issues that make Matomo more secure. Please report issues through HackerOne and not in Github. label Mar 12, 2019
@tsteur tsteur added the Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. label Mar 12, 2019
@tsteur tsteur added this to the Priority Backlog (Help wanted) milestone Mar 12, 2019
@simivar
Copy link
Contributor

simivar commented Mar 29, 2019

I see that archive.php script is deprecated while running from CLI and user is redirected to core:archive. What do you think about adding some DEPRECATED message in HTTP-mode while we are at it?

@mattab
Copy link
Member

mattab commented Jul 26, 2021

Added little mention in https://matomo.org/docs/setup-auto-archiving/

For security, if possible we recommend you POST the token_auth parameter to the URL https://matomo.your-server.example/path/to/matomo/misc/cron/archive.php (instead of sending the token_auth as a GET parameter)

@valerio-bozzolan
Copy link

Added little mention in https://matomo.org/docs/setup-auto-archiving/

For security, if possible we recommend you POST the token_auth parameter to the URL https://matomo.your-server.example/path/to/matomo/misc/cron/archive.php (instead of sending the token_auth as a GET parameter)

Note that POST has nothing to do with security. The reference should be updated to fix this misleading concept. The POST is just the right way to update things, like PUT. It does not add any underlying security measure, unless the user is so chicken that they share the GET URL with secrets in query string with someone at random.

Further notes:

https://developer.mozilla.org/en-US/docs/Glossary/Idempotent

@justinvelluppillai
Copy link
Contributor

@valerio-bozzolan it does at least have the security impact of not leaving token_auth in server logs I guess.

@valerio-bozzolan
Copy link

valerio-bozzolan commented Aug 9, 2021

On a normal Linux server, logs can be read only from root and from the webserver user by default. With or without the logs, both users can already read the token_auth because they can access the database or read the application config ecc., so having this information in a log does not have any security impact, unless one has an uncommon log management sharing them with untrusted users for uncommon reasons (but this workflow have security impacts, not GET). For this uncommon kind of users, yep, we can suggest to use POST but this is strange to be documented. That's why it's misleading to say that GET affects security.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Security For issues that make Matomo more secure. Please report issues through HackerOne and not in Github. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants