SIGN IN SIGN UP

fix: provider-returned IDs escaping credentialed follow-up URL path segments (#19369)

## Background

Published xAI, Google, and Anthropic providers used response-derived
identifiers in credentialed follow-up paths, allowing malformed
identifiers to change the intended same-origin request path.

## Root Cause

Response-derived IDs were interpolated without complete path-segment
encoding. Reproduction and focused URL tests confirmed that slash
traversal and standalone dot segments could be normalized into
unintended paths.

## Summary

Encoded xAI request IDs and Anthropic skill/version IDs as safe path
segments. Google preserves valid files/<id> resource paths while safely
encoding IDs and malformed names. Standalone dot segments are
double-encoded to prevent URL normalization, with patch changesets for
all three providers.

## Testing

Regression coverage includes slash traversal, standalone '.' and '..'
values at every affected identifier position, malformed Google names,
and normal Google files/<id> compatibility. Focused Node tests, complete
package Edge suites, package type checks, full workspace type checking,
and repository checks passed.

## End-to-end Validation

- Original reproduction replay — exited successfully without the
original bug signal.
- `FAIL_ON_ERROR=1 pnpm -C examples/ai-functions exec tsx
src/generate-video/xai/poll-options.ts` — live xAI generation and
polling completed successfully.
- `pnpm -C examples/ai-functions exec tsx -` with a forced Google
PROCESSING response — live polling used the expected files/<id> URL and
reached ACTIVE.
- `FAIL_ON_ERROR=1 pnpm -C examples/ai-functions exec tsx
src/upload-skill/anthropic/provider-shorthand.ts` — live upload, version
retrieval, and cleanup succeeded.

## Related Issues

Fixes #19329

Closes #19331

---------

Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com>
Co-authored-by: habibthadev <109099706+habibthadev@users.noreply.github.com>
Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
Co-authored-by: ai-sdk-factory[bot] <305873210+ai-sdk-factory[bot]@users.noreply.github.com>
A
ai-sdk-factory[bot] committed
7de3612c80c385d86b12df180c0be8084d80e08a
Parent: 5533946
Committed by GitHub <noreply@github.com> on 8/25/2026, 4:04:13 AM