<?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: xmanhugo</title>
    <description>The latest articles on Forem by xmanhugo (@xmanhugo).</description>
    <link>https://forem.com/xmanhugo</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%2F2550657%2Fa466336f-182d-4b41-9433-bc413d1d5714.png</url>
      <title>Forem: xmanhugo</title>
      <link>https://forem.com/xmanhugo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/xmanhugo"/>
    <language>en</language>
    <item>
      <title>Don’t make security an afterthought when designing APIs</title>
      <dc:creator>xmanhugo</dc:creator>
      <pubDate>Thu, 12 Dec 2024 08:35:35 +0000</pubDate>
      <link>https://forem.com/xmanhugo/dont-make-security-an-afterthought-when-designing-apis-49bi</link>
      <guid>https://forem.com/xmanhugo/dont-make-security-an-afterthought-when-designing-apis-49bi</guid>
      <description>&lt;p&gt;I found this really cool video about API design on YouTube, and it's got over 250,000 views! That's crazy impressive:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=_gQaygjm_hg" rel="noopener noreferrer"&gt;Good APIs Vs Bad APIs: 7 Tips for API Design&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here’s a quick rundown of the key points from the video:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use clear naming.&lt;/li&gt;
&lt;li&gt;Ensure reliability through idempotency.&lt;/li&gt;
&lt;li&gt;Add versioning for backward compatibility.&lt;/li&gt;
&lt;li&gt;Add pagination for response.&lt;/li&gt;
&lt;li&gt;Use clear query strings for sorting.&lt;/li&gt;
&lt;li&gt;Security should not be an afterthought.&lt;/li&gt;
&lt;li&gt;Keep cross-resource references simple.&lt;/li&gt;
&lt;li&gt;Rate limiting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When it comes to considering security in API design, I think that's a really good point.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fd056n2mt2axvnwnfi0dt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fd056n2mt2axvnwnfi0dt.png" alt="section of API Security" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The video was kind of basic, so I pulled together some more details on API security, which includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Authentication and Authorization&lt;/strong&gt;: Implement robust authentication mechanisms like OAuth 2.0 or API keys. Ensure that users and applications have the appropriate permissions through role-based access control (RBAC).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Input Validation&lt;/strong&gt;: Always validate and sanitize inputs to prevent injection attacks (e.g., SQL injection, cross-site scripting). Use libraries and frameworks that provide built-in validation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use HTTPS&lt;/strong&gt;: Ensure all data transmitted between the client and server is encrypted using HTTPS to protect against eavesdropping and man-in-the-middle attacks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rate Limiting&lt;/strong&gt;: Implement rate limiting to prevent abuse or denial-of-service attacks. This controls the number of requests a user can make in a given timeframe.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Sensitivity Classification&lt;/strong&gt;: Identify and classify data handled by the API. Sensitive data should be encrypted at rest, and appropriate measures should be in place to control access.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitoring and Logging&lt;/strong&gt;: Regularly monitor API usage and log all activities. This helps in detecting unusual patterns that may signify a security breach.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error Handling&lt;/strong&gt;: Avoid revealing sensitive information in error messages. Generic error messages can prevent attackers from gaining insight into the system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Versioning and Deprecation&lt;/strong&gt;: Maintain versioning in your APIs, and have a clear deprecation policy. This helps in smoothly transitioning to newer versions that may enhance security.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, when it comes to implementing things, during the API runtime, it might be a good idea to bring in a gateway layer, like Kong, and ensure it’s properly configured. &lt;/p&gt;

&lt;p&gt;Then, in the design and development phase, we can use debugging tools like &lt;a href="https://apidog.com/" rel="noopener noreferrer"&gt;Apidog&lt;/a&gt; to save time and effort, like API keys and OAuth 2.0, which help us quickly set up and troubleshoot:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fmdxlnevj55gi1aj15czb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fmdxlnevj55gi1aj15czb.png" alt="apidog auth feature" width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I’m sure there are lots of details we can still cover. This is just to get the ball rolling, so feel free to share any thoughts you'd like to discuss with me!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>security</category>
      <category>api</category>
    </item>
    <item>
      <title>How to understand the ins and outs of how DNS really works.</title>
      <dc:creator>xmanhugo</dc:creator>
      <pubDate>Thu, 12 Dec 2024 05:51:44 +0000</pubDate>
      <link>https://forem.com/xmanhugo/how-to-understand-the-ins-and-outs-of-how-dns-really-works-2hc0</link>
      <guid>https://forem.com/xmanhugo/how-to-understand-the-ins-and-outs-of-how-dns-really-works-2hc0</guid>
      <description>&lt;p&gt;We're working on a project that needs some teamwork across different teams, and we’ve got to connect to an API. Since the outside team can't just jump in and edit my API definitions, we thought we'd use Apidog's doc publishing feature. I looked through their help docs and found out that the API docs update in real-time and you can even debug right there on the page, and today I realized I can customize the domain name for the published docs, which is an awesome feature for me:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F2rfom3p1t7fwgppc5rvi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F2rfom3p1t7fwgppc5rvi.png" alt="After designing/developing your API in Apidog, you can easily share the API with other colleagues or publish it to the public" width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While we were working on it, one of my teammates asked, “What’s a CNAME?”  I just gave a quick rundown based on what I know. It sparked a great discussion, and it made me want to dig deeper into the whole DNS thing and really get a better grasp on it.&lt;/p&gt;

&lt;p&gt;The way DNS works is often taken for granted. Basically, DNS is used for converting website names into IP addresses, so you can think of it like this: you input a URL, and it spits out an IP.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F9k00hzavjerd3u4j3te8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F9k00hzavjerd3u4j3te8.png" alt="the way how dns works" width="800" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DNS mainly uses &lt;a href="http://www.ietf.org/rfc/rfc1035.txt" rel="noopener noreferrer"&gt;this protocol&lt;/a&gt;, which is based on UDP. Because of this, DNS servers can handle an incredible number of queries per second—much higher than web servers, which rely on TCP. It’s important to know about different types of DNS records, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A records&lt;/strong&gt;: these link a domain name to an IPv4 address.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AAAA records&lt;/strong&gt;: these link a domain name to an IPv6 address.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CNAME records&lt;/strong&gt;: used for forwarding during the query process.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;When you type &lt;strong&gt;&lt;a href="http://www.apidog.com" rel="noopener noreferrer"&gt;&lt;code&gt;www.apidog.com&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt; into your browser, the DNS protocol actually uses &lt;strong&gt;&lt;a href="http://www.apidog.com/" rel="noopener noreferrer"&gt;&lt;code&gt;www.apidog.com&lt;/code&gt;&lt;/a&gt;&lt;code&gt;.&lt;/code&gt;&lt;/strong&gt; It ends with a dot &lt;strong&gt;&lt;code&gt;.&lt;/code&gt;&lt;/strong&gt;, but that’s usually not shown for looks.&lt;/li&gt;
&lt;li&gt;The browser first checks its local cache (like the host file or browser history) to see if it already has a record for that domain. If it does, it uses that.&lt;/li&gt;
&lt;li&gt;If not, the browser sends a DNS request to the ISP’s DNS server, often called &lt;strong&gt;&lt;code&gt;local DNS&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The local DNS checks its own cache. It’s important that the caching time is just right—too long or too short can cause issues. Also, how local DNS queries work is up to the ISP, which can get pretty complicated.&lt;/li&gt;
&lt;li&gt;If local DNS doesn’t have the information cached, it starts scanning the domain name from right to left, asking the proper servers along the way. For &lt;strong&gt;&lt;a href="http://www.apidog.com/" rel="noopener noreferrer"&gt;&lt;code&gt;www.apidog.com&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;, it first checks with the root name server (those rare servers that handle &lt;strong&gt;&lt;code&gt;.&lt;/code&gt;&lt;/strong&gt;). They will tell it who is in charge of &lt;strong&gt;&lt;code&gt;.com&lt;/code&gt;&lt;/strong&gt;, leading the local DNS to look for the server that manages &lt;strong&gt;&lt;code&gt;.com&lt;/code&gt;&lt;/strong&gt; (let’s call that S1) to find out who manages &lt;a href="http://apidog.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;code&gt;apidog.com&lt;/code&gt;&lt;/strong&gt;&lt;/a&gt;. Usually, S1 returns a CNAME record, redirecting the query to the authoritative DNS server.&lt;/li&gt;
&lt;li&gt;The authoritative server looks up its settings to find the server for &lt;strong&gt;&lt;a href="http://www.apidog.com/" rel="noopener noreferrer"&gt;&lt;code&gt;www.apidog.com&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt; and sends back an IP address.&lt;/li&gt;
&lt;li&gt;Local DNS caches that IP address and sends it back to the browser.&lt;/li&gt;
&lt;li&gt;Finally, the browser establishes a TCP connection with that IP address's server and sends an HTTP request.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For anyone who’s bought a domain, you know that if you want to start an AI project and buy the domain &lt;strong&gt;&lt;code&gt;xmanhugo.com&lt;/code&gt;&lt;/strong&gt; from GoDaddy, and then you want to create a subdomain like &lt;strong&gt;&lt;code&gt;ai.xmanhugo.com&lt;/code&gt;&lt;/strong&gt;, you need to set up an A record in GoDaddy’s dashboard to point &lt;strong&gt;&lt;code&gt;ai.xmanhugo.com&lt;/code&gt;&lt;/strong&gt; to a specific IP. Each time you set up a subdomain, you follow this same process. Knowing how DNS resolution works lets you do a few things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Set up a DNS server on D1, making it the authoritative DNS server for &lt;strong&gt;xmanhugo.com&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;In Wanwang’s dashboard, add a new CNAME record to redirect &lt;strong&gt;xmanhugo.com&lt;/strong&gt; queries to D1.&lt;/li&gt;
&lt;li&gt;D1 can return any IP address it chooses.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With this setup, you gain total control since D1 is yours, and you won’t need to access Wanwang’s console anymore. This is what running your own DNS server gets you!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>api</category>
      <category>dns</category>
    </item>
    <item>
      <title>How the STAR Method Can Help You Ace Your Interviews</title>
      <dc:creator>xmanhugo</dc:creator>
      <pubDate>Tue, 10 Dec 2024 08:21:52 +0000</pubDate>
      <link>https://forem.com/xmanhugo/how-the-star-method-can-help-you-ace-your-interviews-553k</link>
      <guid>https://forem.com/xmanhugo/how-the-star-method-can-help-you-ace-your-interviews-553k</guid>
      <description>&lt;p&gt;I've been involved in recruiting for the testing team lately, so I thought I'd share some of my thoughts on interviewing.&lt;/p&gt;

&lt;p&gt;Actually, if you want to find great testers, it’s not enough to just shoot a few technical questions at them, like: “&lt;em&gt;How many testing methods do you know?&lt;/em&gt;” or “&lt;em&gt;Are you familiar with tools like &lt;a href="https://www.postman.com/" rel="noopener noreferrer"&gt;Postman&lt;/a&gt; and &lt;a href="https://apidog.com/" rel="noopener noreferrer"&gt;Apidog&lt;/a&gt;, and what's the difference between them?&lt;/em&gt;” or even, “&lt;em&gt;How do you use &lt;a href="https://apidog.com/" rel="noopener noreferrer"&gt;Apidog&lt;/a&gt; for automated interface testing and organizing test scenarios?&lt;/em&gt;” We’ve got to plan and manage the whole interview process carefully, and that takes some specific skills.&lt;/p&gt;

&lt;p&gt;For managers, putting together a great team takes a lot of work, and picking the right people is the first step. While getting recommendations from within the organization and promoting existing staff are the best ways to find talent, recruitment is still the main way to go. So, knowing how to spot talented individuals during interviews is a super important skill that every manager needs to nail down.&lt;/p&gt;

&lt;p&gt;In my years as a manager, I've interviewed quite a few people. Honestly, interviewing relies quite a bit on luck - it's really difficult to successfully judge whether someone is suitable in just a few dozen minutes, or even just ten-plus minutes. This is especially true for professional technical talent selection, which requires managers themselves to have certain expertise and skills. Even then, there are still elements of "going by feeling" or "trusting your instincts" that involve luck. However, luck has its probabilities, and during interviews, a manager's experience and techniques can greatly improve these probabilities.&lt;/p&gt;

&lt;p&gt;Before, I didn't really have a set approach when it came to interviewing, so I often felt a bit lost. But then I came across this technique called the STAR method, and I've found it to be really effective. A lot of folks might be familiar with the STAR method, and some have even dived deep into it. I had heard about it before as well, but I didn't give it much thought or use it the right way.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;STAR&lt;/strong&gt; method is a key concept in structured interviews, and it stands for &lt;strong&gt;&lt;em&gt;Situation&lt;/em&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;em&gt;Task&lt;/em&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;em&gt;Action&lt;/em&gt;&lt;/strong&gt;, and &lt;strong&gt;&lt;em&gt;Result&lt;/em&gt;&lt;/strong&gt;. The terms are pretty straightforward, but how do we actually put it into practice?&lt;/p&gt;

&lt;p&gt;In the later part of my interviews, I like to ask this question: "&lt;em&gt;Can you tell me about the most memorable project or task you worked on at your last job?&lt;/em&gt;" It's a pretty common open-ended question—not anything fancy—but that doesn't make it any less useful. In fact, the way people with real experience answer this question can be really different from those who don’t.&lt;/p&gt;

&lt;p&gt;Once I ask this question, I pay close attention to how the candidate responds and follow up using the &lt;strong&gt;STAR&lt;/strong&gt; method:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Situation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A memorable project usually has a particular context. If they can clearly explain the background, it shows they were really involved in a genuine project. Some candidates skip the background entirely, so I might ask, “Why was this task important?” If they struggle to lay out the context, it raises doubts about their ability to handle tasks effectively.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Task and Action&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This part is about looking into their work methods and how they tackle problems. Tech folks often mention the technologies they used to solve specific issues. They tend to be pretty direct—this sense of achievement often comes from overcoming challenges. So, digging a little deeper can reveal their passion for technology, which is a crucial factor in hiring.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Result&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At the end of the day, projects and tasks are about results. What did this memorable task actually achieve? It's important to probe this to see if they can deliver. Sometimes, based on your own experience, you can encourage candidates to think wider by asking things like, “&lt;em&gt;How could this have been improved?&lt;/em&gt;” This can help verify their experience and skills even more.&lt;/p&gt;

&lt;p&gt;In short, the &lt;strong&gt;STAR&lt;/strong&gt; method is a fantastic way to conduct interviews. By using it, we can really assess candidates' genuine abilities in terms of specific skills and task performance. I truly believe this approach can greatly boost our chances of hiring the right talent!&lt;/p&gt;

</description>
      <category>leadership</category>
      <category>testing</category>
      <category>webdev</category>
      <category>developers</category>
    </item>
  </channel>
</rss>
