<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>2020-09 on Funky Si's Blog (Dev)</title><link>https://blog-dev.funkysi1701.com/2020/09/</link><description>Recent content in 2020-09 on Funky Si's Blog (Dev)</description><generator>Hugo -- gohugo.io</generator><language>en-gb</language><managingEditor>funkysi1701@gmail.com (Simon Foster)</managingEditor><webMaster>funkysi1701@gmail.com (Simon Foster)</webMaster><lastBuildDate>Sat, 26 Sep 2020 00:00:00 +0000</lastBuildDate><atom:link href="https://blog-dev.funkysi1701.com/2020/09/index.xml" rel="self" type="application/rss+xml"/><item><title>Security Headers</title><link>https://blog-dev.funkysi1701.com/posts/2020/security-headers/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Sat, 26 Sep 2020 00:00:00 +0000</pubDate><guid>https://blog-dev.funkysi1701.com/posts/2020/security-headers/</guid><category term="DotNet">DotNet</category><category term="Security">Security</category><description>&lt;p&gt;Have you wondered what info you are leaking via your response headers?, do you want some kind of guide about what headers to set or remove altogether?&lt;/p&gt;
&lt;p&gt;Head on over to &lt;a href="https://securityheaders.com/" target="_blank" rel="noopener noreferrer"&gt;https://securityheaders.com/&lt;/a&gt;
This is a site created by security expert &lt;a href="https://scotthelme.co.uk" target="_blank" rel="noopener noreferrer"&gt;Scott Helme&lt;/a&gt;
that rates a URL based on what response headers it can see.&lt;/p&gt;
&lt;p&gt;I am pleased to say &lt;a href="https://www.funkysi1701.com" target="_blank" rel="noopener noreferrer"&gt;https://www.funkysi1701.com&lt;/a&gt;
is now getting an A.
&lt;img class="img-fluid" alt="Alt Text" src="https://blog-dev.funkysi1701.com/images/2020/07rwumi94fz141hwessu.png" loading="lazy"
width="2434" height="496"
/&gt;
&lt;/p&gt;
&lt;p&gt;So how do you add/remove headers in dotnet core?&lt;/p&gt;
&lt;p&gt;In my configure method in Startup.cs I have the following code block.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;app.Use(
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; next =&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;async&lt;/span&gt; context =&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; context.Response.OnStarting(
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; () =&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; context.Response.Headers.Add(&lt;span style="color:#e6db74"&gt;&amp;#34;Permissions-Policy&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;microphone=()&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; context.Response.Headers.Remove(&lt;span style="color:#e6db74"&gt;&amp;#34;Server&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; context.Response.Headers.Remove(&lt;span style="color:#e6db74"&gt;&amp;#34;X-Powered-By&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; context.Response.Headers.Remove(&lt;span style="color:#e6db74"&gt;&amp;#34;X-AspNet-Version&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; Task.CompletedTask;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; });
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;await&lt;/span&gt; next(context);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; };
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; });
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I have only included a few of the headers I am adding as the excellent &lt;a href="https://securityheaders.com/" target="_blank" rel="noopener noreferrer"&gt;https://securityheaders.com/&lt;/a&gt;
can tell you which headers you should add and what options you might want.&lt;/p&gt;</description></item><item><title>Returning to blogging as a developer</title><link>https://blog-dev.funkysi1701.com/posts/2020/back-to-blogging/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Fri, 25 Sep 2020 20:00:45 +0000</pubDate><guid>https://blog-dev.funkysi1701.com/posts/2020/back-to-blogging/</guid><category term="Blogging">Blogging</category><category term="Blazor">Blazor</category><category term="DotNet">DotNet</category><description>&lt;p&gt;My last blog post was over six months ago.&lt;/p&gt;
&lt;p&gt;Covid 19 has hit the world, and I will be honest I have found it a challenging time.&lt;/p&gt;
&lt;p&gt;My Blog had gotten into a bit of a mess. It had become fragmented with different versions of the same thing; I will attempt to explain what has become of my blog.&lt;/p&gt;
&lt;p&gt;The original WordPress site can currently be found at &lt;a href="https://www.pwnedpass.com/" target="_blank" rel="noopener noreferrer"&gt;https://www.pwnedpass.com/&lt;/a&gt;
I would prefer it to be on a sub-domain of funkysi1701.com but for some reason I haven&amp;rsquo;t been able to get that to work, not sure if it is a limitation of my hosting package. I like WordPress, it is very flexible, easy to get blog posts out there. But I want to write content about development and having a site I can tinker with is important to me.&lt;/p&gt;
&lt;p&gt;Most of my WordPress blogs have been imported into dev.to and a few extra have been written on this platform. I like dev.to it is a wonderful place to share content and it has one or two extra features I like.&lt;/p&gt;
&lt;p&gt;dev.to has an integration with Stackbit/Netlify and this became &lt;a href="https://www.funkysi1701.com" target="_blank" rel="noopener noreferrer"&gt;https://www.funkysi1701.com&lt;/a&gt;
. I like having a personal site, but having the same content as dev.to. To add content to this site all I need to do is write it on dev.to and some magic will go on behind the scenes and new content will be published.&lt;/p&gt;
&lt;p&gt;However, as a developer I don&amp;rsquo;t like magic, I want to understand what is going on a fiddle with all the settings and make it do what I want.&lt;/p&gt;
&lt;p&gt;dev.to has an API, I can build a site in .Net Core and make API calls to fetch the content I want. I understand APIs, I understand .Net and can customise my site exactly how I want it, plus play about with a .net website. This is what &lt;a href="https://www.funkysi1701.com" target="_blank" rel="noopener noreferrer"&gt;https://www.funkysi1701.com&lt;/a&gt;
is now.&lt;/p&gt;
&lt;p&gt;So what have I built so far. I have a Server Side Blazor site running .Net 5. Why Server Side and not Client Side I hear you ask? Well only because I have more experience with Server Side and know how to quickly create a website with that technology, I may change it as time goes by, but we will see.&lt;/p&gt;
&lt;p&gt;I have two pages a list of my blog posts and a page that displays the content. Both of these use the dev.to API. I lied, there is a third page I hacked together to do some page redirection from the WordPress URLs. This is something I will change as time goes on.&lt;/p&gt;
&lt;p&gt;There are lots of improvements I want to do, there are probably also lots of broken images or links as well. Hopefully, this will result in a good platform to blog about as well as on.&lt;/p&gt;</description></item></channel></rss>