<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="176843" data-post-id="176843">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="dimitarvp" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/120/38664_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  dimitarvp
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I feel we started talking past each other so let’s try and nail some misconceptions about what I said.</p>
<aside class="quote no-group" data-username="thojanssens1" data-post="11" data-topic="31753">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/thojanssens1/48/17642_2.png" class="avatar"> thojanssens1:</div>
<blockquote>
<p>because this code has been tested thoroughly, and reviewed by expert programmers.</p>
</blockquote>
</aside>
<p>Some people were convinced programming was “a solved problem” back in the 1960s. It’s unrealistic to say that nothing major will ever change. Experts, too, make mistakes – all the time.</p>
<aside class="quote no-group" data-username="thojanssens1" data-post="11" data-topic="31753">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/thojanssens1/48/17642_2.png" class="avatar"> thojanssens1:</div>
<blockquote>
<p>And it is also your responsibility to thoroughly understand the code, as it’s part of your application and not a third-party code.</p>
</blockquote>
</aside>
<p>That’s the ideal theory. And it’s a discussion similar to that of FP vs everything else: “Why do you need immutable state? Mutable state is fine, you need to thoroughly understand your application’s state!”. Point is, tooling should reduce the cognitive load on the programmer. We are human and can’t keep everything in our heads. That’s why we have these machines in the first place, no?</p>
<p>Additionally, almost nobody that I’ve ever met in the commercial programming actually understands security (me included). That’s why there are experts that craft those libraries / frameworks for us.</p>
<aside class="quote no-group" data-username="thojanssens1" data-post="11" data-topic="31753">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/thojanssens1/48/17642_2.png" class="avatar"> thojanssens1:</div>
<blockquote>
<p>I’d bet that a bug introduced in the generation tool will be detected much faster</p>
</blockquote>
</aside>
<p>That’s a pretty random assumption.</p>
<aside class="quote no-group" data-username="thojanssens1" data-post="11" data-topic="31753">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/thojanssens1/48/17642_2.png" class="avatar"> thojanssens1:</div>
<blockquote>
<ol>
<li>it will be integrated into Phoenix which has a lot of contributors and top developers are working on it</li>
</ol>
</blockquote>
</aside>
<p>…Which changes nothing, because your generated code resides inside your project and won’t be automatically changed.</p>
<aside class="quote no-group" data-username="thojanssens1" data-post="11" data-topic="31753">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/thojanssens1/48/17642_2.png" class="avatar"> thojanssens1:</div>
<blockquote>
<ol start="2">
<li>every developer using the tool will forcibly have to study the code.</li>
</ol>
</blockquote>
</aside>
<p>Again, an assumption. Many programmers are quite busy and they’ll completely miss that. Most of the commercial programmers have their time mercilessly sliced into sprints and tasks and stories. You think the average project manager will <em>ever</em> tell you “OK, use all of today to upgrade libraries and edit files in our project accordingly so we are on top of our dependencies”?. For 18.5 years of career I’ve met two such people. How many did you meet? Is your current workplace allowing you that?</p>
<aside class="quote no-group" data-username="thojanssens1" data-post="11" data-topic="31753">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/thojanssens1/48/17642_2.png" class="avatar"> thojanssens1:</div>
<blockquote>
<p>but you will hopefully be notified very fast for any bug</p>
</blockquote>
</aside>
<p>“Hopefully” being the key word here. Unless you subscribe to the GitHub releases of a project – which <em>many</em> programmers never do! – then you’ll miss it.</p>
<aside class="quote no-group" data-username="thojanssens1" data-post="11" data-topic="31753">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/thojanssens1/48/17642_2.png" class="avatar"> thojanssens1:</div>
<blockquote>
<p>VS a bug that might go unnoticed for a very, very long time, but with automatic code update.</p>
</blockquote>
</aside>
<p>I do <code>mix deps.update</code> 1-2 times a month exactly for such reasons. People fix bugs in their open-source projects all the time. They also do performance improvements, change code to adhere to best practices (especially in the security area!) etc. It’s very sensible to periodically update your dependencies. Bonus points for reading release notes as well.</p>
<hr>
<p>Just asserting “you have to forcibly study your generated code and manually update it periodically” is not productive. And it’s definitely something that most project managers will frown at. “Wasn’t that thing working? Yeah? Why touch it, we have a backlog of 50 issues back here!”</p>
<p>I feel that having a library that I only update through <code>mix deps.update</code>, recompile, and I am then safe against an obscure credentials hijack exploit is the better option versus updating the library and re-generating the code – which will result in two slightly different generated codes, and you’ll have to go clean after the generator, and you might make a mistake in the process.</p>
<p>Not sure how the latter option sounds more appealing to you, will you explain it to me?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="176843" data-batch-url="/posts/batch_likers">
                        3
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/main-differences-between-pow-and-the-upcoming-phoenix-auth/31753/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-176843" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="176843"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="176846" data-post-id="176846">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="dimitarvp" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/120/38664_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  dimitarvp
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="yurko" data-post="10" data-topic="31753">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/yurko/48/2369_2.png" class="avatar"> yurko:</div>
<blockquote>
<p>I think it’s a very reasonable choice to have auth as part of the framework but as a generator that creates code in your application.</p>
</blockquote>
</aside>
<p>Pow is both. By default it’s a library but if you want to further customise things and make it entirely your own, you can make it generate code inside your project. Being a library plus the ability to opt-in for generated code is IMO superior compared to only having generated code.</p>
<aside class="quote no-group" data-username="yurko" data-post="10" data-topic="31753">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/yurko/48/2369_2.png" class="avatar"> yurko:</div>
<blockquote>
<p>The problem with latter is that sooner or later you will have to go in and extend it and then you will have to deal with all the complexity anyway and since it’s a more general / abstract solution, there will be more complexity to deal with then if you have one specific to your app.</p>
</blockquote>
</aside>
<p>That is 100% correct and is the exact problem with using a library vs. customising generated (or hand-crafted) code, yes. As mentioned above, this also mistakenly evokes the feeling of “magic” which is something I am not happy with. But the trade-offs of the other option seems worse to me.</p>
<aside class="quote no-group" data-username="yurko" data-post="10" data-topic="31753">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/yurko/48/2369_2.png" class="avatar"> yurko:</div>
<blockquote>
<p>If we want to make life easier for users with very standard solutions then we are better off with some ready made CMS for making standard websites</p>
</blockquote>
</aside>
<p>Let’s not go that far. As mentioned in my above reply, I argue that cognitive load should be reduced. I definitely am not arguing for all of us to start using WordPress, no.</p>
<aside class="quote no-group" data-username="yurko" data-post="10" data-topic="31753">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/yurko/48/2369_2.png" class="avatar"> yurko:</div>
<blockquote>
<p>Letting every app do what it wants but giving it a good starting point is the way to go in my opinion.</p>
</blockquote>
</aside>
<p>I am inclined and tempted to agree but you surely remember all the [dumb] security blunders in SSH (Heartbleed) and HTTPS (TLS 1.3) in the last several years, yeah? What guarantee do we have that the current widely accepted approach of doing auth does not have a fatal flaw? What then? We rely on millions of programmers to update their generated code? Very unrealistic. Most projects are governed extremely inefficiently.</p>
<aside class="quote no-group" data-username="yurko" data-post="10" data-topic="31753">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/yurko/48/2369_2.png" class="avatar"> yurko:</div>
<blockquote>
<p>In the end it’s about the kind of users that you wish to serve, I’d argue that Phoenix’ user base will appreciate the generators way.</p>
</blockquote>
</aside>
<p>I appreciate it as well and I am excited to see how it will look in its first release. The point of this thread was to discuss trade-offs. My opinion still is that while generated code is definitely more explicit and gives you a complete control – <strong>which I very much like, mind you!</strong> – it also has the fatal flaw of not giving you a path to [semi-]automatically update the said generated code when the authors find a better way of doing the task you use their generated code for.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="176846" data-batch-url="/posts/batch_likers">
                        4
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/main-differences-between-pow-and-the-upcoming-phoenix-auth/31753/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-176846" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="176846"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="176849" data-post-id="176849">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Exadra37" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Exadra37/120/9183_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Exadra37
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="dimitarvp" data-post="7" data-topic="31753">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/48/38664_2.png" class="avatar"> dimitarvp:</div>
<blockquote>
<p>I imagine the same but I’ve known many people who can’t be trusted with a delicate operation like that. <img src="https://forum.elixirforum.com/images/emoji/apple/confused.png?v=15" title=":confused:" class="emoji" alt=":confused:" loading="lazy" width="20" height="20"> (Not to sound too negative, I also met fantastic individuals like in my last job)</p>
</blockquote>
</aside>
<p>I was used to though the same, but in my research to decide what OAuth2 package I would use in my project I saw that they are not that secure as one would though, thus I am writing my own one. This is sad to conclude, but is what I observed from my bubble.</p>
<p>Developers writing packages based on standards should question what the standard says is optional, and make it required when letting it be optional weakens the security, and I am looking at you <code>state</code> and <code>nonce</code> parameters in OAuth2/OpenIDConnect implementations, that are optional, but should indeed be REQUIRED, because for me security must be opt-out not opt-in.</p>
<p>DISCLAIMER: I work in the security space, thus I am more strict with the security requirements of anything I use.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="176849" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/main-differences-between-pow-and-the-upcoming-phoenix-auth/31753/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-176849" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="176849"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="176856" data-post-id="176856">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="yurko" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/yurko/120/2369_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  yurko
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="dimitarvp" data-post="13" data-topic="31753">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/48/38664_2.png" class="avatar"> dimitarvp:</div>
<blockquote>
<p>What guarantee do we have that the current widely accepted approach of doing auth does not have a fatal flaw? What then? We rely on millions of programmers to update their generated code?</p>
</blockquote>
</aside>
<p>Then we have two options: We have to adjust our app or we have to fix it after update when Phoenix adjusts their part. My point is that the first one is easier <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="176856" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/main-differences-between-pow-and-the-upcoming-phoenix-auth/31753/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-176856" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="176856"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="176860" data-post-id="176860">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="thojanssens1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/thojanssens1/120/17642_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  thojanssens1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>If we mention once the hobbyist, then the junior programmer, then the company in full agile mode with strict deadlines, … there will always be some argument.<br>
The tool is optional. Developers can evaluate the trade-offs according to the environment they work in, the type of programmers they have, the time/money they can invest, their skills,…; trade-offs are obvious, the generated code becomes application code and should then preferably be understood; if one can’t afford it – don’t generate the code.</p>
<p>A reverse-engineering tool for detecting flaws from the once generated code? Nope. Will not happen. As you can change the generated completely to your needs.</p>
<p>Most generated code is trivial MVC stuff. I don’t need to understand how argon2 and :crypto work. That indeed, I leave to security experts. The generated code does not perform low-level security-related operations.</p>
<p>Reasons are too obvious to mention why Jose went for this approach. A developer can evaluate the trade-offs; you consider you prefer to delegate that code to a library, that’s also a choice.<br>
For many (and I believe most), that will be a better trade-off than a lib that affects every layer.</p>
<p>I’m going in circles, so I’m off and leave place for other participants <img src="https://forum.elixirforum.com/images/emoji/apple/sweat_smile.png?v=15" title=":sweat_smile:" class="emoji" alt=":sweat_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="176860" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/main-differences-between-pow-and-the-upcoming-phoenix-auth/31753/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-176860" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="176860"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>