Skip to content

Support username, password and port specification in RIA URLs#5902

Merged
mih merged 3 commits intodatalad:maintfrom
mih:bf-5475
Aug 17, 2021
Merged

Support username, password and port specification in RIA URLs#5902
mih merged 3 commits intodatalad:maintfrom
mih:bf-5475

Conversation

@mih
Copy link
Member

@mih mih commented Aug 16, 2021

Previously only the hostname was retained for performing, e.g. SSH-based
logins, making it required to use an appropriate SSH config.

While not using such properties in RIA URLs is advisable, silently
stripping such information is a bug. Moreover, other mechanisms such
as HTTP (or a future FTP support) may not have equivalent configuration
analogs. Using such a core helper as verify_ria_url() to silently
remove information seems inappropriate.

A more comprehensive test is included.

Fixes #5475

mih added 2 commits August 16, 2021 18:11
Previously only the hostname was retained for performing, e.g. SSH-based
logins, making it required to use an appropriate SSH config.

While not using such properties in RIA URLs is advisable, silently
stripping such information is a bug. Moreover, other mechanisms such
as HTTP (or a future FTP support) may not have equivalent configuration
analogs. Using such a core helper as `verify_ria_url()` to silently
remove information seems inappropriate.

A more comprehensive test is included.

Fixes datalad#5475
@mih mih linked an issue Aug 16, 2021 that may be closed by this pull request
@mih mih added the semver-patch Increment the patch version when merged label Aug 16, 2021
@codecov
Copy link

codecov bot commented Aug 16, 2021

Codecov Report

Merging #5902 (eaa18e5) into maint (7d1f2bf) will decrease coverage by 54.22%.
The diff coverage is 0.00%.

❗ Current head eaa18e5 differs from pull request most recent head bfd9fd1. Consider uploading reports for the commit bfd9fd1 to get more accurate results
Impacted file tree graph

@@             Coverage Diff             @@
##            maint    #5902       +/-   ##
===========================================
- Coverage   90.32%   36.09%   -54.23%     
===========================================
  Files         300      297        -3     
  Lines       42396    42366       -30     
===========================================
- Hits        38294    15292    -23002     
- Misses       4102    27074    +22972     
Impacted Files Coverage Δ
datalad/customremotes/ria_utils.py 18.86% <0.00%> (-73.44%) ⬇️
datalad/customremotes/tests/test_ria_utils.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/tests/test_api.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/tests/test_base.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/tests/test_config.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/ui/tests/__init__.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/tests/test__main__.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/tests/test_strings.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/ui/tests/test_base.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/support/tests/utils.py 0.00% <0.00%> (-100.00%) ⬇️
... and 236 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7d1f2bf...bfd9fd1. Read the comment docs.

@mih mih requested a review from bpoldrack August 16, 2021 18:07
@mih mih added the merge-if-ok OP considers this work done, and requests review/merge label Aug 16, 2021
hostname=url_ri.hostname or '',
portdelim=':' if url_ri.port else '',
port=url_ri.port or '',
)
Copy link
Member

@yarikoptic yarikoptic Aug 16, 2021

Choose a reason for hiding this comment

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

not familiar with RIA enough and can't grasp from the docstring -- what is the purpose/use of this returned host entity?
it seems no longer a URL (no protocol:// prefix) and also might contain sensitive information (password) thus should probably not be logged anywhere (although I just now realized that we might be logging such URLs left and right) and should not be served as some kind of a "annex remote description".

is that a host to ssh into? (I guess not since IIRC you can't even add :port not to say password like that)

Copy link
Member

Choose a reason for hiding this comment

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

is that a host to ssh into?

If it's SSH, then yes. Will be passed to our SSH machinery in that case.

Overall it depends: It's the thing the base_path of the RIA store is referring to.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess not since IIRC you can't even add :port not to say password like that

Thx @yarikoptic for making this point. I think it is better to switch to URL style destination description right away to actually make this possible. I will push an update.

Copy link
Member

@bpoldrack bpoldrack left a comment

Choose a reason for hiding this comment

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

Actually, I was planning to use the parsed URL within ORA instead, but I'm fine with that change - it's the easier quick fix and the added test helps. Also doesn't stand in the way of overall RF'ing plans - so: Thanks much!

hostname=url_ri.hostname or '',
portdelim=':' if url_ri.port else '',
port=url_ri.port or '',
)
Copy link
Member

Choose a reason for hiding this comment

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

is that a host to ssh into?

If it's SSH, then yes. Will be passed to our SSH machinery in that case.

Overall it depends: It's the thing the base_path of the RIA store is referring to.

This is used to log into machines (SSH only right now). Only this form
actually allows for the specification of a port within the RIA URL.
Given that a URL is the main input, it makes sense to maintain such a
form also within subsequent internal handling.
@mih mih requested a review from bpoldrack August 17, 2021 05:23
@mih
Copy link
Member Author

mih commented Aug 17, 2021

Thx for the review @bpoldrack

@mih mih merged commit eece02f into datalad:maint Aug 17, 2021
@mih mih deleted the bf-5475 branch August 17, 2021 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-if-ok OP considers this work done, and requests review/merge semver-patch Increment the patch version when merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

create-sibling-ria changes ssh username

3 participants