Language: JavaScript
Label: vulnerable
CWE: CWE-918 \u2014 Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.

Code:
module.exports.getPodcastFeed = (feedUrl, excludeEpisodeMetadata = false) => {
  Logger.debug(`[podcastUtils] getPodcastFeed for "${feedUrl}"`)
  return axios.get(feedUrl, { timeout: 12000, responseType: 'arraybuffer', headers: { Accept: 'application/rss+xml' } }).then(async (data) => {

    // Adding support for ios-8859-1 encoded RSS feeds.
    //  See: https://github.com/advplyr/audiobookshelf/issues/1489
    const contentType = data.headers?.['content-type'] || '' // e.g. text/xml; charset=iso-8859-1
    if (contentType.toLowerCase().includes('iso-8859-1')) {
      data.data = data.data.toString('latin1')
    } else {
      data.data = data.data.toString()
    }

    if (!data?.data) {
      Logger.error(`[podcastUtils] getPodcastFeed: Invalid podcast feed request response (${feedUrl})`)
      return false
    }
    Logger.debug(`[podcastUtils] getPodcastFeed for "${feedUrl}" success - parsing xml`)
    const payload = await this.parsePodcastRssFeedXml(data.data, excludeEpisodeMetadata)
    if (!payload) {
      return false
    }

    // RSS feed may be a private RSS feed
    payload.podcast.metadata.feedUrl = feedUrl

    return payload.podcast
  }).catch((error) => {
    Logger.error('[podcastUtils] getPodcastFeed Error', error)
    return false
  })
}