<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.bibble.co.nz/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Web_Security</id>
	<title>Web Security - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.bibble.co.nz/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Web_Security"/>
	<link rel="alternate" type="text/html" href="https://wiki.bibble.co.nz/mediawiki/index.php?title=Web_Security&amp;action=history"/>
	<updated>2026-06-15T12:10:18Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://wiki.bibble.co.nz/mediawiki/index.php?title=Web_Security&amp;diff=10693&amp;oldid=prev</id>
		<title>Iwiseman: /* 1. CSRF (Cross-Site Request Forgery) */</title>
		<link rel="alternate" type="text/html" href="https://wiki.bibble.co.nz/mediawiki/index.php?title=Web_Security&amp;diff=10693&amp;oldid=prev"/>
		<updated>2025-09-18T04:44:34Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;1. CSRF (Cross-Site Request Forgery)&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 04:44, 18 September 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l22&quot;&gt;Line 22:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 22:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://www.youtube.com/watch?v=Ub5TLow9GL4 How CSRF Tokens Work]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://www.youtube.com/watch?v=Ub5TLow9GL4 How CSRF Tokens Work]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&#039;&#039;&#039;Iain Explanation&#039;&#039;&#039;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&#039;&#039;&#039;Iain&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;s &lt;/ins&gt;Explanation&#039;&#039;&#039;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is relatively easy. This is where an attacker gets a user to send a link to an already authenticated site with there operation. E.g. in this case, send an email, with a link to change your bank email. Because the browser is already logged on, when the user clicks the link, the existing session cookie gets sent.&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is relatively easy. This is where an attacker gets a user to send a link to an already authenticated site with there operation. E.g. in this case, send an email, with a link to change your bank email. Because the browser is already logged on, when the user clicks the link, the existing session cookie gets sent.&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[File:Csrf explained.png|600px ]]&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[File:Csrf explained.png|600px ]]&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Iwiseman</name></author>
	</entry>
	<entry>
		<id>https://wiki.bibble.co.nz/mediawiki/index.php?title=Web_Security&amp;diff=10692&amp;oldid=prev</id>
		<title>Iwiseman: /* 1. CSRF (Cross-Site Request Forgery) */</title>
		<link rel="alternate" type="text/html" href="https://wiki.bibble.co.nz/mediawiki/index.php?title=Web_Security&amp;diff=10692&amp;oldid=prev"/>
		<updated>2025-09-18T04:42:15Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;1. CSRF (Cross-Site Request Forgery)&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 04:42, 18 September 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l21&quot;&gt;Line 21:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 21:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://www.youtube.com/watch?v=eHqbh0kyRYk CSRF Explained]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://www.youtube.com/watch?v=eHqbh0kyRYk CSRF Explained]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://www.youtube.com/watch?v=Ub5TLow9GL4 How CSRF Tokens Work]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://www.youtube.com/watch?v=Ub5TLow9GL4 How CSRF Tokens Work]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039;Iain Explanation&#039;&#039;&#039;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;This is relatively easy. This is where an attacker gets a user to send a link to an already authenticated site with there operation. E.g. in this case, send an email, with a link to change your bank email. Because the browser is already logged on, when the user clicks the link, the existing session cookie gets sent.&amp;lt;br&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[File:Csrf explained.png|600px ]]&amp;lt;br&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 2. XSRF ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 2. XSRF ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Iwiseman</name></author>
	</entry>
	<entry>
		<id>https://wiki.bibble.co.nz/mediawiki/index.php?title=Web_Security&amp;diff=10690&amp;oldid=prev</id>
		<title>Iwiseman: Created page with &quot;=Introduction= This page is to list all things around Web Security  == 1. CSRF (Cross-Site Request Forgery) == &#039;&#039;&#039;Definition&#039;&#039;&#039;: A malicious site tricks a user&#039;s browser into sending authenticated requests to your server.  &#039;&#039;&#039;Threat Model&#039;&#039;&#039;: * Exploits cookie-based sessions * Common in form submissions and state-changing requests  &#039;&#039;&#039;Defense Strategies&#039;&#039;&#039;: * Synchronizer token pattern * Double-submit cookie validation * SameSite cookie attributes  &#039;&#039;&#039;Tapir Notes&#039;&#039;&#039;: * U...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.bibble.co.nz/mediawiki/index.php?title=Web_Security&amp;diff=10690&amp;oldid=prev"/>
		<updated>2025-09-18T04:25:00Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;=Introduction= This page is to list all things around Web Security  == 1. CSRF (Cross-Site Request Forgery) == &amp;#039;&amp;#039;&amp;#039;Definition&amp;#039;&amp;#039;&amp;#039;: A malicious site tricks a user&amp;#039;s browser into sending authenticated requests to your server.  &amp;#039;&amp;#039;&amp;#039;Threat Model&amp;#039;&amp;#039;&amp;#039;: * Exploits cookie-based sessions * Common in form submissions and state-changing requests  &amp;#039;&amp;#039;&amp;#039;Defense Strategies&amp;#039;&amp;#039;&amp;#039;: * Synchronizer token pattern * Double-submit cookie validation * SameSite cookie attributes  &amp;#039;&amp;#039;&amp;#039;Tapir Notes&amp;#039;&amp;#039;&amp;#039;: * U...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Introduction=&lt;br /&gt;
This page is to list all things around Web Security&lt;br /&gt;
&lt;br /&gt;
== 1. CSRF (Cross-Site Request Forgery) ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition&amp;#039;&amp;#039;&amp;#039;: A malicious site tricks a user&amp;#039;s browser into sending authenticated requests to your server.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Threat Model&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
* Exploits cookie-based sessions&lt;br /&gt;
* Common in form submissions and state-changing requests&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Defense Strategies&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
* Synchronizer token pattern&lt;br /&gt;
* Double-submit cookie validation&lt;br /&gt;
* SameSite cookie attributes&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tapir Notes&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
* Use `extractFromRequest` to access headers and cookies&lt;br /&gt;
* Validate CSRF token manually in `serverLogic`&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Videos&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
* [https://www.youtube.com/watch?v=eHqbh0kyRYk CSRF Explained]&lt;br /&gt;
* [https://www.youtube.com/watch?v=Ub5TLow9GL4 How CSRF Tokens Work]&lt;br /&gt;
&lt;br /&gt;
== 2. XSRF ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note&amp;#039;&amp;#039;&amp;#039;: Often used interchangeably with CSRF. Some frameworks (e.g., Angular) use &amp;quot;XSRF&amp;quot; to refer to their CSRF protection mechanism.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Angular Pattern&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
* Sends token in `X-XSRF-TOKEN` header&lt;br /&gt;
* Validates against cookie value&lt;br /&gt;
&lt;br /&gt;
== 3. CSP (Content Security Policy) ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition&amp;#039;&amp;#039;&amp;#039;: A browser-enforced policy that restricts what content can be loaded or executed.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Threat Model&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
* Prevents XSS and clickjacking&lt;br /&gt;
* Blocks inline scripts and unauthorized resources&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Defense Strategies&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
* Use nonce-based or hash-based CSP headers&lt;br /&gt;
* Avoid `unsafe-inline` and `unsafe-eval`&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Example Header&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;http&amp;quot;&amp;gt;&lt;br /&gt;
Content-Security-Policy: default-src &amp;#039;self&amp;#039;; script-src &amp;#039;nonce-abc123&amp;#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 4. Host Header Validation ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition&amp;#039;&amp;#039;&amp;#039;: Ensures requests come from expected domains by validating the `Host` header.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Threat Model&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
* DNS rebinding attacks&lt;br /&gt;
* Host header spoofing&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Defense Strategies&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
* Use Play’s `AllowedHostsFilter` or validate manually&lt;br /&gt;
* In Tapir, use `ServerRequest.header(&amp;quot;Host&amp;quot;)` and compare against a whitelist&lt;br /&gt;
&lt;br /&gt;
== 5. XSS (Cross-Site Scripting) ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition&amp;#039;&amp;#039;&amp;#039;: Injects malicious scripts into trusted web pages.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Threat Model&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
* Steals cookies or session tokens&lt;br /&gt;
* Defaces content or redirects users&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Defense Strategies&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
* Escape output&lt;br /&gt;
* Sanitize inputs&lt;br /&gt;
* Use CSP headers&lt;br /&gt;
&lt;br /&gt;
== 6. CORS (Cross-Origin Resource Sharing) ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition&amp;#039;&amp;#039;&amp;#039;: Controls which domains can access your API from the browser.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Threat Model&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
* Unauthorized cross-origin requests&lt;br /&gt;
* Data leakage via exposed endpoints&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Defense Strategies&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
* Set strict `Access-Control-Allow-Origin` headers&lt;br /&gt;
* Avoid wildcard origins (`*`) in production&lt;br /&gt;
&lt;br /&gt;
== 7. Authentication &amp;amp; Authorization ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition&amp;#039;&amp;#039;&amp;#039;: Verifies identity (authN) and controls access (authZ).&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Threat Model&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
* Unauthorized access to protected resources&lt;br /&gt;
* Privilege escalation&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Defense Strategies&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
* Use JWTs, OAuth2, or session tokens&lt;br /&gt;
* Implement RBAC or ABAC&lt;br /&gt;
* Validate tokens in Tapir via `.securityIn(...)`&lt;br /&gt;
&lt;br /&gt;
== 8. Input Validation &amp;amp; Injection Prevention ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition&amp;#039;&amp;#039;&amp;#039;: Ensures user input doesn’t compromise system integrity.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Threat Model&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
* SQL injection&lt;br /&gt;
* Command injection&lt;br /&gt;
* Header manipulation&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Defense Strategies&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
* Use parameterized queries&lt;br /&gt;
* Validate types, formats, and ranges&lt;br /&gt;
* Reject unexpected input early&lt;/div&gt;</summary>
		<author><name>Iwiseman</name></author>
	</entry>
</feed>