test(compile): add coverage for engine.provider base-url/resource validation - #1867
Draft
github-actions[bot] wants to merge 1 commit into
Draft
test(compile): add coverage for engine.provider base-url/resource validation#1867github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
…idation Adds three compile-level tests exercising validated newtypes that previously had no direct test coverage: - is_valid_provider_base_url rejects a plaintext http:// literal URL (only https:// literals or ADO $(VAR) macros are accepted, since the provider endpoint receives the bearer token / API key) - is_valid_provider_resource_url rejects shell metacharacters in provider.token.resource (this value is shell-interpolated verbatim into the generated az account get-access-token --resource mint step) - the macro-accepting branch of is_valid_provider_base_url plus a non-default provider.token.resource override compile successfully together (both previously untested paths) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
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.
Test Gap Fixes
Test suite snapshot: 2948 unit tests, 225 tests in
compiler_tests.rs(up from 222), passing across the fullcargo testrun.Added Coverage
src/validate.rsis_valid_provider_base_url— plaintext `(redacted) rejectionhttps://literals or ADO$(VAR)macros are accepted; this scheme check previously had zero compile-level coverage (only the happy path was exercised)test_provider_base_url_rejects_plaintext_httpsrc/validate.rsis_valid_provider_resource_url— shell metacharacter rejectionprovider.token.resourceis shell-interpolated verbatim into the generatedaz account get-access-token --resource '(value)'mint step; an unvalidated value could break out of the quoted argumenttest_provider_token_resource_rejects_shell_metacharacterssrc/compile/types.rs(ProviderConfig)base-url+ non-defaultprovider.token.resourceoverride, compiled togetheris_valid_provider_base_urland a customresourceoverride were previously completely untestedtest_provider_base_url_macro_and_custom_resource_compileThese target the BYOK (
engine.provider) validated-newtype surface insrc/secure.rs/src/validate.rs, which handles values interpolated directly into generated shell/YAML and therefore is security-sensitive. Note: becauseProviderConfig/ProviderTokensit inside the untaggedEngineConfigenum, serde's rejection surfaces as a generic "Failed to parse YAML front matter" / "no variant matched" error rather than the newtype's specific message — the negative tests assert on that observed behavior.Validation
cargo test(2948 passed, 0 failed)cargo clippy --all-targets --all-features(clean)Scope: only
tests/compiler_tests.rswas modified; no production code changes.This PR was created by the automated test gap finder. Modules audited this cycle:
sanitize.rs,validate.rs,secure.rs(provider validation newtypes),fuzzy_schedule.rs,hash.rs.Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
spsprodeus21.vssps.visualstudio.comTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.