<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: sfrunza13</title>
    <description>The latest articles on Forem by sfrunza13 (@sfrunza13).</description>
    <link>https://forem.com/sfrunza13</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F921814%2F26301fd6-69b1-41a4-951d-f4d9fbdc487c.png</url>
      <title>Forem: sfrunza13</title>
      <link>https://forem.com/sfrunza13</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/sfrunza13"/>
    <language>en</language>
    <item>
      <title>1.0 Release!</title>
      <dc:creator>sfrunza13</dc:creator>
      <pubDate>Thu, 20 Apr 2023 23:44:05 +0000</pubDate>
      <link>https://forem.com/sfrunza13/10-release-n95</link>
      <guid>https://forem.com/sfrunza13/10-release-n95</guid>
      <description>&lt;h2&gt;
  
  
  My.Custom.Domain 1.0 (mycustomdomain.senecacollege.ca)
&lt;/h2&gt;

&lt;p&gt;This week marks the conclusion of a semester long journey to deliver our opensource DNS and SSL certificate solution named My.Custom.Domain or &lt;a href="https://github.com/DevelopingSpace/starchart"&gt;Starchart&lt;/a&gt;. This Wednesday the team got together and watched David release the first real production build of the site and I had the honors of creating the PR for that release from main to the release branch. Unfortunately I had messed up and the changelog did not actually contain any changes (more on that in a second) and on top of that the site was acting a bit funny. &lt;/p&gt;

&lt;p&gt;Staging was working perfectly fine so after a bit of digging we decided that it must have been some of the AWS variables that ITS handed us that must have been wrong, David fixed that and the DNS records were working as intended but a unique constraint on the Order Urls were causing problems within the cert flow so a quick setting of orderURL to null upon update so that duplicate requests do not break things was done &lt;a href="https://github.com/DevelopingSpace/starchart/pull/652"&gt;#652&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now back to how I messed up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where are my changes logged?
&lt;/h2&gt;

&lt;p&gt;To create a changelog upon release I had added an action to the release.yml which was supposed to create or update a tag named release and then find the differences between the previous release tag commit and the current release tag commit and generate a changelog of commits from that difference. This worked upon an initial attempt to release because the action was actually making the difference between the HEAD and the newly created release tag since there was no previous release tag at the time. Fast-forward to Wednesday and our release, the action does not work, I go into the action to see what is happening and it claims that there are 0 new commits from the last release tag, impossible I say! I don't know for a fact what was happening here but I suspect that since the name of the branch that initiates this workflow is also release the action got confused between the sha merged to the release branch and the sha of our last release tag. I tried replicating this in my own &lt;a href="https://github.com/sfrunza13/testingReleases"&gt;test repo&lt;/a&gt; and was able to actually run into the exact same problem.&lt;/p&gt;

&lt;p&gt;My solution was pretty simple, I changed the name of the tag to be something other than "release", in this case I changed it to "latest". Afterwards it worked:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0L1NMHUb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rnxug71qglcqa2n9vt47.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0L1NMHUb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rnxug71qglcqa2n9vt47.png" alt="Image description" width="800" height="651"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As has been the case with quite a few of my PRs thus far, the solution was a single word difference &lt;a href="https://github.com/DevelopingSpace/starchart/pull/657"&gt;#657&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Concluding what is likely my last semester at Seneca...
&lt;/h2&gt;

&lt;p&gt;...in this way is hilarious. A one word PR. Ha!&lt;/p&gt;

&lt;p&gt;But on a more serious note I am really proud of this website, of the great people that I have worked with and learned from in this class, and very grateful that I could have this kind of experience thanks to David who is also responsible for the other courses that I think have most influenced me in how I think about developing: the previous open source course and the cloud computing course. &lt;/p&gt;

&lt;p&gt;I don't really know how to wrap this up, my experience with Seneca has really pleasantly surprised me and today I am happy and proud to hopefully be a future alumnus. &lt;/p&gt;

&lt;p&gt;Thank you to everyone.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>git</category>
      <category>programming</category>
      <category>github</category>
    </item>
    <item>
      <title>Git Actions</title>
      <dc:creator>sfrunza13</dc:creator>
      <pubDate>Sat, 15 Apr 2023 00:30:33 +0000</pubDate>
      <link>https://forem.com/sfrunza13/git-actions-3phi</link>
      <guid>https://forem.com/sfrunza13/git-actions-3phi</guid>
      <description>&lt;h2&gt;
  
  
  This week in Star Chart
&lt;/h2&gt;

&lt;p&gt;We are nearing the 1.0 release of star chart and a lot of the big ticket items are done, the site really seems as though it is coming together and we even deployed it to production.&lt;/p&gt;

&lt;p&gt;Initially we intended to deploy to production every time we pushed a v Tag for a new version of star chart and have an action run that would automate the release and change log for that new version tag. We tried testing this and found that we had some problems with permissions which will be a common theme this week although for a different reason later and we decided instead to create a release branch. The releases will be done by merging the appropriate version of main into the release branch and that will trigger the release to prod. What I did is I got an action working that will automate a changelog, creating a release tag with the release and taking all of the new commits from this release tag to the previous one and documenting them in a change log for the new release.&lt;/p&gt;

&lt;p&gt;This was achieved using the following action: &lt;a href="https://github.com/marvinpinto/action-automatic-releases" rel="noopener noreferrer"&gt;Action!&lt;/a&gt;. Initially this was what I intended to use to automate releases on pushing version tags but it also worked for this. The problem I ran into was the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; Generating release tag
  Attempting to create or update release tag "release"
  Could not create new tag "refs/tags/release" (Resource not accessible by integration) therefore updating existing tag "tags/release"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I realized that it was a permissions problem but could not figure out at a glance what permission I was missing and this wasn't really documented in the action docs so I eventually found my way to &lt;a href="https://docs.github.com/en/rest/overview/permissions-required-for-github-apps?apiVersion=2022-11-28" rel="noopener noreferrer"&gt;Github Docs&lt;/a&gt;. I made an educated guess as to which of these subheadings we would need by matching what I saw in the error to a similar looking git api. After adding permissions to the yml file to write content the next release worked and generated a change log:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8z3ki5pzo1xbr4a8pus.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8z3ki5pzo1xbr4a8pus.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;PRs: &lt;a href="https://github.com/DevelopingSpace/starchart/pull/563" rel="noopener noreferrer"&gt;#563&lt;/a&gt;, &lt;a href="https://github.com/DevelopingSpace/starchart/pull/590" rel="noopener noreferrer"&gt;#590&lt;/a&gt;, &lt;a href="https://github.com/DevelopingSpace/starchart/pull/609" rel="noopener noreferrer"&gt;#609&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Finishing Impersonation</title>
      <dc:creator>sfrunza13</dc:creator>
      <pubDate>Mon, 10 Apr 2023 14:45:48 +0000</pubDate>
      <link>https://forem.com/sfrunza13/finishing-impersonation-38f9</link>
      <guid>https://forem.com/sfrunza13/finishing-impersonation-38f9</guid>
      <description>&lt;h2&gt;
  
  
  Finishing impersonation
&lt;/h2&gt;

&lt;p&gt;This past week my issue of choice when working on &lt;a href="https://github.com/DevelopingSpace/starchart"&gt;the Starchart (My.Custom.Domain) opensource web site&lt;/a&gt; was the following to broadly "make impersonation work" &lt;a href="https://github.com/DevelopingSpace/starchart/issues/508"&gt;#508&lt;/a&gt;. The week before last I had gotten the logic I wanted to use for this issue landed in terms of how it would work on the session/root loader side of things and I replaced every place I could see at the time that was using the useUser hook to take a user out of the root loader with my new useEffectiveUser hook which would do the same but would allow for admins to impersonate other users and act in their stead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reconciling code differences
&lt;/h2&gt;

&lt;p&gt;For the majority of this week's work I ended up working as is often the case in another developer's code, and saw some things that I have not seen before. I had already seen the way that this dev had written simple button posts using &lt;a href="https://remix.run/docs/en/1.15.0/hooks/use-fetcher#usefetcher"&gt;useFetcher&lt;/a&gt; from &lt;a href="https://remix.run/docs/en/1.15.0"&gt;Remix&lt;/a&gt; and thought that was cool, I tried using it before myself although I don't remember if it ended up in any of my PRs, and after taking a while to remember how our components, routes, actions and loaders worked together I dove into the code in our admin pages.&lt;/p&gt;

&lt;p&gt;When writing my own code this time I stood true to what I had done before and kept what I knew worked moving forward so when I was writing the logic for the buttons on the admin table that should impersonate a user I used the same kind of logic I had done before where I wrapped the buttons in a form with an invisible input and made them of submit type. &lt;/p&gt;

&lt;p&gt;Once the buttons to submit were clicked the action for the admin route would be reached with my payload and there was already code on this route using something I had never seen before.&lt;/p&gt;

&lt;p&gt;The dev I had mentioned created this cool bit of code that would search through users as you entered characters into a search box, and on the "back end" (the action) they used a typed approach to their response using a library that is new to me called &lt;a href="https://zod.dev/"&gt;Zod&lt;/a&gt;. I tried to use Zod for quite a while and parse the payload as I was seeing, I added a new attribute to his parseFormSafe call and tried to make it conditional/optional seeing as my newEffectiveUser would not always be in the payload to the action but it didn't work the way I had hoped and was taking a bit longer than I was comfortable with at the time with the other obligations I have at the end of the semester. It turned out the best way I could think of doing it was to actually make the search logic and the impersonation logic mutually exclusive. First I would write the cave man way I have been writing the actions where I just try to extract something from the request's formData with a .get and if what I expect is there then I redirect to index with the effective user cookie populated with the new value from the button press and if not then we must have arrived here from the search box and so ensue the previous logic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tying up loose ends
&lt;/h2&gt;

&lt;p&gt;In this PR I also added requireAdmin to the admin route, I changed another one of pages from useUser to useEffectiveUser and I also did some changes to the way the header looks whenever an admin is impersonating someone so that it would show a theater mask and allow you to stop with the press of a newly added button in the header that worked similarly to how the impersonation button worked, that is to say a form submit that results in a redirect with a new cookie.&lt;/p&gt;

&lt;p&gt;The full PR is here &lt;a href="https://github.com/DevelopingSpace/starchart/pull/547"&gt;#547&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>opensource</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Patching and Pretending</title>
      <dc:creator>sfrunza13</dc:creator>
      <pubDate>Tue, 04 Apr 2023 01:33:40 +0000</pubDate>
      <link>https://forem.com/sfrunza13/patching-and-pretending-3981</link>
      <guid>https://forem.com/sfrunza13/patching-and-pretending-3981</guid>
      <description>&lt;h2&gt;
  
  
  This week in Starchart
&lt;/h2&gt;

&lt;p&gt;Here is my weekly run down of developments on my end to do with the &lt;a href="https://github.com/DevelopingSpace/starchart"&gt;Starchart&lt;/a&gt; project which is an open source project that has long since been renamed My.Custom.Domain (which I will not be calling it, because we are astronomers here) for students at Seneca College to be able to hone their skills while also delivering a website that can be used to generate certificates for some domains that might not be https for some reason &lt;em&gt;cough&lt;/em&gt; load balancers &lt;em&gt;cough&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;This past week I worked on an issue to mock users if you are part of the admin group (the chosen few) and that can be found &lt;a href="https://github.com/DevelopingSpace/starchart/pull/466"&gt;here&lt;/a&gt;. It was not the biggest code change but it was so dizzying trying to keep track of what I was dealing with between the session, the root loader and the database especially after I looked away from the project and focused on something else entirely, often written in a different language. This last week rolling into this one has given me a different perspective on focus as a finite resource with how many different directions I seem to be pulled in.&lt;/p&gt;

&lt;p&gt;It was also brought to my attention shortly after my code landed that staging was broken and David had already had the problem pretty well figured out so I dropped what I was doing to put in a small PR to change the undefined value that was causing us problems to a null value since null is valid in Java Script Object Notation. &lt;a href="https://github.com/DevelopingSpace/starchart/pull/501"&gt;The Fix&lt;/a&gt; marked Starchart's 1st PR past 500!&lt;/p&gt;

&lt;h2&gt;
  
  
  Looking forward
&lt;/h2&gt;

&lt;p&gt;Today marks a new beginning and the last week before we get going on Alpha for Starchart, as such we had a stand up where we took a look at every one of the open issues, even the ones we have already assigned and redistributed them more evenly, as well as highlighted the immediate tasks to take care of in this final sprint. &lt;/p&gt;

&lt;p&gt;Now that we are just pre-alpha we are also going to start bringing in more collaborators to begin testing our work without instruction to see if what we have created is friendly for new users.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>programming</category>
    </item>
    <item>
      <title>Who stole the cookies from the...</title>
      <dc:creator>sfrunza13</dc:creator>
      <pubDate>Mon, 27 Mar 2023 14:01:59 +0000</pubDate>
      <link>https://forem.com/sfrunza13/who-stole-the-cookies-from-the-1b6g</link>
      <guid>https://forem.com/sfrunza13/who-stole-the-cookies-from-the-1b6g</guid>
      <description>&lt;h2&gt;
  
  
  Last week in Starchart
&lt;/h2&gt;

&lt;p&gt;In the last week I was a part of a few extra meetings alongside the regular team stand ups for our open source project &lt;a href="https://github.com/DevelopingSpace/starchart"&gt;Starchart&lt;/a&gt;, a meeting at the start of the week to discuss the new SLO implementation with David where we arrived at a neater solution for the SLO cookie and made it strict and restricted it to the logout route. At the same time we made the session cookie strict, I had forgotten what I had seen when looking at &lt;a href="https://github.com/Seneca-CDOT/telescope"&gt;telescope's&lt;/a&gt; cookies. We also made some UI changes to the logout prompt making a less prominent button that would initiate SLO and a more vibrant red one that would just redirect you to sign in having only invalidated the session cookie with the starchart website. In any case, I was able to land the new SLO flow at the beginning of this week after some discussion and then demonstrated in a consequent mid-week meeting with the team &lt;a href="https://github.com/DevelopingSpace/starchart/pull/366"&gt;PR #366&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I also did a few reviews, although here I will only mention one of them since I felt I added a bit more to this PR than others &lt;a href="https://github.com/DevelopingSpace/starchart/pull/414"&gt;PR #414&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cookie problems
&lt;/h2&gt;

&lt;p&gt;Here we have the impromptu bug that refreshed my memory on one of the problems with cookies when doing SSO. When my SLO change was incorporated into staging it seemingly broke something when signing in, making it so that a user would have to sign in twice to be authenticated to Starchart. My first instinct was to check the networking tab and to take a look at the cookies because I remembered we set the session cookie to strict and lo and behold the session cookie was being rejected since the browser claimed it set as a result of a cross-site request. The browser was of course correct, the session cookie is set on our login callback as a result of a request from our IDP which is a different origin and indeed cross-site, since we set the session cookie to be strict it would not be set by any cross-site requests at all. The simple solution here was to set the cookie to lax instead of strict and allow it to be set as a result of a cross-site request and this seems to be the general consensus when it comes to SSO seeing as session cookies are very often set as a result of a callback from an entity separate from our website. We did however keep the SLO cookie as strict since it really only exists and needs to be used within the one logout route that I have written within our own application. In any case here is the one word PR that fixed our double login issue &lt;a href="https://github.com/DevelopingSpace/starchart/pull/427"&gt;PR #427&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;p&gt;Next I need to take a look at allowing admins to impersonate users in Starchart which I should do by adding information to the session, an "effective user" field that will come empty for admins so that they can set it to who they would want to impersonate and that would come forcibly filled with a regular user's own username so they can not in fact impersonate anyone else.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>programming</category>
    </item>
    <item>
      <title>Reworking SLO</title>
      <dc:creator>sfrunza13</dc:creator>
      <pubDate>Mon, 20 Mar 2023 02:02:35 +0000</pubDate>
      <link>https://forem.com/sfrunza13/reworking-slo-33ip</link>
      <guid>https://forem.com/sfrunza13/reworking-slo-33ip</guid>
      <description>&lt;h2&gt;
  
  
  Reworking Logout
&lt;/h2&gt;

&lt;h5&gt;
  
  
  A few times
&lt;/h5&gt;

&lt;p&gt;This week there were a few small PRs that I landed for our opensource project &lt;a href="https://github.com/DevelopingSpace/starchart"&gt;Starchart / My.Custom.Domain&lt;/a&gt; worth mentioning:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/DevelopingSpace/starchart/pull/343"&gt;343&lt;/a&gt; Which took out the SLO portion of our app in favor of just ending the session with Starchart&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/DevelopingSpace/starchart/pull/356"&gt;356&lt;/a&gt; Which is a small change because the groups claim can come back as either an array or a string which was not something we were aware of and this fixes that. This is pretty important now as we're rolling things out into staging and need to give everyone the opportunity to log in but the change is small.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/DevelopingSpace/starchart/pull/385"&gt;385&lt;/a&gt; A version bump for the app to match the release notes for 0.6&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;TD and I also reviewed and merged a first time commiters PR for a simple typo here: &lt;a href="https://github.com/DevelopingSpace/starchart/pull/378"&gt;378&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I also gave a presentation on Wednesday about how my SAML code works, what the IDP and SP are, how their metadata is configured, the important parts of the configuration (the certificate, signature, claims and the assertion consumer service bindings) and how to follow along with the key requests in the SAML flow that have to do with what we send and what we receive at our callback.&lt;/p&gt;

&lt;p&gt;The rest of the week's efforts on Starchart were spent on adding Single Logout back into the program and I have done it a few ways now.&lt;/p&gt;

&lt;p&gt;The first time I gave the user a page with two buttons that were choices to either logout of Starchart or logout of all Seneca services, the review on the initial PR was that the session should automatically be destroyed and then the choice should be given to SLO. I decided to put my logout page under index because I wanted the pretty header to render with my buttons, this caused some problems here because destroying the session meant we had no user information any longer which meant the header could not render display name and if the user would choose to SLO we had no idea which user to SLO.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--A13wQsEh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2d9l64fh3m1jpn4jc19l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A13wQsEh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2d9l64fh3m1jpn4jc19l.png" alt="Image description" width="880" height="668"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My first solution to get around this was to use global variables to keep track of the user that logged out while they were making their decision. It was later brought to my attention that globals won't work because they can't keep track of multiple clients usernames so I changed it to use cookies instead.&lt;/p&gt;

&lt;p&gt;I added a redirect to the function that destroys the session and added a cookie for it to return with the username, in this way we can redirect to the logout page again and the loader can check for that cookie and use it as the value to send to the SLO request when the button's pressed and the post sets off the action to create the SLO request.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kRMSOj4r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2u2vh184r6gdlej4dz4z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kRMSOj4r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2u2vh184r6gdlej4dz4z.png" alt="Image description" width="880" height="813"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I made the username in the header optional although I think following recent discussions I will just move the logout page so it will not have the header since that improves clarity.&lt;/p&gt;

&lt;p&gt;The PR discussed above is here: &lt;a href="https://github.com/DevelopingSpace/starchart/pull/366"&gt;366&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;David and I also tried out staging a bit and each created an a record that works to redirect to an EC2 instance he stood up.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fugy872l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z6fox8cl3x0x68nji0qh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fugy872l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z6fox8cl3x0x68nji0qh.png" alt="Image description" width="880" height="402"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Successful SAML</title>
      <dc:creator>sfrunza13</dc:creator>
      <pubDate>Sun, 12 Mar 2023 03:59:39 +0000</pubDate>
      <link>https://forem.com/sfrunza13/successful-saml-3f5</link>
      <guid>https://forem.com/sfrunza13/successful-saml-3f5</guid>
      <description>&lt;h2&gt;
  
  
  Testing
&lt;/h2&gt;

&lt;p&gt;This week was the first coming back from the reading week break and I had a few clear cut objectives coming into it. The first thing that I wanted to accomplish was to create an e2e test for the authentication flow that I have added to &lt;a href="https://github.com/DevelopingSpace/starchart"&gt;the open source starchart project&lt;/a&gt;. The library that we use for e2e testing is &lt;a href="https://playwright.dev"&gt;playwright&lt;/a&gt;, and using it is actually pretty easy. The corresponding issue for the creation of the test is &lt;a href="https://github.com/DevelopingSpace/starchart/issues/98"&gt;here&lt;/a&gt;. Initially there was a speed bump seeing as the playwright scripts were written to run with a different port but David looked into it and came to the conclusion that using 8080 should be fine and after that change my e2e tests passed CI &lt;a href="https://github.com/sfrunza13/starchart/pull/1"&gt;PR#1 to my branch&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I learned after I was done with creating my test that it is possible to use a plugin to easily record things but doing it how I did it was not far off, instead of using a pretty plugin I just ran the dev server in one console and I ran an npx command in another: &lt;code&gt;npx playwright codegen localhost:8080&lt;/code&gt;. This looks a little wonky seeing as for some reason the CSS does not quite take on this browser that is used for recording tests but in any case it makes writing tests easy because you can practically do what you want to test and it records the playwright syntax that would re-produce your actions on the specified URL (in this case localhost:8080). Here's how it looks:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Lt34Zdag--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b2ts8cmx7nskm6k7gw41.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Lt34Zdag--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b2ts8cmx7nskm6k7gw41.png" alt="Image description" width="880" height="546"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;along with a console that allows you to pick elements out of the page and start and stop recording along with a real time view of the playwright syntax you are recording with your actions:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i7dvsVMj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hlpzdin9usraeymke50m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i7dvsVMj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hlpzdin9usraeymke50m.png" alt="Image description" width="591" height="592"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Something similar to the auth test that I wrote in &lt;a href="https://github.com/DevelopingSpace/starchart/pull/294"&gt;#294&lt;/a&gt; was later used as a dependency for the rest of the e2e tests in a PR written by Eakam &lt;a href="https://github.com/DevelopingSpace/starchart/pull/313"&gt;#313&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This is a video from the playwright devs showing off project dependencies, what was used in #313.  &lt;a href="https://www.youtube.com/watch?v=PI50YAPTAs4"&gt;https://www.youtube.com/watch?v=PI50YAPTAs4&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Staging SAML
&lt;/h2&gt;

&lt;p&gt;The second order of business this week was to bring the local idp I set up more in line with the staging idp by actually testing our SAML in staging and seeing what claims we get back from Azure AD and then taking those claims and configuring our simpleSAMLphp local idp to return the same claims.&lt;/p&gt;

&lt;p&gt;David tasked me with gutting starchart so that all that was left was the SAML logic basically and so that is what I did. Then after the second meeting of the week we got on a call and took my butchered branch to staging after I pushed it as an image to dockerhub so that he could run a container of it.&lt;/p&gt;

&lt;p&gt;There was a problem that I did not understand when we got to trying to run it, to solve it David pulled up the files in the build folder and added logging to key points where our IDP was being used to find that despite us setting the IDP in an init method when the code called for its use it was undefined. This was the impetus for the changes to the init logic that David had setup the weeks prior in &lt;a href="https://github.com/DevelopingSpace/starchart/pull/321"&gt;#321&lt;/a&gt;. The change towards loading the idp metadata from a file turns out to also be the recommendation from a security perspective as well apparently as mentioned &lt;a href="https://workos.com/blog/fun-with-saml-sso-vulnerabilities-and-footguns"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After fixing the issue we were able to see what the response from the actual Seneca IDP would look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
   "attributes":{
      "displayname":"Stefan Frunza",
      "email":"sfrunza@myseneca.ca",
      "group":"mycustomdomain-dev-students",
      "http://schemas.microsoft.com/claims/authnmethodsreferences":"http://schemas.microsoft.com/ws/2008/06/identity/authenticationmethod/password",
      "http://schemas.microsoft.com/identity/claims/identityprovider":"https://sts.windows.net/eb34f74a-58e7-4a8b-9e59-433e4c412757/",
      "http://schemas.microsoft.com/identity/claims/objectidentifier":"61e8ee88-bd7c-453f-be1d-f11778b7c191",
      "http://schemas.microsoft.com/identity/claims/tenantid":"eb34f74a-58e7-4a8b-9e59-433e4c412757",
      "sAMAccountName":"sfrunza"
   },
   "audience":"https://mycustomdomain-dev.senecacollege.ca/sp",
   "conditions":{
      "notBefore":"2023-03-08T20:39:18.590Z",
      "notOnOrAfter":"2023-03-08T21:44:18.590Z"
   },
   "issuer":"https://sts.windows.net/eb34f74a-58e7-4a8b-9e59-433e4c412757/",
   "level":"info",
   "message":"Saml Response",
   "nameID":"bwNMtMWvOf99rmm1zCSelnfkgSOijBEQubNe0G7Ir58",
   "response":{
      "destination":"https://mycustomdomain-dev.senecacollege.ca/login/callback",
      "id":"_295e9f6d-abeb-41ae-bef4-10b4112c8bb1",
      "inResponseTo":"_bf26e2ce-93f6-4816-8ad9-cb74629f80e1",
      "issueInstant":"2023-03-08T20:44:18.767Z"
   },
   "sessionIndex":{
      "authnInstant":"2023-03-08T20:44:17.232Z",
      "sessionIndex":"_920c1410-15fe-44be-ac98-70d17cb73000"
   },
   "timestamp":"2023-03-08T20:44:20.906Z"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I was also able to take some snapshots of our great victory:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wxB7rgDd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hz792ggs124ctup39mxi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wxB7rgDd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hz792ggs124ctup39mxi.png" alt="Image description" width="880" height="269"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3r-0B6x9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ryavvmcp3s40ksnag8f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3r-0B6x9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ryavvmcp3s40ksnag8f.png" alt="Image description" width="880" height="290"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xgRyz-NX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7y8s8hlird894r4znahy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xgRyz-NX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7y8s8hlird894r4znahy.png" alt="Image description" width="706" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The work we did here allowed Chen and I to rework the user model and simpleSAMLphp config in the following &lt;a href="https://github.com/DevelopingSpace/starchart/pull/312"&gt;#312&lt;/a&gt; &lt;a href="https://github.com/DevelopingSpace/starchart/pull/307"&gt;#307&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Looking forward
&lt;/h2&gt;

&lt;p&gt;I noticed that the routing is deprecated and slated to change to &lt;a href="https://github.com/kiliman/remix-flat-routes"&gt;flat routes&lt;/a&gt; and opened the following issue &lt;a href="https://github.com/DevelopingSpace/starchart/issues/320"&gt;#320&lt;/a&gt;.&lt;br&gt;
I also opened an issue to do with how we plan to handle admins, in that the admins are meant to be able to assume control of regular user accounts and so there should be an "effective username" field as well &lt;a href="https://github.com/DevelopingSpace/starchart/issues/306"&gt;#306&lt;/a&gt;. The effective username should come in empty only for admins and the rest of the users should have that field be populated with their username.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>opensource</category>
      <category>programming</category>
    </item>
    <item>
      <title>Landing SSO</title>
      <dc:creator>sfrunza13</dc:creator>
      <pubDate>Sun, 26 Feb 2023 23:58:47 +0000</pubDate>
      <link>https://forem.com/sfrunza13/landing-sso-1jnf</link>
      <guid>https://forem.com/sfrunza13/landing-sso-1jnf</guid>
      <description>&lt;h2&gt;
  
  
  Landing the beginning to the SSO work
&lt;/h2&gt;

&lt;p&gt;This week I spent the majority of my time working on OSD trying to address the comment on my &lt;a href="https://github.com/DevelopingSpace/starchart/pull/236" rel="noopener noreferrer"&gt;PR #236&lt;/a&gt; for the first bits of a working SSO flow using &lt;a href="https://samlify.js.org/#/?id=samlify" rel="noopener noreferrer"&gt;Samlify&lt;/a&gt; and &lt;a href="https://remix.run/docs/en/v1/tutorials/blog" rel="noopener noreferrer"&gt;Remix&lt;/a&gt;, partly based on &lt;a href="https://github.com/christopherpickering/remix-saml-authentication/tree/master/app" rel="noopener noreferrer"&gt;this repo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This &lt;a href="https://github.com/DevelopingSpace/starchart/pull/236" rel="noopener noreferrer"&gt;PR&lt;/a&gt; addressed the following &lt;a href="https://github.com/DevelopingSpace/starchart/issues/195" rel="noopener noreferrer"&gt;issue&lt;/a&gt; and then maybe a little more.&lt;/p&gt;

&lt;p&gt;The initial scope of the issue was to add a SAML server to the project in which I would configure the SP and the IDP. The IDP would be configured using the XML data that the SimpleSAMLPHP container we use in production provides. At first this was fetched from an endpoint that exposes the XML, the route that we fetched it from was saved as an environment variable. After a few iterations upon my initial commits this became us reading the file from a local secrets folder in DEV where I had copied and pasted the pertinent XML, these secrets will be configured through Docker Swarm Secrets. The SP on the other hand was created within our code using the constructor that Samlify provides, setting the redirect and post bindings directly in the code.&lt;/p&gt;

&lt;p&gt;David made the comment upon his first review that the SP and IDP objects need not be known by the rest of our program, meaning that it would be best if we did not have to export these from SAML server and into whatever other files would be using Samlify functionality. Instead what I ended up doing was I created functions that made use of the SP and IDP objects within the SAML Server file and exported functionality in that way, using only those Samlify API That I knew I would need.&lt;/p&gt;

&lt;p&gt;There was also the issue of keeping the route to redirect to after logging in, this was achieved through the RelayState query parameter that seems to be a standard part of SAML. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This RelayState parameter is meant to be an opaque identifier that is passed back without any modification or inspection&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The relay state is often used in IDP initiated SSO so that the IDP actually can signal to the SP what URL it should redirect to once successfully signed on, in our case the flow is SP initiated but it makes it easy for us to take the &lt;code&gt;redirectTo&lt;/code&gt; query param from remix and append it to the SAML request as a &lt;code&gt;relayState&lt;/code&gt; and from there it persists through the whole flow, coming back in the response body when the SAML response is posted.&lt;/p&gt;

&lt;p&gt;There were several parts of my code that could use a guard clause and I refactored my code as such, this is something I should probably keep in mind as we go forward along with some typescript functionality I learned this week through reading some of Denes and Won's code where they use TypeScript operators like the &lt;code&gt;!&lt;/code&gt; on functions, or the &lt;a href="https://www.typescriptlang.org/docs/handbook/utility-types.html" rel="noopener noreferrer"&gt;&lt;code&gt;pick&lt;/code&gt;&lt;/a&gt; utility type that allows for the construction of a type by picking only the desired attributes from other types using the union &lt;code&gt;|&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;David also taught me about narrowing a type down by using the &lt;code&gt;as&lt;/code&gt; keyword which helped me directly in my code when using it to narrow down FormDataEntryValue to a string, along with being reminded to use the URL methods when constructing more complex paths instead of relying on string concatenation.&lt;/p&gt;

&lt;p&gt;These are all things that I should keep in mind moving forward when reviewing but I am afraid they will still slip my mind regularly even as I am coding.&lt;/p&gt;

&lt;h2&gt;
  
  
  Being a sheriff
&lt;/h2&gt;

&lt;p&gt;This week was my first being a sheriff. I don't think I did the worst job but I could have been more active than I was particularly in reviewing PRs. I think when it came down to it I reviewed two of them, one of Chen's and one of Won's although I just made a comment about &lt;code&gt;starchartdev&lt;/code&gt; still being used as the user and I don't know how helpful that is, I should have followed up further.&lt;/p&gt;

&lt;p&gt;This week we did not have a first weekly meeting due to Family day and so I took to Slack to remind everyone to commit to some work and be ready to talk about it later in the week and to be active on Slack if they required assistance with blockers.&lt;/p&gt;

&lt;p&gt;In the Wednesday meeting I did a quick run down of the team's current goals and whether they had any blockers which is customary now, and David reminded me to get commitments on those folks who had outstanding PRs for landing them, we also set a new hard deadline for PRs to be reviewed which is as of now noon on Friday every week. Afterwards David lead the class in an example PR on Denes's Let's Encrypt code and as I mentioned I learned some TS syntax during the demonstration.&lt;/p&gt;

&lt;p&gt;I think to be more effective as a leader I need to get more familiar with the libraries we are using. It does not come easy to me to review Let's Encrypt or the DNS Route 53 code, I think I am going to have to make a concerted effort to learn and become comfortable with these things and it seems like a lot to take in. That being said as the demo on Wednesday highlighted there are many parts of a PR that can be reviewed without express knowledge of the details, whether something is well commented, whether guard clauses are being used as I have come to know, whether there is an else in a conditional after a return, a lot of more common concerns.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;p&gt;I still have a lot to do with the SSO part of Starchart which makes me wonder how I'll be able to become more familiar with Let's Encrypt and the DNS stuff, essentially the bulk of our logic to what the site seeks to achieve, while I am going to get into trying to get SSO to work with the Staging IDP and Metadata, and I seek to ensure the validity of the responses through signatures that I have yet to really successfully configure along with the concern of logging out (which David has suggested we should perhaps not do SLO and instead just kill the session). I am contributing but I don't know if quite enough yet, and whether I am really doing the role of sheriff justice.&lt;/p&gt;

</description>
      <category>software</category>
      <category>tools</category>
      <category>manufacturing</category>
    </item>
    <item>
      <title>Failing Forward</title>
      <dc:creator>sfrunza13</dc:creator>
      <pubDate>Mon, 20 Feb 2023 02:35:24 +0000</pubDate>
      <link>https://forem.com/sfrunza13/failing-forward-oj9</link>
      <guid>https://forem.com/sfrunza13/failing-forward-oj9</guid>
      <description>&lt;p&gt;This week was a big one for the authentication part of &lt;a href="https://github.com/DevelopingSpace/starchart"&gt;starchart&lt;/a&gt;, or it should have been.&lt;/p&gt;

&lt;p&gt;I started this week by taking up an &lt;a href="https://github.com/DevelopingSpace/starchart/issues/195"&gt;issue&lt;/a&gt; I had written to add a SAML Server that configures the Identity Provider and the Service Provider objects from SAMLIFY with the appropriate metadata and settings and although the authentication flow seems to work I kind of doubt that it really does.&lt;/p&gt;

&lt;p&gt;This week started with me pulling from the &lt;a href="https://samlify.js.org/#/?id=samlify"&gt;Offical SAMLIFY docs&lt;/a&gt; and the &lt;a href="https://github.com/christopherpickering/remix-saml-authentication"&gt;Remix SAML example&lt;/a&gt;. I got the authentication process to work but I did not add signature requirements or validation of signatures, and I was also importing the sp and idp objects and exposing them in every file where there was supposed to be some SAMLIFY logic, and I also fetched the idp xml metadata from the endpoint the simple saml php container exposes it on, I changed this in a consequent commit so that we have the file locally and read it using fs, all of this is kind of subject to change and that is the essence of the problem. &lt;/p&gt;

&lt;p&gt;This week I got my &lt;a href="https://github.com/DevelopingSpace/starchart/pull/236"&gt;PR&lt;/a&gt; in on Thursday, which is pretty late, especially considering there was an influx of other PRs that would come in on the weekend as well, for a PR that has as many problems as mine does (currently 46 comments and probably more to come), the weekend is not enough time to sort it all out and land it properly. So one of the take aways from this week is to either make smaller PRs or get the PR up earlier in the week, in any case be more pro-active.&lt;/p&gt;

&lt;h2&gt;
  
  
  Now about failure
&lt;/h2&gt;

&lt;p&gt;My code has a lot of problems, for example I keep on missing potential simplification by adding guard clauses on my conditional logic and I exposed the IDP and SP when I could have kept the SAMLIFY objects localized to a file and only exported functionality, and there are a bunch of other things like not to put else conditions after returns which I did on some of my redirects.&lt;/p&gt;

&lt;p&gt;Apart from these better coding practices I am failing to fundamentally achieve my goal in understanding exactly how to get this SAML process to work. I initially thought that I wanted every request and response signed, then I thought that I just want my assertions from the IDP signed, then I realized more recently that those are not being signed despite me specifying in the SP config that they ought to be because in the extract there should be an additional signature attribute for claims I believe.&lt;/p&gt;

&lt;p&gt;Something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  samlContent: "&amp;lt;samlp:Response ...",
  extract: {
    audience: "https://sp.example.org/sso/metadata",
    attribute: {
      email: "user@esaml2.com",
      lastName: "Samuel",
      firstName: "E"
    },
    conditions: {
      notbefore: "2015-10-26T11:41:43.500Z"
      notonorafter: "2015-10-26T11:46:43.500Z"
    },
    issuer: ['https://sp.example.org/sso/metadata'],
    nameID: "user@esaml2.com"
    signature: "&amp;lt;Signature ... &amp;lt;/Signature&amp;gt;",
    statuscode: {
      value: "urn:oasis:names:tc:SAML:2.0:status:Success"
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://github.com/tngan/samlify/blob/master/docs/saml-response.md"&gt;https://github.com/tngan/samlify/blob/master/docs/saml-response.md&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Granted our extract looks really similar, the signature field wasn't there last I checked.&lt;/p&gt;

&lt;p&gt;EDIT: Upon closer examination we might be getting it signed actually, I was only looking at the extract but the signature is not &lt;em&gt;WITHIN&lt;/em&gt; the extract object, I will double check this soon. Could it be that I am too quick to write off what I make as bad? Tune in in 20 mins to find out.&lt;/p&gt;

&lt;p&gt;EDIT 2: WSL and Docker are acting up again.&lt;/p&gt;

&lt;p&gt;I am doing my best to quickly learn about and fix the things I don't know but the documentation is not as easy to navigate as I thought. There's not a great deal of detail in it despite the presentation being great.&lt;/p&gt;

&lt;p&gt;As it stands I do not really know how I am going to go about parsing the response from logout, or whether SP initiated logout is even supported using SAMLIFY. What I wrote "works" but it also isn't being validated and I don't really know what I did. I know that I configured a POST binding for logout and that it manifests as a get request on the callback route but the way that I make the logout request and how the response comes back as a query param and then parsing it, I have a lot of work to do to figure out if that is the correct way of doing it and then how to do it.&lt;/p&gt;

&lt;p&gt;I have taken to trying to also look through some of the &lt;a href="https://github.com/tngan/samlify/blob/1d7876358176942bc1ea31a71ec97369f29a6c6a/test/flow.ts#L503"&gt;test cases&lt;/a&gt; for inspiration but sometimes I feel like it just makes my head hurt more than it helps. This idea that the POST binding acts like a REDIRECT for logouts is already weird and reading stuff like this &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2dwYcIHM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e0ldbfdz9923e1520prz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2dwYcIHM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e0ldbfdz9923e1520prz.png" alt="Image description" width="819" height="257"&gt;&lt;/a&gt;&lt;br&gt;
in the docs makes me wonder if I am trying to do something that can't be done in the first place.&lt;/p&gt;

&lt;p&gt;In any case there are clear next steps, clean up my code and land this signature-less, essentially validation-less SAML code because it works well enough to get logged in with the local IDP, then get the signature working on the assertions, unless it's the message that I am supposed to sign, not the assertions, because those are separate things and now I am unsure about that as well. Then figure out logout properly, also does logout have to be signed? Also, are the dependencies for the XML validator that I imported good?&lt;/p&gt;

&lt;p&gt;I'm making a mess of things again, but that's not always bad, hence the title.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Failing Forward&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I mean, I did add a saml server, a few callbacks and actually login and out through simple saml php idp from the docker container so that's something I guess.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>opensource</category>
      <category>programming</category>
    </item>
    <item>
      <title>Local IDP</title>
      <dc:creator>sfrunza13</dc:creator>
      <pubDate>Sun, 12 Feb 2023 19:29:34 +0000</pubDate>
      <link>https://forem.com/sfrunza13/local-idp-4h7c</link>
      <guid>https://forem.com/sfrunza13/local-idp-4h7c</guid>
      <description>&lt;p&gt;As per &lt;a href="https://github.com/Seneca-CDOT/starchart/issues/105" rel="noopener noreferrer"&gt;issue 105&lt;/a&gt; and &lt;a href="https://github.com/Seneca-CDOT/starchart/pull/174" rel="noopener noreferrer"&gt;PR 174&lt;/a&gt;, we have a docker container that will act as a local IDP with a few users it recognizes that it will return SAML response claims for.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ctrl + C the foundation
&lt;/h2&gt;

&lt;p&gt;For our purposes in Starchart we intend to use a SAML auth flow similar to how we had it in Telescope, we are using Remix and SAMLIFY instead of passport SAML however and this will prove to be a little different as I get into writing the SAML server next week, but there is a lot of cross over in what we will have to work with. For example in both cases we will have to have a local IDP that will provide us with a SAML response that contains all the claims that we expect to receive from Microsoft Active Directory in production (more or less). The configuration we have in Telescope is that of a docker container that exposes simpleSAMLphp on PORT 8081 upon which we can access the mock IDP and the xml metadata we need to be able to work with it. The following is an example of the format the metadata file takes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?xml version="1.0"?&amp;gt;
&amp;lt;md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" entityID="http://localhost:8081/simplesaml/saml2/idp/metadata.php"&amp;gt;
  &amp;lt;md:IDPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol"&amp;gt;
    &amp;lt;md:KeyDescriptor use="signing"&amp;gt;
      &amp;lt;ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&amp;gt;
        &amp;lt;ds:X509Data&amp;gt;
          &amp;lt;ds:X509Certificate&amp;gt;MIIDXTCCAkWgAwIBAgIJALmVVuDWu4NYMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwHhcNMTYxMjMxMTQzNDQ3WhcNNDgwNjI1MTQzNDQ3WjBFMQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzUCFozgNb1h1M0jzNRSCjhOBnR+uVbVpaWfXYIR+AhWDdEe5ryY+CgavOg8bfLybyzFdehlYdDRgkedEB/GjG8aJw06l0qF4jDOAw0kEygWCu2mcH7XOxRt+YAH3TVHa/Hu1W3WjzkobqqqLQ8gkKWWM27fOgAZ6GieaJBN6VBSMMcPey3HWLBmc+TYJmv1dbaO2jHhKh8pfKw0W12VM8P1PIO8gv4Phu/uuJYieBWKixBEyy0lHjyixYFCR12xdh4CA47q958ZRGnnDUGFVE1QhgRacJCOZ9bd5t9mr8KLaVBYTCJo5ERE8jymab5dPqe5qKfJsCZiqWglbjUo9twIDAQABo1AwTjAdBgNVHQ4EFgQUxpuwcs/CYQOyui+r1G+3KxBNhxkwHwYDVR0jBBgwFoAUxpuwcs/CYQOyui+r1G+3KxBNhxkwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAAiWUKs/2x/viNCKi3Y6blEuCtAGhzOOZ9EjrvJ8+COH3Rag3tVBWrcBZ3/uhhPq5gy9lqw4OkvEws99/5jFsX1FJ6MKBgqfuy7yh5s1YfM0ANHYczMmYpZeAcQf2CGAaVfwTTfSlzNLsF2lW/ly7yapFzlYSJLGoVE+OHEu8g5SlNACUEfkXw+5Eghh+KzlIN7R6Q7r2ixWNFBC/jWf7NKUfJyX8qIG5md1YUeT6GBW9Bm2/1/RiO24JTaYlfLdKK9TYb8sG5B+OLab2DImG99CJ25RkAcSobWNF5zD0O6lgOo3cEdB/ksCq3hmtlC/DlLZ/D8CJ+7VuZnS1rR2naQ==&amp;lt;/ds:X509Certificate&amp;gt;
        &amp;lt;/ds:X509Data&amp;gt;
      &amp;lt;/ds:KeyInfo&amp;gt;
    &amp;lt;/md:KeyDescriptor&amp;gt;
    &amp;lt;md:KeyDescriptor use="encryption"&amp;gt;
      &amp;lt;ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&amp;gt;
        &amp;lt;ds:X509Data&amp;gt;
          &amp;lt;ds:X509Certificate&amp;gt;MIIDXTCCAkWgAwIBAgIJALmVVuDWu4NYMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwHhcNMTYxMjMxMTQzNDQ3WhcNNDgwNjI1MTQzNDQ3WjBFMQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzUCFozgNb1h1M0jzNRSCjhOBnR+uVbVpaWfXYIR+AhWDdEe5ryY+CgavOg8bfLybyzFdehlYdDRgkedEB/GjG8aJw06l0qF4jDOAw0kEygWCu2mcH7XOxRt+YAH3TVHa/Hu1W3WjzkobqqqLQ8gkKWWM27fOgAZ6GieaJBN6VBSMMcPey3HWLBmc+TYJmv1dbaO2jHhKh8pfKw0W12VM8P1PIO8gv4Phu/uuJYieBWKixBEyy0lHjyixYFCR12xdh4CA47q958ZRGnnDUGFVE1QhgRacJCOZ9bd5t9mr8KLaVBYTCJo5ERE8jymab5dPqe5qKfJsCZiqWglbjUo9twIDAQABo1AwTjAdBgNVHQ4EFgQUxpuwcs/CYQOyui+r1G+3KxBNhxkwHwYDVR0jBBgwFoAUxpuwcs/CYQOyui+r1G+3KxBNhxkwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAAiWUKs/2x/viNCKi3Y6blEuCtAGhzOOZ9EjrvJ8+COH3Rag3tVBWrcBZ3/uhhPq5gy9lqw4OkvEws99/5jFsX1FJ6MKBgqfuy7yh5s1YfM0ANHYczMmYpZeAcQf2CGAaVfwTTfSlzNLsF2lW/ly7yapFzlYSJLGoVE+OHEu8g5SlNACUEfkXw+5Eghh+KzlIN7R6Q7r2ixWNFBC/jWf7NKUfJyX8qIG5md1YUeT6GBW9Bm2/1/RiO24JTaYlfLdKK9TYb8sG5B+OLab2DImG99CJ25RkAcSobWNF5zD0O6lgOo3cEdB/ksCq3hmtlC/DlLZ/D8CJ+7VuZnS1rR2naQ==&amp;lt;/ds:X509Certificate&amp;gt;
        &amp;lt;/ds:X509Data&amp;gt;
      &amp;lt;/ds:KeyInfo&amp;gt;
    &amp;lt;/md:KeyDescriptor&amp;gt;
    &amp;lt;md:SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="http://localhost:8081/simplesaml/saml2/idp/SingleLogoutService.php"/&amp;gt;
    &amp;lt;md:NameIDFormat&amp;gt;urn:oasis:names:tc:SAML:2.0:nameid-format:persistent&amp;lt;/md:NameIDFormat&amp;gt;
    &amp;lt;md:SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="http://localhost:8081/simplesaml/saml2/idp/SSOService.php"/&amp;gt;
  &amp;lt;/md:IDPSSODescriptor&amp;gt;
&amp;lt;/md:EntityDescriptor&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and all of this information is stood up for us on a url that we can pull it from &lt;code&gt;http://localhost:8081/simplesaml/saml2/idp/metadata.php&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;p&gt;Now that we have a test IDP we can configure our starchart program to be an SP that works with bindings to it so that when we sign in it will redirect to the IDP and then once the user info is passed to the IDP it will return a SAML response with claims about the user that we can use as a service provider to allow them access to our application. This will be done through SAMLIFY, I am thinking that the IDP can be configured with something similar to the following except replacing the path with a path to the xml to our simpleSAMLphp IDP&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const idp = saml.IdentityProvider({
  metadata: fs.readFileSync('./metadata/onelogin_metadata_486670.xml')
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and we can configure Starchart as a service provider in code and generate the SP XML and then expose the metadata to the public as per the following docs: &lt;a href="https://samlify.js.org/#/configuration" rel="noopener noreferrer"&gt;https://samlify.js.org/#/configuration&lt;/a&gt;. This is similar to what is done in Telescope under SSO in the Authentication and Saml-Metadata files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ensuing work from this week's PR
&lt;/h2&gt;

&lt;p&gt;This week's PR lead to the creation of the following &lt;a href="https://github.com/Seneca-CDOT/starchart/issues/175" rel="noopener noreferrer"&gt;issue&lt;/a&gt; so that we can have a few existing users associated with the mock IDP users so that we can test existing users returning and one or two users in the IDP that we test as first time users of the application.&lt;/p&gt;

&lt;p&gt;Also I have yet to add documentation on the Mock IDP and the users that we have configured for use currently.&lt;/p&gt;

&lt;p&gt;The IDP itself is not really being used by starchart yet so I am debating doing the SSO flow to see it work first before documenting but there's no real reason I can't do both.&lt;/p&gt;

</description>
      <category>jokes</category>
      <category>watercooler</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Remixing the Blues</title>
      <dc:creator>sfrunza13</dc:creator>
      <pubDate>Sun, 05 Feb 2023 20:38:30 +0000</pubDate>
      <link>https://forem.com/sfrunza13/remixing-the-blues-12dp</link>
      <guid>https://forem.com/sfrunza13/remixing-the-blues-12dp</guid>
      <description>&lt;h2&gt;
  
  
  Starting to contribute
&lt;/h2&gt;

&lt;p&gt;This week on the starchart project we set out what we were going to commit to completing for the 0.1 Milestone. This is now concrete coding work we are talking about, along with continuously reading documentation and now also peer-reviewing PRs and helping one another get setup.&lt;/p&gt;

&lt;p&gt;In the very beginning of the week I had some issues getting the starchart project running on my machine and the team got together on a call after our first scheduled meeting and helped me out. I learned that I had to build before running and that my mysql-data folder had some issues so it had to be deleted and the generated again.&lt;/p&gt;

&lt;p&gt;I had problems again later, eventually after bouncing ideas back and forth with TD on how to solve it it turns out deleting my node modules and re installing worked (just npm installing without deleting did not). Still not sure why but in any case, I was able to work with Star Chart and I got to doing the small part that I had set out to.&lt;/p&gt;

&lt;h2&gt;
  
  
  Initial Auth
&lt;/h2&gt;

&lt;p&gt;The issue I had commited to was to create a login button that would authenticate as the single user that is seeded into the dev database, I then also created a log out button that would destroy the session. &lt;/p&gt;

&lt;p&gt;Initially I had thought that I would have to write the session.server.ts file and make my own createCookieSession methods to work with, docs for which can be found &lt;a href="https://remix.run/docs/en/v1/utils/sessions#using-sessions" rel="noopener noreferrer"&gt;here&lt;/a&gt;. This did not turn out to be the case because apparently the blues stack already has a really great session.server.ts file with some really nice methods such as some require methods that will automatically throw redirects to login routes if conditions aren't met and things of that nature which I made use of. &lt;/p&gt;

&lt;p&gt;There is also a longer example that takes you through the creation of a joke application that has helped me work with remix &lt;a href="https://remix.run/docs/en/v1/tutorials/jokes" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The logic that I use comes from these docs.&lt;/p&gt;

&lt;p&gt;What I did was I added 2 files login.tsx and logout.tsx under the routes folder. The login.tsx has an action that occurs upon the press of the login button that will use the prewritten createUserSession() method with the seeded users username and redirect to the Index page.&lt;/p&gt;

&lt;p&gt;I then edited the index page to include a loader that would require the authenticated user, there was yet again a really helpful pre-written function to use from session.server.ts requireUsername() that checks the request from Loader Arguments for the username and if it does not find it it redirects to login. If it does find it it returns the user's username to the Index component to be able to make use of it when it renders the HTML.&lt;/p&gt;

&lt;p&gt;I then added a button to the Index HTML that would use the action of the new logout route when pressed.&lt;/p&gt;

&lt;p&gt;The logout route has the action I just mentioned which uses yet another pre-written function that is called logout() which destroys the session and it also has a loader just in case someone accidentally navigates to it. The loader simply redirects the client to the base Index route.&lt;/p&gt;

&lt;h2&gt;
  
  
  PRs and Reviews
&lt;/h2&gt;

&lt;p&gt;Here are the 2 PRs that I made this week and the comments and changes associated with them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Seneca-CDOT/starchart/pull/88" rel="noopener noreferrer"&gt;Login and Logout&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/Seneca-CDOT/starchart/pull/124" rel="noopener noreferrer"&gt;Changing User Model after Prisma Schema change&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The second one was a small one to change the user model and seed to match the changes to the Prisma Schema whereby name was split into first and last names.&lt;/p&gt;

&lt;p&gt;I also did a few approvals on other students PRs. I really did not know how to improve them, they seemed good to me and that's what I wrote. I hate to not be able to contribute more but I also hate to see PRs that look really well done sitting there blocked with only one review.&lt;/p&gt;

&lt;p&gt;Thanks for reading. Onto reading more about SAML.&lt;/p&gt;

</description>
      <category>announcement</category>
      <category>devto</category>
      <category>community</category>
      <category>rewards</category>
    </item>
    <item>
      <title>Breaking Telescope</title>
      <dc:creator>sfrunza13</dc:creator>
      <pubDate>Mon, 30 Jan 2023 16:23:47 +0000</pubDate>
      <link>https://forem.com/sfrunza13/breaking-telescope-42k9</link>
      <guid>https://forem.com/sfrunza13/breaking-telescope-42k9</guid>
      <description>&lt;h2&gt;
  
  
  A 400 error
&lt;/h2&gt;

&lt;p&gt;It all starts with an old 400 error that was occurring in Telescope for a while now, first documented &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/3567" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I had found that when we do the SAML sign in flow for authentication we seem to have, on occasion, a blocked session id cookie on the callback when the SAML response returns to us.&lt;/p&gt;

&lt;p&gt;I could not reproduce this in the local setup, so I resolved to push tests for possible fixes to prod and David let me, which I am sure he regrets now.&lt;/p&gt;

&lt;p&gt;This is the starting point for my experimentation and inevitable breaking of Telescope prod.&lt;/p&gt;

&lt;h2&gt;
  
  
  The first idea
&lt;/h2&gt;

&lt;p&gt;This is &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/3789" rel="noopener noreferrer"&gt;my first PR&lt;/a&gt; and it outlines my first ideas. &lt;/p&gt;

&lt;p&gt;Directly from the PR:&lt;/p&gt;

&lt;p&gt;There is a 400 we sometimes get because the cookie that is sent to us with the post binding from Azure AD is sometimes blocked since it is from a different origin/site. Enabling sameSite 'none' should hopefully fix this. By default sameSite is set to 'Lax' which sometimes block incoming cookies from other sites such as the request AD makes to our callback.&lt;/p&gt;

&lt;p&gt;This is all outlined nicely in the following document David found &lt;a href="https://web.dev/samesite-cookie-recipes/#unsafe-requests-across-sites" rel="noopener noreferrer"&gt;https://web.dev/samesite-cookie-recipes/#unsafe-requests-across-sites&lt;/a&gt;. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This pattern is used for sites that may redirect the user out to a remote service to perform some operation before returning, for example redirecting to a third-party identity provider. Before the user leaves the site, a cookie is set containing a single use token with the expectation that this token can be checked on the returning request to mitigate &lt;a href="https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html" rel="noopener noreferrer"&gt;Cross Site Request Forgery (CSRF)&lt;/a&gt; attacks. If that returning request comes via POST then it will be necessary to mark the cookies as &lt;code&gt;SameSite=None; Secure&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This took Telescope from sometimes not working and returning the 400 to ALWAYS not working and returning a 400. Luckily I am not out of ideas, but unfortunately none of them have worked since either...&lt;/p&gt;

&lt;h2&gt;
  
  
  Second idea
&lt;/h2&gt;

&lt;p&gt;My &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/3793" rel="noopener noreferrer"&gt;second PR&lt;/a&gt;. Since in production Telescope express server is behind two proxies in Traefik and nginx I thought maybe using this trust setting with 2 hops would be enough to allow the requests to maintain their cookies even now that they were set as secure and sameSite none. This was not the case.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var app = express()
app.set('trust proxy', 1) // trust first proxy
app.use(session({
  secret: 'keyboard cat',
  resave: false,
  saveUninitialized: true,
  cookie: { secure: true }
}))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  My final ideas
&lt;/h2&gt;

&lt;p&gt;My final ideas before resetting prod that I have not yet tested are to change the origin to be explicit instead of a wildcard *. Because I have read that cors needs to be specified if the cookie is secure. I also want to try setting &lt;code&gt;express.urlencoded({ extended: true })&lt;/code&gt; to false in Satellite src because in all examples I have seen so far they have it set to false which uses a different query string library and the default setting of true has been deprecated as per the &lt;a href="https://github.com/expressjs/body-parser#extended" rel="noopener noreferrer"&gt;docs&lt;/a&gt;. The odds that that could actually be the problem is really low but it's worth a shot.&lt;/p&gt;

&lt;p&gt;Problem now is that the explicit origin is different based on the environment Telescope is run in, and I have to find a way to dynamically change it based on where/how it's being run.&lt;/p&gt;

&lt;p&gt;Hopefully in any case I will be able to finish my testing and have it running at least as well as it was before I messed with it.&lt;/p&gt;

</description>
      <category>crypto</category>
      <category>web3</category>
      <category>blockchain</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
