fix(fetchers): enforce release API URL policy#173
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
api.github.comrequest that was not validated against host, port, allow-prefix, and block-prefix rules.Description
validate_secondary_api_url(url, options)tocrates/fetchkit/src/fetchers/github_release.rswhich callsoptions.validate_urland enforcesallow_prefixes/block_prefixesviaurl_matches_policy_prefixbefore transport.validate_secondary_api_urlfor the derivedhttps://api.github.com/repos/{owner}/{repo}/releases/tags/{tag}URL prior to callingtransport_requestin the GitHub release fetcher.github_releaseto cover host/port/prefix rejection and to assert that disallowed secondary API URLs are blocked before the transport is executed.specs/fetchers.mdto require that specialized fetchers re-apply host, port, allow-prefix, and block-prefix policy to any secondary URLs they derive.Testing
cargo test -p fetchkit github_releaseand the new/updated tests passed.cargo test --workspace,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 completed successfully.Codex Task