karthik-0306 commented on PR #13402:
URL: https://github.com/apache/seatunnel/pull/13402#issuecomment-7095724551

   Thanks @SEZ9 for the thorough review. All eight points are addressed in the 
new head; status per finding:
   
   - F1 fixed. The base URL is stripped like the version, validated, and the 
result is built from the validated string. Spaces, control characters, 
non-ASCII characters and `\` anywhere in it are rejected. Tests: 
test_surrounding_whitespace_in_base_url_is_dropped (`".../seatunnel/ "`, 
`"...\n"`), test_invalid_base_url_raises (embedded space, `\n`, `\t`, `\r`, 
`\x00`, `\`, `é`).
   - F2 fixed. `?` and `#` are rejected on the raw string, so a bare trailing 
delimiter fails too. Tests: `https://x/seatunnel?`, `https://x/seatunnel#`, 
`https://x/seatunnel/?` in test_invalid_base_url_raises.
   - F3 fixed. urlsplit, .hostname and .port run inside one try that converts 
ValueError to DistributionError; the host check uses hostname; port 0 and a 
non-numeric or out-of-range port are rejected. Credentials (`user@`, 
`user:pw@`) are rejected and redacted from error messages. Tests: 
`https://[::1/seatunnel`, `https://:443/...`, `https://user@/...`, 
`https://host:abc/...`, `https://host:99999/...`, `https://host:0/...`, plus 
test_credentials_are_not_shown_in_errors and 
test_valid_hosts_and_ports_are_accepted (IPv6, IPv4, custom port).
   - F4 fixed. A home directory or cache variable that resolves to the 
filesystem root is not used: `XDG_CACHE_HOME=/` or `LOCALAPPDATA=C:\` falls 
back to the home directory, and `HOME=/` / `HOME=""` raises DistributionError. 
Tests: test_home_at_the_filesystem_root_raises, 
test_relative_or_root_cache_variable_is_ignored. I left the explicit override 
(parameter or launcher variable) to the PR that first writes to the directory, 
as you suggested.
   - F5 fixed. I removed the non-hermetic test; with F6 the docs no longer 
claim the location is checked against the package directory, so there is 
nothing real for it to test. TestCacheDir now has a comment saying CI checks 
branch selection with Linux path rules and that Windows path rules come from 
running the suite on Windows. I kept the workflow matrix unchanged in this PR; 
happy to add windows-latest / macos-latest in a separate CI PR if you'd like.
   - F6 fixed. The module and cache_dir docstrings now describe the location as 
the default under the user's cache directory, say it follows the home directory 
and XDG_CACHE_HOME (Linux) or LOCALAPPDATA (Windows) and is not otherwise 
checked, and that pointing those at a shared directory makes the cache shared. 
The base_url docs now list every rejected input, so docs and code match.
   - F7 fixed. A version must now start with a digit, which rules out `nul`, 
`con`, `aux`, `prn`, `com1`, `lpt1`, and the cache_dir docstring notes that 
`3.0.0-SNAPSHOT` and `3.0.0-snapshot` share one directory on case-insensitive 
file systems. Tests: device names and `v3.0.0` in test_invalid_versions_raise; 
`3`, `3.0.0-SNAPSHOT`, `3.0.0-RC1` in test_valid_versions_are_accepted.
   - F8 fixed. The home fallback is checked explicitly (only when no usable 
cache variable is set), and the error names the variable to set for the 
platform: `XDG_CACHE_HOME or HOME`, `HOME`, or `LOCALAPPDATA or USERPROFILE`. 
Tests: test_unresolved_home_raises_and_names_the_variable_to_set (home `"~"`), 
test_cache_variable_works_without_a_home_directory.
   
   While fixing these I also rejected invalid percent escapes (`%zz`, trailing 
`%`) and `[`/`]` outside an IPv6 host.
   
   Verification: the SDK suite passes on Linux with Python 3.9 and 3.10 (94 
passed) and on Windows with Python 3.11 (93 passed, 1 POSIX-only skip). I also 
ran a randomized probe (about 180,000 malformed base URLs and 30,000 random 
versions across the linux/darwin/win32 branches, on Linux and Windows) checking 
that only DistributionError is raised and that every accepted URL is https, has 
a host, has no query, fragment, credentials or whitespace, and ends in 
`/<version>/apache-seatunnel-<version>-bin.tar.gz`; it found no failures. On 
real Linux without mocks, `HOME=/` and `HOME=""` raise the new error and 
`XDG_CACHE_HOME=/` falls back to `~/.cache`. The PR description is updated to 
match.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to