Repository navigation
feat(admin): allow external https URL in tutorial redirect (#2690) - #2694
Merged
Merged
Conversation
Tutorials could only redirect to another tutorial via the redirectTo association, so authors were blocked from redirecting a deleted tutorial to an off-platform page. Add a redirectUrl string field that accepts an https:// URL on the curated SAP host allowlist (reusing isAllowedTarget from redirect-allowlist.js), keeping the existing slug value-help + validation on redirectTo untouched. - db/schema.cds + db-qa/schema.cds: new redirectUrl String(1000) - packages/core/_tutorials-table.js: redirectUrlCol for the raw serve SELECT - srv/admin-service.js: validate redirectUrl (INACTIVE-only, allowlisted https, mutually exclusive with redirectTo) - packages/content/content-store.js + srv/lib/model-json-handler.js: honor redirectUrl first (301 to the external URL), else slug redirect - app/admin-annotations.cds: free-text "Redirect URL (external)" field next to the Redirect To picker
jung-thomas
force-pushed
the
feat/redirect-external-url-2690
branch
from
October 8, 2026 16:37
f46d6bd to
561cd81
Compare
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.
Closes #2690
Problem
A tutorial's redirect field (
redirectTo) is anAssociation to Tutorials— it can only point at another tutorial. Authors who tried to enter a full external URL (e.g. redirect a deleted tutorial to a community.sap.com page) were blocked, because the picker + validation only accept a valid tutorial.Change
Add a sibling
redirectUrlfree-text field alongsideredirectTo, keeping the existing slug value-help and validation untouched.db/schema.cds,db-qa/schema.cds): newredirectUrl : String(1000).srv/admin-service.js):redirectUrlmust be set on an INACTIVE tutorial, must pass the existing SAP host allowlist (isAllowedTarget— https:// on community.sap.com / help.sap.com / www.sap.com / etc.), and is mutually exclusive withredirectTo.packages/content/content-store.js(tutorial HTML) andsrv/lib/model-json-handler.js(Discovery Center.model.json) now 301 to the external URL first, falling back to the existing slug→slug redirect.packages/core/_tutorials-table.jsaddsredirectUrlColfor the raw serve SELECT.app/admin-annotations.cds): free-text "Redirect URL (external)" field next to the Redirect To picker, with placeholder + description noting the allowlist.URL policy
External URLs go through the existing PR-reviewed SAP host allowlist (
srv/lib/redirect-allowlist.js) rather than allowing arbitraryhttps://*, matching the repo's established redirect security posture. Arbitrary external hosts remain blocked from the UI; adding a host stays a deliberate code edit.Tests (TDD)
test/admin-service.test.js: accept allowlisted https on INACTIVE; reject non-allowlisted host, non-https, ACTIVE-tutorial, and both-set.test/lib/content-store.test.js: 301 to external URL (query preserved).srv/__tests__/lib/model-json-route.test.js: 301 to external URL on.model.json.All 95 tests across the three affected files pass. Pre-existing unrelated failures in the full suite (missing
*.bundle.mjsbuild artifacts and@mediapipenative deps in a fresh worktree) are environmental, not from this change.🤖 Generated with Claude Code