fix(fetchers): enforce policy for RFC source URLs#168
Open
chaliy wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
IetfRfcFetcherconstructs a canonicalwww.rfc-editor.orgURL and callstransport_requestwithout re-applying the caller's URL policy, allowing secondary outbound requests to evadeallow_prefixes,block_prefixes,blocked_hosts, andallowed_portschecks.Description
validate_url_policy(url: &Url, options: &FetchOptions)incrates/fetchkit/src/fetchers/mod.rsand switched registry validation to call it instead of duplicating logic.IetfRfcFetcher::fetchnow callsvalidate_url_policyon the derived canonical RFC Editor source URL before invokingtransport_requestto prevent outbound policy bypass.crates/fetchkit/src/fetchers/ietf_rfc.rsusing aRecordingTransportto assert that blocked canonical URLs produceFetchError::BlockedUrlwith no transport calls and that allowed canonical URLs still fetch normally.specs/fetchers.mdto require that fetchers which derive secondary outbound URLs must apply the same configured URL policy to those derived URLs.Testing
cargo fmt --allwhich passed.cargo test -p fetchkit canonical_source_url -- --nocaptureand full test suitecargo test --workspace, both of which passed (new tests included and green).cargo clippy --workspace --all-targets -- -D warnings,RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps, andcargo build --workspace --exclude fetchkit-python --release, all of which succeeded.Codex Task