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

fix: add option to remove the webroot for setup checks and don't chec… #46255

Merged
merged 2 commits into from
Sep 5, 2024

Conversation

kesselb
Copy link
Contributor

@kesselb kesselb commented Jul 2, 2024

Summary

fix: add option to remove the webroot for setup checks and don't check trusted_domains.

  1. The checks for well-known urls should always run against the root domain and therefore the option to remove the webroot.

  2. For trusted domains, the available protocol is unknown, and thus some guesswork would be needed to make that work. I've decided for now to not consider them anymore to reduce false-positives.

TODO

  • CI
  • Review

Checklist

@kesselb kesselb added bug 3. to review Waiting for reviews labels Jul 2, 2024
@kesselb kesselb added this to the Nextcloud 30 milestone Jul 2, 2024
@susnux
Copy link
Contributor

susnux commented Jul 2, 2024

Not sure we had problems with false negative in the past because there are some configurations where the server is accessed e.g. by my-server.com but the machine can not resolve that domain or that is not its real domain but the proxy. So in that cases we iterate all trusted domains

@kesselb
Copy link
Contributor Author

kesselb commented Jul 2, 2024

I've included an GitHub issue in the pull request.

It's also okay for me to keep the trusted_domains, it's just something I ran into while testing. The protcol is missing, and therefore the request goes to http:// which does not work on my dev setup because there is no http listener.

More important is the remove webroot part for installations in a subdirectory.

@MichaIng
Copy link
Member

MichaIng commented Jul 2, 2024

Since these tests are done from the backend, I'd test the CLI URL first (if not empty), i.e. add it as first entry to the array, since it should always work, and the urlGenerator one only if it differs as 2nd entry.

  1. For trusted domains, the available protocol is unknown, and thus some guesswork would be needed to make that work. I've decided for now to not consider them anymore to reduce false-positives.

I am also not sure whether there are cases where the CLI URL is unset and the current client request domain is not accessible from the server. But you could add them as last array entries, to not increase false-positives. The test requests follow redirects. So without protocol, it should test HTTP first, which could even work when Nextcloud runs behind a HTTPS proxy, or otherwise follow the usually configured HTTPS redirect. That way we assure to not replace one regression with the tests with another one.
Since * is still a valid trusted domain entry, it should be probably removed/skipped.

EDIT: Read your last comment too late. Without HTTP listener or without HTTPS redirect it of course won't work, but it does not hurt to at least try them, if the other two did not succeed?

@MichaIng MichaIng linked an issue Jul 2, 2024 that may be closed by this pull request
8 tasks
@come-nc
Copy link
Contributor

come-nc commented Jul 8, 2024

Since these tests are done from the backend, I'd test the CLI URL first (if not empty), i.e. add it as first entry to the array, since it should always work, and the urlGenerator one only if it differs as 2nd entry.

  1. For trusted domains, the available protocol is unknown, and thus some guesswork would be needed to make that work. I've decided for now to not consider them anymore to reduce false-positives.

I am also not sure whether there are cases where the CLI URL is unset and the current client request domain is not accessible from the server. But you could add them as last array entries, to not increase false-positives. The test requests follow redirects. So without protocol, it should test HTTP first, which could even work when Nextcloud runs behind a HTTPS proxy, or otherwise follow the usually configured HTTPS redirect. That way we assure to not replace one regression with the tests with another one. Since * is still a valid trusted domain entry, it should be probably removed/skipped.

EDIT: Read your last comment too late. Without HTTP listener or without HTTPS redirect it of course won't work, but it does not hurt to at least try them, if the other two did not succeed?

I agree with all this I think, overwrite cli first makes sense, then detected url, then trusted domains.

kesselb and others added 2 commits September 5, 2024 10:30
…k trusted_domains.

1) The checks for well-known urls should always run against the root domain and therefore the option to remove the webroot.

2) For trusted domains, the available protocol is unknown, and thus some guesswork would be needed to make that work. I've decided for now to not consider them anymore to reduce false-positives.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
 trusted domains as last fallback.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
@come-nc come-nc force-pushed the bug/add-option-to-remove-webroot-for-setupchecks branch from c86a035 to c224b8c Compare September 5, 2024 09:55
@come-nc
Copy link
Contributor

come-nc commented Sep 5, 2024

/backport to stable30

@come-nc
Copy link
Contributor

come-nc commented Sep 5, 2024

/backport to stable29

@come-nc
Copy link
Contributor

come-nc commented Sep 5, 2024

/backport to stable28

@come-nc come-nc requested review from a team, ArtificialOwl, sorbaugh, come-nc, joshtrichards and solracsf and removed request for a team September 5, 2024 13:34
@kesselb
Copy link
Contributor Author

kesselb commented Sep 5, 2024

Thanks @come-nc for taking over, looks good to always try overwrite.cli.url first 👍

Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving for @kesselb

@come-nc come-nc added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Sep 5, 2024
@sorbaugh sorbaugh merged commit eac7c2e into master Sep 5, 2024
165 of 175 checks passed
@sorbaugh sorbaugh deleted the bug/add-option-to-remove-webroot-for-setupchecks branch September 5, 2024 15:51
Copy link

backportbot bot commented Sep 5, 2024

The backport to stable28 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable28
git pull origin stable28

# Create the new backport branch
git checkout -b backport/46255/stable28

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick 4ce4d7b9 c224b8ce

# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/46255/stable28

Error: No changes found in backport branch


Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish backport-request bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: NC29 .well-known URLs, failed on: /.well-known/caldav
6 participants