Repository navigation
Download transcoded files only from GoDAM CDN hosts, and read the callback API key from the body - #2248
Open
subodhr258 wants to merge 1 commit into
Open
Download transcoded files only from GoDAM CDN hosts, and read the callback API key from the body#2248subodhr258 wants to merge 1 commit into
subodhr258 wants to merge 1 commit into
Conversation
…lback API key from the body The transcoder callback now downloads files only from GoDAM's CDN hosts: - Converted MP4 and MP3 files (`files` list) and the MP4 that replaces an uploaded video (`mp4_url`) must be https URLs on gdcdn.us or one of its subdomains, which is where GoDAM Central serves every account's files. Sites on a self-hosted or staging Central can add their CDN domain with the new `rtgodam_transcoder_file_hosts` filter. A skipped file is logged. - Converted files are fetched with wp_safe_remote_get() and are stored only when they are an MP4 or MP3 by name and by content. - The MP4 that replaces an upload is stored under a name made from the attachment's own file name with an .mp4 extension, not from the URL. It must be video/mp4 (wp_check_filetype_and_ext()), and only the attachment's own file is ever overwritten; another file with the same name is kept and the MP4 gets the next free name. Both callback routes now read the API key from the request body (form or JSON), as GoDAM Central sends it, instead of from any request source, and compare it with hash_equals(). Adds unit tests for the host check, the key check, the converted file download and the MP4 replacement, and points the existing converted-audio test at a GoDAM CDN host.
🔍 WordPress Plugin Check Report
📊 Report
|
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
mismatched_plugin_name | Plugin name "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" is different from the name declared in plugin header "GoDAM". |
0 |
trademarked_term | The plugin name includes a restricted term. Your chosen plugin name - "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" - contains the restricted term "wordpress" which cannot be used at all in your plugin name. |
📁 assets/build/css/main.css (1 warning)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedStylesScope | This style is being loaded in all contexts. |
📁 assets/src/libs/analytics.min.js (5 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/10/23/hello-world/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/sample-page/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
📁 assets/build/js/main.min.js (5 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/10/23/hello-world/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/sample-page/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check
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.
What changes
The transcoder callback (the route GoDAM Central calls when a job finishes) now downloads files only from GoDAM's CDN, and reads the API key only from the request body.
inc/helpers/custom-functions.phprtgodam_get_transcoder_file_hosts()(defaultgdcdn.us, matched with its subdomains; filterrtgodam_transcoder_file_hosts) andrtgodam_is_transcoder_file_url()(https, no user or password, host in the list)fileslist),admin/class-rtgodam-transcoder-handler.php.mp4/.mp3from a CDN host; fetched withwp_safe_remote_get(); stored only when the content matches the type (wp_check_filetype_and_ext()). A skipped file is loggedmp4_url),inc/classes/class-media-library-ajax.php.mp4, not from the URL; must bevideo/mp4; only the attachment's own file is overwritten, another file with the same name is kept and the MP4 gets the next free nameadmin/class-rtgodam-transcoder-rest-routes.phphash_equals()Where Central's files come from: every transcoded MP4, MP3, HLS, DASH and thumbnail URL Central builds is
https://{account}.gdcdn.us/{job}/{file}(Central's CDN setup in godam-core, plus every URL in the plugin's code, tests and our sites). Central sends the API key in the form body of each callback; the callback URL it is given carries no key.Testing
Throwaway WordPress (Playground, PHP 8.3 and 7.4) with the 2.5.0 release plus these files; a made-up key; outbound requests blocked except a local server standing in for the CDN.
.movupload gets its.mp4)mp4_urlnaming a different fileTranscoderFileUrlTest,TranscoderCallbackPermissionTest,TranscodedFileDownloadTest,Mp4ReplacementTest);TranscodedAudioMimeTypeTestupdated to use a CDN host. Full suite OK (708 tests).phpcsclean;bin/hook-checkchecks pass.Worth knowing
gdcdn.us(self-hosted or some staging setups) lose the MP4 and MP3 swap until they add their host:filesentry that isn't.mp3/.mp4is skipped.{account}.gdcdn.ushost is accepted, not only the site's own account.QA:
.movor.webmvideo: it transcodes, the MP4 replaces the upload, and HLS/DASH and thumbnails show.Issue: rtCamp/godam-plugin-wp#74