Skip to content

Instantly share code, notes, and snippets.

@ruevaughn
Last active August 24, 2023 06:56
Show Gist options
  • Save ruevaughn/6b286bf767633f4ca021a7791ab9230e to your computer and use it in GitHub Desktop.
Save ruevaughn/6b286bf767633f4ca021a7791ab9230e to your computer and use it in GitHub Desktop.

Chattin Chit up wiht ChatChapata

Q: Cross-Domain Javascript Source FIle Inclusion - why is this a potential websecurity risk exactly? A: Cross-Domain JavaScript Source File Inclusion refers to the practice of including JavaScript files from a different domain into a web page. This can pose several web security risks:

Loss of Control: By including JavaScript from an external domain, you lose control over the content. If the external domain is compromised, the attacker can modify the JavaScript code to include malicious behavior. Same-Origin Policy (SOP) Bypass: If improperly implemented, cross-domain inclusion can lead to bypassing the SOP. This might allow malicious scripts to access and interact with the content of your site, leading to potential data theft or unauthorized actions on behalf of the user. Data Leakage: Information can be leaked to third parties through the included scripts, potentially exposing sensitive user data. Dependency on External Availability: Your site's functionality might become dependent on the availability and performance of the external domain. If the external domain is slow or down, it may negatively impact your site's user experience. Potential Compliance Issues: Including scripts from external domains might lead to violations of privacy laws or regulations, depending on how the external scripts handle user data. Here's a simple ASCII art to represent the inclusion of an external JavaScript file:

Your Website   ----->  External JavaScript File
(domain.com)          (external-domain.com)

You should only include JavaScript files from trusted sources and follow best practices like Subresource Integrity (SRI) to mitigate these risks.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment