Repository navigation
Security and Configuration
Outbound oEmbed requests and provider HTML are untrusted inputs. The library enables its security policy by default and applies it to known-provider requests and discovery requests.
When security is enabled, the request controller:
- Accepts only absolute HTTP and HTTPS URLs.
- Blocks loopback, localhost, private, link-local, metadata, and reserved internal addresses.
- Resolves DNS names and rejects a request when any resolved address is blocked.
- Disables ambient credentials and preauthentication.
- Disables automatic redirects so every redirect can be validated.
- Revalidates each redirect target.
- Allows at most three redirects.
- Uses a 10-second timeout.
- Limits response bodies to 1 MiB.
These controls protect both explicit provider calls and oEmbed discovery. A provider URL is not trusted merely because it matches a known pattern.
Rich and video responses can contain provider-supplied HTML. By default, the library transforms supported markup into a validated iframe representation. Invalid or unsupported markup is HTML-encoded instead of being returned as executable markup.
The library does not make the caller’s surrounding page safe. Render returned output only through an output path appropriate for your application and content-security policy.
The application root is determined from ASP.NET’s application path when available; outside ASP.NET, the application base directory is used. The library looks for:
oembed.json.config
Example:
{
"DisableHtmlTransformation": false,
"DisableSecurity": false
}| Setting | Default | Effect |
|---|---|---|
DisableHtmlTransformation |
false |
Returns provider HTML without the normal transformation. |
DisableSecurity |
false |
Disables outbound URL, DNS, redirect, timeout, and response-size protections. |
Both switches are troubleshooting overrides. They should not be enabled in production. DisableSecurity is especially dangerous because it removes the SSRF boundary.
Missing, malformed, or incorrectly typed configuration values fall back to secure defaults. A broken configuration file cannot disable security.
- Keep both bypass settings disabled in deployed applications.
- Treat provider URLs and response bodies as attacker-controlled data.
- Apply your own Content Security Policy and output encoding rules.
- Do not send credentials through this library’s provider or discovery requests.
- Test redirects and DNS behavior in a controlled environment when adding provider support.
- Review the package version and provider availability before relying on a remote embed in a critical workflow.
This innovation is maintained by Upendo Ventures. Demos of this software can be seen on various runsonUpendo client websites.