<?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>DEV Community: Niraj Kumar</title>
    <description>The latest articles on DEV Community by Niraj Kumar (@nirajkvinit).</description>
    <link>https://dev.to/nirajkvinit</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%2F20749%2F0b0f98c1-aac4-4b19-8063-cb1cd5086a78.jpeg</url>
      <title>DEV Community: Niraj Kumar</title>
      <link>https://dev.to/nirajkvinit</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nirajkvinit"/>
    <language>en</language>
    <item>
      <title>Application Security Best Practices / Defensive Programming</title>
      <dc:creator>Niraj Kumar</dc:creator>
      <pubDate>Sat, 05 Sep 2020 19:09:34 +0000</pubDate>
      <link>https://dev.to/nirajkvinit/application-security-best-practices-defensive-programming-3o87</link>
      <guid>https://dev.to/nirajkvinit/application-security-best-practices-defensive-programming-3o87</guid>
      <description>&lt;h4&gt;
  
  
  My Other lists
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/nirajkvinit/javascript-node-best-practices-2i4d"&gt;JavaScript/Node Best Practices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/nirajkvinit/software-development-general-best-practices-1747"&gt;Software Development General Best Practices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/nirajkvinit/pr-code-review-best-practices-5363"&gt;PR Code Review Practices&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Application security is a critical topic. Being a good engineer requires being aware of Application security best practices. You should practice defensive programming to ensure a robust, secure application. I have collected points and created this list for my reference. Hope, you too get benefitted out of this. This is a big list, but worth reading to the end.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Always Handle Exceptions&lt;/li&gt;
&lt;li&gt;Validate user input to avoid common vulnerabilities (e.g. XSS, SQL-Injection, Remote Code Execution, etc.)&lt;/li&gt;
&lt;li&gt;Escape HTML, JS and CSS output&lt;/li&gt;
&lt;li&gt;HTML Encode Before Inserting Untrusted Data into HTML Element Content&lt;/li&gt;
&lt;li&gt;JavaScript Encode Before Inserting Untrusted Data into JavaScript Data Values&lt;/li&gt;
&lt;li&gt;URL Encode Before Inserting Untrusted Data into HTML URL Parameter Values&lt;/li&gt;
&lt;li&gt;Implement type conversion with strict exception handling&lt;/li&gt;
&lt;li&gt;Apply minimum and maximum value range check for numerical parameters and dates, minimum, and maximum length check for strings.&lt;/li&gt;
&lt;li&gt;Use an array of allowed values for small sets of string parameters (e.g. days of week).&lt;/li&gt;
&lt;li&gt;Implement CAPTCHA&lt;/li&gt;
&lt;li&gt;Don't use Basic Auth. Use standard authentication instead (e.g. JWT, OAuth)&lt;/li&gt;
&lt;li&gt;Check if all the endpoints are protected behind authentication to avoid broken authentication process&lt;/li&gt;
&lt;li&gt;User own resource ID should be avoided. Use /me/orders instead of /user/654321/orders&lt;/li&gt;
&lt;li&gt;Don't reinvent the wheel in Authentication, token generation, password storage. Use the standards.&lt;/li&gt;
&lt;li&gt;Tokens must be transmitted using the Authorization header on every request&lt;/li&gt;
&lt;li&gt;Authorization Code should be short-lived / Make token expiration (TTL, RTTL) as short as possible&lt;/li&gt;
&lt;li&gt;Don't store sensitive data in the JWT payload, it can be decoded easily&lt;/li&gt;
&lt;li&gt;Use Max Retry and jail features in Login&lt;/li&gt;
&lt;li&gt;Consider using rate-limiting (throttling) to protect your resources from DDoS or brute force attacks&lt;/li&gt;
&lt;li&gt;Code reviewer should always consider security guidelines during code reviews&lt;/li&gt;
&lt;li&gt;Do not forget to turn the DEBUG mode OFF&lt;/li&gt;
&lt;li&gt;Hide error details from clients, wherever applicable respond with generic error messages avoid revealing details of the failure unnecessarily&lt;/li&gt;
&lt;li&gt;Do not pass technical details (e.g. call stacks or other internal hints) to the client&lt;/li&gt;
&lt;li&gt;Never return sensitive data like credentials, Passwords, or security tokens&lt;/li&gt;
&lt;li&gt;Avoid publishing secrets to the npm registry or Code repository&lt;/li&gt;
&lt;li&gt;Inspect for outdated packages&lt;/li&gt;
&lt;li&gt;Use a random complicated key (JWT Secret) to make brute-forcing the token very hard.&lt;/li&gt;
&lt;li&gt;Support blacklisting JWTs or other authentication tokens&lt;/li&gt;
&lt;li&gt;Do not use GET requests for state-changing operations&lt;/li&gt;
&lt;li&gt;Run Node.js as a non-root user&lt;/li&gt;
&lt;li&gt;Limit request payload size using a reverse-proxy or a middleware&lt;/li&gt;
&lt;li&gt;The application must be programmed to defend against attacks from the OWASP TOP 10 (More details below)&lt;/li&gt;
&lt;li&gt;Implement proper and regular security auditing of the application&lt;/li&gt;
&lt;li&gt;Don't auto-increment IDs. Use UUID instead&lt;/li&gt;
&lt;li&gt;Use a CDN for file uploads&lt;/li&gt;
&lt;li&gt;Write audit logs before and after every security-related events&lt;/li&gt;
&lt;li&gt;Consider logging token validation errors in order to detect attacks.&lt;/li&gt;
&lt;li&gt;Take care of log injection attacks by sanitising log data beforehand.&lt;/li&gt;
&lt;li&gt;Use HTTPOnly cookie flag&lt;/li&gt;
&lt;li&gt;OAuth security

&lt;ul&gt;
&lt;li&gt;While using oAuth, Always validate redirect_uri server-side to allow only whitelisted URLs&lt;/li&gt;
&lt;li&gt;Always try to exchange for code and not tokens (don't allow response_type=token)&lt;/li&gt;
&lt;li&gt;Define the default scope, and validate scope parameters for each application&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Reject any non-TLS requests by not responding to any HTTP request to avoid any insecure data exchange. Respond to HTTP requests by 403 Forbidden&lt;/li&gt;
&lt;li&gt;Use HTTPS on server side to avoid MITM (Man in the Middle Attack)&lt;/li&gt;
&lt;li&gt;Setting HTTP headers appropriately can help to lock down and secure your web application. Consider using Helmet library if you are building API on node&lt;/li&gt;
&lt;li&gt;Your API should convert the received data to their canonical form or reject them. Return 400 Bad Request with details about any errors from bad or missing data.&lt;/li&gt;
&lt;li&gt;Use the proper HTTP method according to the operation: GET (read), POST (create), PUT/PATCH (replace/update), and DELETE (to delete a record), and respond with 405 Method Not Allowed if the requested method isn't appropriate for the requested resource&lt;/li&gt;
&lt;li&gt;Don't use any sensitive data (credentials, Passwords, security tokens, or API keys) in the URL, but use standard Authorization header&lt;/li&gt;
&lt;li&gt;All the data exchanged with the REST API must be validated by the API.&lt;/li&gt;
&lt;li&gt;Serialize your JSON (to avoid arbitrary JavaScript remote code execution)&lt;/li&gt;
&lt;li&gt;Validate content-type on request Accept header (Content Negotiation) to allow only your supported format (e.g. application/xml, application/json, etc.) and respond with 406 Not Acceptable response if not matched&lt;/li&gt;
&lt;li&gt;Validate content-type of posted data as you accept (e.g. application/x-www-form-urlencoded, multipart/form-data, application/json, etc.)&lt;/li&gt;
&lt;li&gt;Use an API Gateway service to enable caching, Rate Limit policies (e.g. Quota, Spike Arrest, or Concurrent Rate Limit) and deploy APIs resources dynamically&lt;/li&gt;
&lt;li&gt;If you are dealing with huge amount of data, use Workers and Queues to process as much as possible in background and return response fast to avoid HTTP Blocking&lt;/li&gt;
&lt;li&gt;Audit your application's design, implementation and security with unit/integration tests coverage frequently&lt;/li&gt;
&lt;li&gt;Implement proper access control for resources and its access&lt;/li&gt;
&lt;li&gt;Do not store sensitive information to localStorage&lt;/li&gt;
&lt;li&gt;Measure and guard the memory usage&lt;/li&gt;
&lt;li&gt;Discover errors and downtime using APM products&lt;/li&gt;
&lt;li&gt;Use tools that automatically detect vulnerabilities&lt;/li&gt;
&lt;li&gt;Embrace linter security rules&lt;/li&gt;
&lt;li&gt;Prevent query injection vulnerabilities with ORM/ODM libraries&lt;/li&gt;
&lt;li&gt;Prevent unsafe redirects&lt;/li&gt;
&lt;li&gt;Avoid DOS attacks by explicitly setting when a process should crash&lt;/li&gt;
&lt;li&gt;Protect the input values from being cached by the browser.&lt;/li&gt;
&lt;li&gt;Text areas and input fields for PII (name, email, address, phone number) and login credentials (username, password) should be prevented from being stored in the browser. e.g.  &lt;/li&gt;
&lt;li&gt;Do NOT allow login with sensitive accounts (i.e. accounts that can be used internally within the solution such as to a back-end / middle-ware / DB) to any front-end user-interface&lt;/li&gt;
&lt;li&gt;Implement Proper Password Strength Controls, Include password strength meter to help users create a more complex password and block common and previously breached passwords &lt;/li&gt;
&lt;li&gt;Implement Secure Password Recovery Mechanism&lt;/li&gt;
&lt;li&gt;Store Passwords in a Secure Fashion&lt;/li&gt;
&lt;li&gt;Compare Password Hashes Using Safe Function and in a timely manner&lt;/li&gt;
&lt;li&gt;Transmit Passwords Only Over TLS or Other Strong Transport&lt;/li&gt;
&lt;li&gt;Require Re-authentication for Sensitive Features&lt;/li&gt;
&lt;li&gt;Consider Strong Transaction Authentication and Authorization&lt;/li&gt;
&lt;li&gt;Require JavaScript and Block Headless Browsers&lt;/li&gt;
&lt;li&gt;Notify users about unusual security events&lt;/li&gt;
&lt;li&gt;Regular review of user accounts and their permissions&lt;/li&gt;
&lt;li&gt;Secure File uploads

&lt;ul&gt;
&lt;li&gt;Whitelist allowed extensions. Only allow safe and critical extensions for business functionality&lt;/li&gt;
&lt;li&gt;Ensure that input validation is applied before validating the extensions.&lt;/li&gt;
&lt;li&gt;Validate the file type, don't trust the Content-Type header as it can be spoofed&lt;/li&gt;
&lt;li&gt;Change the filename to something generated by the application&lt;/li&gt;
&lt;li&gt;Set a filename length limit. Restrict the allowed characters if possible&lt;/li&gt;
&lt;li&gt;Set a file size limit&lt;/li&gt;
&lt;li&gt;Only allow authorised users to upload files&lt;/li&gt;
&lt;li&gt;Store the files on a different server. If that's not possible, store them outside of the webroot&lt;/li&gt;
&lt;li&gt;In the case of public access to the files, use a handler that gets mapped to filenames inside the application (someid -&amp;gt; file.ext)&lt;/li&gt;
&lt;li&gt;Run the file through antivirus or a sandbox if available to validate that it doesn't contain malicious data&lt;/li&gt;
&lt;li&gt;Ensure that any libraries used are securely configured and kept up to date&lt;/li&gt;
&lt;li&gt;Protect the file upload from CSRF attacks&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;In the event of authentication exception, Using any of the authentication mechanisms (login, password reset or password recovery), an application must respond with a generic error message regardless of whether:

&lt;ul&gt;
&lt;li&gt;The user ID or password was incorrect.&lt;/li&gt;
&lt;li&gt;The account does not exist.&lt;/li&gt;
&lt;li&gt;The account is locked or disabled.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Implement a mechanism to protect the application against Automated Attacks&lt;/li&gt;
&lt;li&gt;Implement Multi-Factor Authentication for optional but better security where advanced security is required&lt;/li&gt;
&lt;li&gt;Enable logging and monitoring of authentication functions to detect attacks/failures on a real-time basis

&lt;ul&gt;
&lt;li&gt;Ensure that all failures are logged and reviewed&lt;/li&gt;
&lt;li&gt;Ensure that all password failures are logged and reviewed&lt;/li&gt;
&lt;li&gt;Ensure that all account lockouts are logged and reviewed&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Don't rely on client logic for security&lt;/li&gt;
&lt;li&gt;Don't rely on client business logic&lt;/li&gt;
&lt;li&gt;Don't perform encryption in client side code. Use TLS/SSL and encrypt on the server!&lt;/li&gt;
&lt;li&gt;Use CSRF Protection&lt;/li&gt;
&lt;li&gt;Be vigilant about the following:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Injection:&lt;/strong&gt; Almost any source of data can be an injection vector, environment variables, parameters, external and internal web services, and all types of users. Injection flaws occur when an attacker can send hostile data to an interpreter.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Broken Authentication:&lt;/strong&gt; Attackers have access to hundreds of millions of valid username and password combinations for credential stuffing, default administrative account lists, automated brute force, and dictionary attack tools. Session management attacks are well understood, particularly in relation to unexpired session tokens&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sensitive Data Exposure:&lt;/strong&gt; Rather than directly attacking crypto, attackers steal keys, execute man-in-the-middle attacks, or steal clear text data off the server, while in transit, or from the user's client, e.g. browser. A manual attack is generally required. Previously retrieved password databases could be brute-forced by Graphics Processing Units (GPUs). Secure Search Serves, do not log sensitive data&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Broken Access Control:&lt;/strong&gt; Exploitation of access control is a core skill of attackers. Access control is detectable using manual means, or possibly through automation for the absence of access controls in certain frameworks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Misconfiguration:&lt;/strong&gt; Attackers will often attempt to exploit unpatched flaws or access default accounts, unused pages, unprotected files and directories, etc to gain unauthorized access or knowledge of the system&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-Site Scripting (XSS):&lt;/strong&gt; XSS is the second most prevalent issue in the OWASP Top 10, and is found in around two-thirds of all applications&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Insecure Deserialization:&lt;/strong&gt; Exploitation of deserialization is somewhat difficult, as off-the-shelf exploits rarely work without changes or tweaks to the underlying exploit code.
Using Components with Known Vulnerabilities: While it is easy to find already-written exploits for many known vulnerabilities, other vulnerabilities require concentrated effort to develop a custom exploit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Insufficient Logging &amp;amp; Monitoring:&lt;/strong&gt; Exploitation of insufficient logging and monitoring is the bedrock of nearly every major incident. Attackers rely on the lack of monitoring and timely response to achieve their goals without being detected&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Forgot Password Service Guidelines

&lt;ul&gt;
&lt;li&gt;Return a consistent message for both existent and non-existent accounts.&lt;/li&gt;
&lt;li&gt;Ensure that the time taken for the user response message is uniform.&lt;/li&gt;
&lt;li&gt;Use a side-channel to communicate the method to reset their password.&lt;/li&gt;
&lt;li&gt;Use URL tokens for the simplest and fastest implementation.&lt;/li&gt;
&lt;li&gt;Ensure that generated tokens or codes are:

&lt;ul&gt;
&lt;li&gt;Randomly generated using a cryptographically safe algorithm.&lt;/li&gt;
&lt;li&gt;Sufficiently long to protect against brute-force attacks.
Stored securely.&lt;/li&gt;
&lt;li&gt;Single-use and expire after an appropriate period&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Secure Management endpoints 

&lt;ul&gt;
&lt;li&gt;Avoid exposing management endpoints via the Internet.&lt;/li&gt;
&lt;li&gt;If management endpoints must be accessible via the Internet, make sure that users must use a strong authentication mechanism, e.g. multi-factor.&lt;/li&gt;
&lt;li&gt;Expose management endpoints via different HTTP ports or hosts preferably on a different NIC and restricted subnet.&lt;/li&gt;
&lt;li&gt;Restrict access to these endpoints by firewall rules or use of access control lists.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Where possible, always log:

&lt;ul&gt;
&lt;li&gt;Input validation failures e.g. protocol violations, unacceptable encodings, invalid parameter names and values&lt;/li&gt;
&lt;li&gt;Output validation failures e.g. database recordset mismatch, invalid data encoding&lt;/li&gt;
&lt;li&gt;Authentication successes and failures&lt;/li&gt;
&lt;li&gt;Authorization (access control) failures&lt;/li&gt;
&lt;li&gt;Session management failures e.g. cookie session identification value modification&lt;/li&gt;
&lt;li&gt;Application errors and system events e.g. syntax and runtime errors, connectivity problems, performance issues, third party service error messages, file system errors, file upload virus detection, configuration changes&lt;/li&gt;
&lt;li&gt;Application and related systems start-ups and shut-downs, and logging initialization (starting, stopping or pausing)&lt;/li&gt;
&lt;li&gt;Use of higher-risk functionality e.g. network connections, addition or deletion of users, changes to privileges, assigning users to tokens, adding or deleting tokens, use of systems administrative privileges, access by application administrators,all actions by users with administrative privileges, access to payment cardholder data, use of data encrypting keys, key changes, creation and deletion of system-level objects, data import and export including screen-based reports, submission of user-generated content especially file uploads&lt;/li&gt;
&lt;li&gt;Legal and other opt-ins e.g. permissions for mobile phone capabilities, terms of use, terms &amp;amp; conditions, personal data usage consent, permission to receive marketing communications&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;In order to secure authorization-based transaction in such a system:

&lt;ul&gt;
&lt;li&gt;Authorization should be performed and enforced server-side&lt;/li&gt;
&lt;li&gt;Transaction verification data should be generated server-side&lt;/li&gt;
&lt;li&gt;Application should prevent authorization credentials brute-forcing&lt;/li&gt;
&lt;li&gt;Transaction data should be protected against modification&lt;/li&gt;
&lt;li&gt;Confidentiality of the transaction data should be protected during any client / server communications&lt;/li&gt;
&lt;li&gt;When a transaction is executed, the system should check whether it was authorized&lt;/li&gt;
&lt;li&gt;Authorization credentials should be valid only by a limited period of time&lt;/li&gt;
&lt;li&gt;Authorization credentials should be unique for every operation&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Protect Personally Identifiable Information (PII Data)

&lt;ul&gt;
&lt;li&gt;Personally identifiable information (PII) is any data that can be used to identify a specific individual&lt;/li&gt;
&lt;li&gt;Protect Personally Identifiable Information in the Applications by encrypting them&lt;/li&gt;
&lt;li&gt;Follow the data privacy laws of the land&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Some Important OWASP Guidelines
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;OWASP A2: Broken Authentication&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Require MFA/2FA for important services and accounts&lt;/li&gt;
&lt;li&gt;Rotate passwords and access keys frequently, including SSH keys&lt;/li&gt;
&lt;li&gt;Apply strong password policies, both for ops and in-application user management (link OWASP password recommendation)&lt;/li&gt;
&lt;li&gt;Do not ship or deploy your application with any default credentials, particularly for admin users or external services you depend on&lt;/li&gt;
&lt;li&gt;Use only standard authentication methods like OAuth, OpenID, etc.  avoid basic authentication&lt;/li&gt;
&lt;li&gt;Auth rate-limiting: Disallow more than X login attempts (including password recovery, etc.) in a period of Y&lt;/li&gt;
&lt;li&gt;On login failure, don't let the user know whether the username or password verification failed, just return a common-auth error&lt;/li&gt;
&lt;li&gt;Consider using a centralized user management system to avoid managing multiple accounts per employee (e.g. GitHub, AWS, Jenkins, etc) and to benefit from a battle-tested user management system&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OWASP A3: Sensitive Data Exposure&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Only accept SSL/TLS connections, enforce Strict-Transport-Security using headers&lt;/li&gt;
&lt;li&gt;Separate the network into segments (i.e. subnets) and ensure each node has the least necessary networking access permissions&lt;/li&gt;
&lt;li&gt;Group all services/instances that need no internet access and explicitly disallow any outgoing connection (a.k.a private subnet)&lt;/li&gt;
&lt;li&gt;Store all secrets in vault products like AWS KMS, HashiCorp Vault or Google Cloud KMS&lt;/li&gt;
&lt;li&gt;Lockdown sensitive instance metadata using metadata&lt;/li&gt;
&lt;li&gt;Encrypt data in transit when it leaves a physical boundary&lt;/li&gt;
&lt;li&gt;Don't include secrets in log statements&lt;/li&gt;
&lt;li&gt;Avoid showing plain passwords in the frontend, take necessary measures in the backend and never store sensitive information in plaintext&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OWASP A5:  Broken access control&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Respect the principle of least privilege  -  every component and DevOps person should only have access to the necessary information and resources&lt;/li&gt;
&lt;li&gt;Never work with the console/root (full-privilege) account except for account management&lt;/li&gt;
&lt;li&gt;Run all instances/containers on behalf of a role/service account&lt;/li&gt;
&lt;li&gt;Assign permissions to groups and not to users. This should make permission management easier and more transparent for most cases&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OWASP A6: Security Misconfiguration&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Access to production environment internals is done through the internal network only, use SSH or other ways, but never expose internal services&lt;/li&gt;
&lt;li&gt;Restrict internal network access  - explicitly set which resource can access other resources (e.g. network policy or subnets)&lt;/li&gt;
&lt;li&gt;If using cookies, configure it to "secured" mode where it's being sent over SSL only&lt;/li&gt;
&lt;li&gt;If using cookies, configure it for "same-site" only so only requests from same domain will get back the designated cookies&lt;/li&gt;
&lt;li&gt;If using cookies, prefer "HttpOnly" configuration that prevents client-side JavaScript code from accessing the cookies&lt;/li&gt;
&lt;li&gt;Protect each VPC with strict and restrictive access rules&lt;/li&gt;
&lt;li&gt;Prioritize threats using any standard security threat modelling like STRIDE or DREAD&lt;/li&gt;
&lt;li&gt;Protect against DDoS attacks using HTTP(S) and TCP load balancers&lt;/li&gt;
&lt;li&gt;Perform periodic penetration tests by specialized agencies&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OWASP A7: Cross-Site-Scripting (XSS)&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Use templating engines or frameworks that automatically escape XSS by design, such as EJS, Pug, React, or Angular.  -  - Learn the limitations of each mechanisms XSS protection and appropriately handle the use cases which are not covered&lt;/li&gt;
&lt;li&gt;Escaping untrusted HTTP request data based on the context in the HTML output (body, attribute, JavaScript, CSS, or URL) will resolve Reflected and Stored XSS vulnerabilities&lt;/li&gt;
&lt;li&gt;Applying context-sensitive encoding when modifying the browser document on the client-side acts against DOM XSS&lt;/li&gt;
&lt;li&gt;Enabling a Content-Security Policy (CSP) as a defence-in-depth mitigating control against XSS&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OWASP A9: Using Components With Known Security Vulnerabilities&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Scan docker images for known vulnerabilities (using Docker's and other vendors' scanning services)&lt;/li&gt;
&lt;li&gt;Enable automatic instance (machine) patching and upgrades to avoid running old OS versions that lack security patches&lt;/li&gt;
&lt;li&gt;Provide the user with both 'id', 'access' and 'refresh' token so the access token is short-lived and renewed with the refresh token&lt;/li&gt;
&lt;li&gt;Log and audit each API call to cloud and management services (e.g who deleted the S3 bucket?) using services like AWS CloudTrail&lt;/li&gt;
&lt;li&gt;Run the security checker of your cloud provider (e.g. AWS security trust advisor)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OWASP A10: Insufficient Logging &amp;amp; Monitoring&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Alert on remarkable or suspicious auditing events like user login, new user creation, permission change, etc&lt;/li&gt;
&lt;li&gt;Alert on irregular amount of login failures (or equivalent actions like forgot password)&lt;/li&gt;
&lt;li&gt;Include the time and username that initiated the update in each DB record&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; If you want to update this list, please comment, I'll incorporate your changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ref.&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://github.com/shieldfy/API-Security-Checklist"&gt;https://github.com/shieldfy/API-Security-Checklist&lt;/a&gt;&lt;br&gt;
&lt;a href="https://owasp.org/www-project-automated-threats-to-web-applications/"&gt;https://owasp.org/www-project-automated-threats-to-web-applications/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/OWASP/CheatSheetSeries"&gt;https://github.com/OWASP/CheatSheetSeries&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Authentication_Cheat_Sheet.md"&gt;https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Authentication_Cheat_Sheet.md&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Abuse_Case_Cheat_Sheet.md"&gt;https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Abuse_Case_Cheat_Sheet.md&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.md"&gt;https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.md&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Input_Validation_Cheat_Sheet.md"&gt;https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Input_Validation_Cheat_Sheet.md&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/REST_Security_Cheat_Sheet.md"&gt;https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/REST_Security_Cheat_Sheet.md&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Logging_Cheat_Sheet.md"&gt;https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Logging_Cheat_Sheet.md&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Transaction_Authorization_Cheat_Sheet.md"&gt;https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Transaction_Authorization_Cheat_Sheet.md&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/goldbergyoni/nodebestpractices/blob/master/sections/security/commonsecuritybestpractices.md"&gt;https://github.com/goldbergyoni/nodebestpractices/blob/master/sections/security/commonsecuritybestpractices.md&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Nodejs_Security_Cheat_Sheet.md"&gt;https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Nodejs_Security_Cheat_Sheet.md&lt;/a&gt;&lt;/p&gt;

</description>
      <category>defensiveprogramming</category>
      <category>applicationsecurity</category>
      <category>bestpractices</category>
      <category>securitybestpractices</category>
    </item>
    <item>
      <title>PR/Code Review Best Practices</title>
      <dc:creator>Niraj Kumar</dc:creator>
      <pubDate>Sat, 05 Sep 2020 17:30:14 +0000</pubDate>
      <link>https://dev.to/nirajkvinit/pr-code-review-best-practices-5363</link>
      <guid>https://dev.to/nirajkvinit/pr-code-review-best-practices-5363</guid>
      <description>&lt;h4&gt;
  
  
  My Other lists
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/nirajkvinit/javascript-node-best-practices-2i4d"&gt;JavaScript/Node Best Practices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/nirajkvinit/software-development-general-best-practices-1747"&gt;Software Development General Best Practices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/nirajkvinit/application-security-best-practices-defensive-programming-3o87"&gt;Defensive Programming / Application Security Best Practices&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;I have collected some points and created this list for PR and Code reviews. I intend to refer to this post frequently to help me become a better reviewer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Organization&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Organizations with good code reviews ensure that all engineers take part in the code review process&lt;/li&gt;
&lt;li&gt;Good code reviews use the same quality bar and approach for everyone, regardless of their job title, level, or when they joined the company.&lt;/li&gt;
&lt;li&gt;Better code reviews pay additional attention to making the first few reviews for new joiners a great experience. Reviewers are empathetic to the fact that the recent joiner might not be aware of all the coding guidelines and might be unfamiliar with parts of the code. Provide relevant documentation (guidelines, style guides, etc) to help engineer improve their code.&lt;/li&gt;
&lt;li&gt;Ensure no code makes it to production without a code review&lt;/li&gt;
&lt;li&gt;PR and reviews should be time-bound. Ensure that PRs get reviewed, approved/rejected within a scrum cycle to avoid stale code&lt;/li&gt;
&lt;li&gt;Foster a good code review culture in which finding defects is viewed positively, Give respectful and constructive feedback&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Reviewers&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Prioritize Review Over Coding&lt;/li&gt;
&lt;li&gt;Integrate code review into your daily routine&lt;/li&gt;
&lt;li&gt;Review at least part of the code, even if you can't do all of it&lt;/li&gt;
&lt;li&gt;Review fewer than 400 lines of code at a time&lt;/li&gt;
&lt;li&gt;Take your time while reviewing someone else's code, do not depend on others to catch errors&lt;/li&gt;
&lt;li&gt;Do not bunch PRs for review. Instead, scatter reviews tasks throughout the working hours&lt;/li&gt;
&lt;li&gt;Ensure the PRs comes with tests&lt;/li&gt;
&lt;li&gt;Build and Test — Before Code Review&lt;/li&gt;
&lt;li&gt;Ensure external documents if any (API, user manual, etc.) are updated&lt;/li&gt;
&lt;li&gt;Give Feedback That Helps (Not Hurts)&lt;/li&gt;
&lt;li&gt;Create and follow a code-review checklist. &lt;/li&gt;
&lt;li&gt;While reviewing code, be mindful about the following:

&lt;ul&gt;
&lt;li&gt;Security best practices&lt;/li&gt;
&lt;li&gt;Manageability (Readability, structure, style) &lt;/li&gt;
&lt;li&gt;Architecture&lt;/li&gt;
&lt;li&gt;Maintainability (Logic, Test Coverage)&lt;/li&gt;
&lt;li&gt;Correctness (Functionality)&lt;/li&gt;
&lt;li&gt;Invalid input/states&lt;/li&gt;
&lt;li&gt;Usability (Performance)&lt;/li&gt;
&lt;li&gt;Reusability&lt;/li&gt;
&lt;li&gt;Object-Oriented Analysis and Design (OOAD) Principles&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Verify that the defects if any -are actually fixed&lt;/li&gt;
&lt;li&gt;PR Rejections must always include a better explanation for why the PR got rejected&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Author/Reviewee&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;There are various git workflow, get yourself acquainted with different git workflows: &lt;a href="https://www.atlassian.com/git/tutorials/comparing-workflows"&gt;https://www.atlassian.com/git/tutorials/comparing-workflows&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;You should annotate PRs with self-explaining comments before the review&lt;/li&gt;
&lt;li&gt;Create Small Change Lists, Change Lists Should Be Complete on Their Own&lt;/li&gt;
&lt;li&gt;Never self-approve a PR, always ask your peers for approval after code review&lt;/li&gt;
&lt;li&gt;Before opening a PR, make sure you squash all your commits into one single commit using git rebase (squash). Instead of having 50 commits that describe 1 feature implementation, there must be one commit that describes everything that has been done so far.&lt;/li&gt;
&lt;li&gt;Prior to making PRs always check to see you have merged the most updated code from the master branch.
Update all affected tests and or create new tests for files you changed.&lt;/li&gt;
&lt;li&gt;Do not push any code with runtime errors thrown by dependencies or source code. When one appears, you should fix that bug ASAP—even if everything else seems to be running ok. There’s a reason that error was thrown, so fix it and don’t leave it for someone else to worry about it.&lt;/li&gt;
&lt;li&gt;Remove all unnecessary console logs prior to making a PR&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;PR Checklist&lt;/strong&gt;&lt;br&gt;
☐ Unit Test provided&lt;br&gt;
☐ Deprecated code removed&lt;br&gt;
☐ Syntax &amp;amp; Formatting is correct (Linting should help with this)&lt;br&gt;
☐ Is the approach to the problem appropriate?&lt;br&gt;
☐ Can anything be simplified?&lt;br&gt;
☐ Is the code too specific to the product and needs generalization?&lt;br&gt;
☐ Do forms need to sanitized&lt;br&gt;
☐ Any obvious security flaws or potential holes&lt;br&gt;
☐ Are the naming conventions appropriate?&lt;br&gt;
☐ Are there enough comments inline with the code?&lt;br&gt;
☐ Is there documentation needed?&lt;br&gt;
☐ Is there anything included that should not be?&lt;br&gt;
☐ Are all dependencies declared?&lt;br&gt;
☐ Are there any code smells? &lt;a href="https://blog.codinghorror.com/code-smells/"&gt;https://blog.codinghorror.com/code-smells/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: If you want to update this list, please comment, I'll incorporate your changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ref.&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://www.ibm.com/developerworks/rational/library/11-proven-practices-for-peer-review/index.html"&gt;https://www.ibm.com/developerworks/rational/library/11-proven-practices-for-peer-review/index.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.michaelagreiler.com/code-review-best-practices/"&gt;https://www.michaelagreiler.com/code-review-best-practices/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://ardalis.com/github-pull-request-checklist/"&gt;https://ardalis.com/github-pull-request-checklist/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://gist.github.com/sherakama/0ba17601381e3adbe0cad566ad4d80a5"&gt;https://gist.github.com/sherakama/0ba17601381e3adbe0cad566ad4d80a5&lt;/a&gt;&lt;/p&gt;

</description>
      <category>pullrequest</category>
      <category>bestpractices</category>
      <category>peerreview</category>
      <category>codereview</category>
    </item>
    <item>
      <title>JavaScript/Node Best Practices</title>
      <dc:creator>Niraj Kumar</dc:creator>
      <pubDate>Sat, 05 Sep 2020 15:56:13 +0000</pubDate>
      <link>https://dev.to/nirajkvinit/javascript-node-best-practices-2i4d</link>
      <guid>https://dev.to/nirajkvinit/javascript-node-best-practices-2i4d</guid>
      <description>&lt;h4&gt;
  
  
  My Other lists
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/nirajkvinit/software-development-general-best-practices-1747"&gt;Software Development General Best Practices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/nirajkvinit/pr-code-review-best-practices-5363"&gt;PR Code Review Practices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/nirajkvinit/application-security-best-practices-defensive-programming-3o87"&gt;Defensive Programming / Application Security Best Practices&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;I usually follow &lt;a href="https://github.com/airbnb/javascript"&gt;Airbnb's JavaScript Style Guide&lt;/a&gt;, still, I intend to keep this list as reference. Most of these rules will be enforced automatically if you integrate ESLint in your project.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Always use 'use strict' if you are still using es5&lt;/li&gt;
&lt;li&gt;Don't use global variables&lt;/li&gt;
&lt;li&gt;Always Prefer const over let. Ditch the var&lt;/li&gt;
&lt;li&gt;Prefer writing pure functions over stateful functions which mutate data or produce side effects&lt;/li&gt;
&lt;li&gt;Learn and use functional composition&lt;/li&gt;
&lt;li&gt;Favor functional programming over imperative programming&lt;/li&gt;
&lt;li&gt;Use method chaining&lt;/li&gt;
&lt;li&gt;Prefer composition over inheritance&lt;/li&gt;
&lt;li&gt;Use linters to ensure your code is consistent.&lt;/li&gt;
&lt;li&gt;Use Airbnb JavaScript Style Guide for JavaScript (&lt;a href="https://github.com/airbnb/javascript"&gt;https://github.com/airbnb/javascript&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Avoid client-side console logs in production&lt;/li&gt;
&lt;li&gt;Prefer '===' over '=='&lt;/li&gt;
&lt;li&gt;Use default arguments instead of short-circuiting or conditionals&lt;/li&gt;
&lt;li&gt;Function arguments (2 or fewer ideally)&lt;/li&gt;
&lt;li&gt;Encapsulate conditionals in a separate function if possible&lt;/li&gt;
&lt;li&gt;Avoid negative conditionals&lt;/li&gt;
&lt;li&gt;Learn and practice implementation of SOLID Patterns&lt;/li&gt;
&lt;li&gt;Use Promises, not callbacks&lt;/li&gt;
&lt;li&gt;Async/Await is even cleaner than Promises, use it more&lt;/li&gt;
&lt;li&gt;Use try/catch with async/await&lt;/li&gt;
&lt;li&gt;Use Async-Await or promises for async error handling&lt;/li&gt;
&lt;li&gt;Don't ignore rejected promises, log it to external logging service&lt;/li&gt;
&lt;li&gt;Never use eval&lt;/li&gt;
&lt;li&gt;Structure your solution by components&lt;/li&gt;
&lt;li&gt;Wrap common utilities as npm packages&lt;/li&gt;
&lt;li&gt;Separate Express 'app' and 'server'&lt;/li&gt;
&lt;li&gt;Use environment aware, secure and hierarchical config&lt;/li&gt;
&lt;li&gt;Distinguish operational vs programmer errors&lt;/li&gt;
&lt;li&gt;Use only the built-in Error object&lt;/li&gt;
&lt;li&gt;Handle errors centrally, not within a middleware &lt;/li&gt;
&lt;li&gt;Exit the process gracefully when an unknown fatal error occurs&lt;/li&gt;
&lt;li&gt;Use a mature logger to increase error visibility&lt;/li&gt;
&lt;li&gt;Discover errors and downtime using APM products (sentry.io)&lt;/li&gt;
&lt;li&gt;Catch unhandled promise rejections&lt;/li&gt;
&lt;li&gt;Fail fast, validate arguments using a dedicated library&lt;/li&gt;
&lt;li&gt;Use ESLint&lt;/li&gt;
&lt;li&gt;Separate your statements properly&lt;/li&gt;
&lt;li&gt;Prefer named function over anonymous. Name all functions, including closures and callbacks. Avoid anonymous functions, as it helps in profiling&lt;/li&gt;
&lt;li&gt;Require modules by folders, opposed to the files directly&lt;/li&gt;
&lt;li&gt;Require modules at the beginning of each file, before and outside of any functions&lt;/li&gt;
&lt;li&gt;Detect code issues with a linter&lt;/li&gt;
&lt;li&gt;Refactor regularly using static analysis tools&lt;/li&gt;
&lt;li&gt;Avoid using the Node.js crypto library for handling passwords, use Bcrypt&lt;/li&gt;
&lt;li&gt;Prevent evil RegEx from overloading your single thread execution&lt;/li&gt;
&lt;li&gt;Don't block the event loop&lt;/li&gt;
&lt;li&gt;Bootstrap using 'node' command, avoid npm start (In container environment)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;NOTE: If you want to update this list, please comment, I'll incorporate your changes.&lt;/p&gt;

&lt;p&gt;Ref.&lt;br&gt;
&lt;a href="https://github.com/goldbergyoni/javascript-testing-best-practices"&gt;https://github.com/goldbergyoni/javascript-testing-best-practices&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/ryanmcdermott/clean-code-javascript"&gt;https://github.com/ryanmcdermott/clean-code-javascript&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/goldbergyoni/nodebestpractices"&gt;https://github.com/goldbergyoni/nodebestpractices&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/RisingStack/node-style-guide"&gt;https://github.com/RisingStack/node-style-guide&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/DrkSephy/es6-cheatsheet"&gt;https://github.com/DrkSephy/es6-cheatsheet&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>bestpractices</category>
      <category>guidelines</category>
      <category>node</category>
    </item>
    <item>
      <title>Software Development Best Practices</title>
      <dc:creator>Niraj Kumar</dc:creator>
      <pubDate>Sat, 05 Sep 2020 15:28:00 +0000</pubDate>
      <link>https://dev.to/nirajkvinit/software-development-general-best-practices-1747</link>
      <guid>https://dev.to/nirajkvinit/software-development-general-best-practices-1747</guid>
      <description>&lt;h4&gt;
  
  
  My Other lists
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/nirajkvinit/javascript-node-best-practices-2i4d"&gt;JavaScript/Node Best Practices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/nirajkvinit/pr-code-review-best-practices-5363"&gt;PR Code Review Practices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/nirajkvinit/application-security-best-practices-defensive-programming-3o87"&gt;Defensive Programming / Application Security Best Practices&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;I had collected some points and created a list of some best practices for software development. I plan to refer to this list from time to time to help me become a better Engineer. Publishing the list so that others too may refer and get benefitted from this list. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Learn &amp;amp; practice Design Patterns&lt;/li&gt;
&lt;li&gt;Practice KISS (Keep It Simple Stupid), DRY (Don't Repeat Yourself) design principles&lt;/li&gt;
&lt;li&gt;Practice Occam's Razor problem-solving principles; Occam's razor simply states that of any given set of explanations for an event occurring, the simplest one is most likely the correct one&lt;/li&gt;
&lt;li&gt;Always ask questions when in doubt. Do not assume anything, be explicit over being implicit.&lt;/li&gt;
&lt;li&gt;Remember, Explicit is better than implicit&lt;/li&gt;
&lt;li&gt;Don't be afraid to experiment, or to commit mistakes, however, you must learn from your mistakes quickly and ensure the same mistake does not happen again. Write test cases to protect yourself from common mistakes.&lt;/li&gt;
&lt;li&gt;Test everything (Only your code, not other people's code which you are referring, like external libraries)&lt;/li&gt;
&lt;li&gt;Keep learning, keep reading latest articles, books, watch tutorials, attend workshops, discuss with experts to update your knowledge and skillsets&lt;/li&gt;
&lt;li&gt;Keep practising Algorithms and Puzzles solving to improve your problems solving skills&lt;/li&gt;
&lt;li&gt;Document everything and don't forget to update those documents when information or relevant facts change&lt;/li&gt;
&lt;li&gt;Never ignore errors or exceptions. Always log your errors with full details sans sensitive information&lt;/li&gt;
&lt;li&gt;Log everything and store the logs a remote location for thorough analysis and for historical reference (Loggly/ELK Stack)&lt;/li&gt;
&lt;li&gt;Assign a transaction id to each log statement&lt;/li&gt;
&lt;li&gt;Increase transparency using smart logging&lt;/li&gt;
&lt;li&gt;Continuously analyze Performance of your code and your application&lt;/li&gt;
&lt;li&gt;Document your technical debts, and clear those debts as soon as the opportunity arrives&lt;/li&gt;
&lt;li&gt;Mark unfinished/incomplete part of the code, //TODO: (Technical Debt)&lt;/li&gt;
&lt;li&gt;Better yet, create a fresh ticket for these //TODO&lt;/li&gt;
&lt;li&gt;Document your application's API by using Swagger&lt;/li&gt;
&lt;li&gt;Periodically perform Security Audit of code/project (Very important)&lt;/li&gt;
&lt;li&gt;Always perform even-sided validation Client and Server-side validation both&lt;/li&gt;
&lt;li&gt;Comment code to explain intent, use doc comment to document the summary functionality of functions&lt;/li&gt;
&lt;li&gt;Keep comments relevant as your code evolves&lt;/li&gt;
&lt;li&gt;Don't use comments as an excuse for bad code. Keep your code clean&lt;/li&gt;
&lt;li&gt;Don't use clean code as an excuse to not comment at all&lt;/li&gt;
&lt;li&gt;Everyone in a team should use the same code formatting strategy (Same prettier configuration everywhere)&lt;/li&gt;
&lt;li&gt;Always pull/update before commit/push&lt;/li&gt;
&lt;li&gt;Put some extra effort to write a good commit message. You should describe your work briefly in the commit message. First line should be the work summary. Separate the subject from the body with a newline&lt;/li&gt;
&lt;li&gt;Within your PR comment write a brief overview of the functionality of your code, or why you did it the way you did it, if possible, write assumptions as well if there are any&lt;/li&gt;
&lt;li&gt;Update your Jira/Github Issue task item with actions/user stories, and development checklist&lt;/li&gt;
&lt;li&gt;Always make time to review other's code. Add constructive, helpful comments or solutions instead of just pointing out errors or mistakes. Code reading/reviewing improves your thought process and overall understanding of the project&lt;/li&gt;
&lt;li&gt;Always constructively criticize someone else's code if they ignore any coding best practices. Point out the specific "guideline" that is not being followed&lt;/li&gt;
&lt;li&gt;Always calculate estimates for tasks, add a 20% buffer to the estimate. Try to complete the task within the given estimated time. However, refrain from overestimating, and adjust your estimating strategies continuously to become adept at estimation.&lt;/li&gt;
&lt;li&gt;Always challenge yourself, keep updating your estimates, if your success rate is below 70%.&lt;/li&gt;
&lt;li&gt;Always tackle the hardest tasks first. Solve the most complicated problems first before solving easy tasks. However, you can always use opportunities as and when it arrives to pick low hanging fruits.&lt;/li&gt;
&lt;li&gt;Don't write code that you think you might need in future, but don't need yet&lt;/li&gt;
&lt;li&gt;Always remove unnecessary code, keep cleaning dead codes&lt;/li&gt;
&lt;li&gt;Fail fast and fail early. Check input and fail on nonsensical input or invalid state as early as possible, preferably with an exception or error response&lt;/li&gt;
&lt;li&gt;When in doubt, throw exceptions&lt;/li&gt;
&lt;li&gt;Write your code defensively. Always think about what can go wrong, what will happen on invalid input, and what might fail, which will help you catch many bugs before they happen&lt;/li&gt;
&lt;li&gt;If a function or method goes past 30 lines of code, consider breaking it up. The good maximum module size is about 500 lines. Test files tend to be longer than this&lt;/li&gt;
&lt;li&gt;Refactor whenever you see the need and have the opportunity to do so&lt;/li&gt;
&lt;li&gt;Make code correct first and fast second. Make sure your code is working as expected and tests are green; in the refactoring phase, you may optimize your code. When working on performance issues, always profile before making fixes&lt;/li&gt;
&lt;li&gt;Use meaningful and pronounceable variable names (Especially as Parameters)&lt;/li&gt;
&lt;li&gt;Functions should do one thing and one thing only. Practice Single Responsibility Principle&lt;/li&gt;
&lt;li&gt;Function names should say what they do&lt;/li&gt;
&lt;li&gt;Always Unit Test your Code (even for simple/quick fixes and one-liners)&lt;/li&gt;
&lt;li&gt;Writing code is easy, but reading it is hard, sometimes incomprehensible. So, write code as if you are writing poetry, your code should be easy to read&lt;/li&gt;
&lt;li&gt;Still, don't be too verbose in your coding. Remember, compact but comprehensive coding gives less surface area for bugs to hide in&lt;/li&gt;
&lt;li&gt;if you are using some reference code picked from some article or StackOverflow, always include the link beside the referenced code as a comment, so that reviewers can visit the link to understand why you did what you did&lt;/li&gt;
&lt;li&gt;Organize your files around product features/pages/components, not roles. Also, place your test files next to their implementation.&lt;/li&gt;
&lt;li&gt;Design a rollback solution for deployments&lt;/li&gt;
&lt;li&gt;Don't over-optimize your code, keep it open for extension&lt;/li&gt;
&lt;li&gt;Be stateless, kill your servers almost every day&lt;/li&gt;
&lt;li&gt;Serve frontend content using dedicated middleware (Nginx, S3, CDN) &lt;/li&gt;
&lt;li&gt;Good habits take some time to set in, so be vigilant and mindful about your habits; keep reading this list&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;NOTE: If you want to update this list, please comment, I'll incorporate your changes.&lt;/p&gt;

&lt;p&gt;Ref. &lt;br&gt;
&lt;a href="https://kkovacs.eu/software-project-best-practices-checklist"&gt;https://kkovacs.eu/software-project-best-practices-checklist&lt;/a&gt;&lt;br&gt;
&lt;a href="https://opensource.com/article/17/5/30-best-practices-software-development-and-testing"&gt;https://opensource.com/article/17/5/30-best-practices-software-development-and-testing&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/elsewhencode/project-guidelines"&gt;https://github.com/elsewhencode/project-guidelines&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/dereknguyen269/programing-best-practices"&gt;https://github.com/dereknguyen269/programing-best-practices&lt;/a&gt;&lt;br&gt;
&lt;a href="https://blog.galaxyweblinks.com/software-design-tips-aligning-ideas-through-diagrams/"&gt;https://blog.galaxyweblinks.com/software-design-tips-aligning-ideas-through-diagrams/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>bestpractices</category>
      <category>softwaredevelopment</category>
      <category>codingguidelines</category>
    </item>
    <item>
      <title>Building an Automated Equity Stock Trader - 1</title>
      <dc:creator>Niraj Kumar</dc:creator>
      <pubDate>Thu, 27 Jun 2019 17:48:55 +0000</pubDate>
      <link>https://dev.to/nirajkvinit/building-an-automated-equity-stock-trader-1-18dp</link>
      <guid>https://dev.to/nirajkvinit/building-an-automated-equity-stock-trader-1-18dp</guid>
      <description>&lt;p&gt;I had always wanted to learn about Share Market and Stock Trading, but kept on procrastinating. Then last year I read some articles on Financial Freedom, and the eagerness to better my finances rose again. But, my heart was never into Finance, or anything related to money. I am a programmer and I love programming so much so that I had practically ignored everything else - social life, money management, time management. Heck, sometimes I think, I get paid to do things I love and I might have done my work for a small bag of peanuts, except pizzas cost more.&lt;/p&gt;

&lt;p&gt;Since, I am acutely aware of my procrastination issue, I decided to take a new year resolution to get better at financial matters, learn more about it and strive for financial freedom. I wanted to have a system where my money will keep growing even when I sleep. &lt;/p&gt;

&lt;p&gt;So, I started learning about share market, by doing active trading and reading about it whenever I could find find time. &lt;/p&gt;

&lt;p&gt;Pretty soon, I got hooked. Made some money, and lost more than I made. After a while, I realized these - &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I was wasting time and money on penny stocks (which are mostly garbage) with the hope that with given enough time one of these will become multibagger &lt;/li&gt;
&lt;li&gt;I have fat fingers (Bungled many trades)&lt;/li&gt;
&lt;li&gt;Market is ruled by fast, disciplined, well informed, and well experienced traders&lt;/li&gt;
&lt;li&gt;Technical Information about stocks are very important&lt;/li&gt;
&lt;li&gt;It's better to do swing trading and keep rotating money to get better yield&lt;/li&gt;
&lt;li&gt;I have poor memory, I cannot remember trades, stocks and their prices&lt;/li&gt;
&lt;li&gt;I am poor at managing my portfolio&lt;/li&gt;
&lt;li&gt;I am super lazy&lt;/li&gt;
&lt;li&gt;I get scared easily&lt;/li&gt;
&lt;li&gt;I take unnecessary unplanned risks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I had been approached by many portfolio management service providers, but I refused to accept their services - the reason being - I want to learn the system to become better at this. I want to build my own capability.&lt;/p&gt;

&lt;p&gt;I had always wanted an automated system which could recommend me which stocks to buy/sell and give me alerts at the right time. Perhaps later, the system can do trading on its own. Trading can be learned, and it can be taught. Success depends on practice, and with better planning, better coding, better persistence. If I can build a system which will do my job for me - Earn me money while I sleep, then that would be an amazing achievement.&lt;/p&gt;

&lt;p&gt;I am sure, there are many machines, such systems out there and I could use their service instead of trying to build my own. But, I had always been a doer, I want to use this opportunity to learn more and more. I am using this journey to learn new languages, new technologies - AI/ML, Big Data, Data Science, Algorithmic Trading, Read and Understand Financial Data, Realtime Data Processing. So many things to learn and do, it's all exciting. &lt;/p&gt;

&lt;p&gt;Just recently I had completed the first step on this journey - Created a program to help me analyze my old trades and notify me of falling prices. It's a very important first step, and I will keep writing more and more about my journey.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>artificialintelligence</category>
      <category>stockrecommendationsystem</category>
    </item>
    <item>
      <title>Waste to Wealth</title>
      <dc:creator>Niraj Kumar</dc:creator>
      <pubDate>Mon, 03 Jul 2017 06:34:53 +0000</pubDate>
      <link>https://dev.to/nirajkvinit/waste-to-wealth</link>
      <guid>https://dev.to/nirajkvinit/waste-to-wealth</guid>
      <description>&lt;p&gt;We all produce waste. Some try to monetize it – get the value out of it, while some can’t. We try to keep our home clean and in the process we throw away our garbage without even putting a second thought to the value of it. I have seen my mother selling old newspaper, clothes, bottles, metal and with that savings would buy us treats. However, us city-dwellers lack patience, and space to store our garbage to be able to monetize it. Scrap dealers do not pay nicely unless there is good volume of valuable garbage for him.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Waste Bank!&lt;/strong&gt;&lt;br&gt;
But, what if there is a waste bank? What if a bank could convert our garbage to money? Imagine a scenario where a waste collector would come to our house daily or at a scheduled time to collect our garbage, and pay us for our garbage? I would use it. My family and my neighbors would use such services as soon as they see the value of their waste. This is a sound business strategy, albeit not a new one. Some tried, and most failed, because they got drowned in the operation phase and could not scale quickly. Such service can become profitable only at scale. Some of the waste can be quite valuable even in small quantity while some need grater volume to become valuable. Every piece of garbage has a value – biodegradables can be used to generate biogas and compost. Glass, plastic, clothes, metal, electronic items are recyclable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits!&lt;/strong&gt;&lt;br&gt;
Benefits are innumerable – however the most prominent one is clean environment with proper waste management. This sector needs another Jeff Bezos. Dedicated, intuitive, driven and fierce; Someone who values efficiency at every step; think and plan for long term. Because, with efficiency in place every single piece of garbage can be monetized and used properly instead of polluting our environment and putting humanity at risk. Value can be extracted from the low value garbage only with better efficient process and at larger scale.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How technology can help!&lt;/strong&gt;&lt;br&gt;
When I think about how technology can help this sector, I immediately think about how amazon used automation to put efficiency in its chaotic fullfillment centers. He constantly hammerd an already optimized and highly efficient process to make it more efficient. Similarly, automation and reiterative optimization can help in highly evolved garbage grader and sorter which will calculate and notify the value of waste in realtime. Garbage collection can be extremely inefficient. Data Science and machine intelligence can help in efficient route for garbage collection. Batch number based waste collection – automated grader and sorter would pick up batch number while sorting the garbage bag and immediately update the stats for the batch which customer can view on web-portal or can receive notification on their mobile app. Technology can help tremendously in putting efficiency in the operation and making the process profitable.&lt;/p&gt;

&lt;p&gt;Note: I have witnessed some startup charging money to collect waste. What are they thinking? They should pay for collecting waste. But, I guess that will take some more time.&lt;/p&gt;

</description>
      <category>waste</category>
      <category>garbage</category>
      <category>automation</category>
    </item>
    <item>
      <title>Startup Marketing Dilemma</title>
      <dc:creator>Niraj Kumar</dc:creator>
      <pubDate>Sat, 03 Jun 2017 14:27:54 +0000</pubDate>
      <link>https://dev.to/nirajkvinit/startup-marketing-dilemma</link>
      <guid>https://dev.to/nirajkvinit/startup-marketing-dilemma</guid>
      <description>&lt;p&gt;Many Tech-Startups start spending and focus heavily on Marketing and Sales activities early on, while their product/services platform suffers because of lack of features, and iterative improvements based on customers feedback. Some start marketing the product even when it has not reached the MVP level.&lt;/p&gt;

&lt;p&gt;Marketing is necessary evil! And, it should be handled simultaneously. The argument here is – what if startups focus more on improving the product, making it more user-friendly, intuitive, and engaging - allowing it to grow naturally with minimal effort on marketing and sales activities.&lt;/p&gt;

&lt;p&gt;I believe that ‘Word of Mouth’ publicity is more valuable in the early iterations; it attracts new customers to the platform and retains them for a longer period. In this highly competitive and quick evolving landscape; Customer engagement and retention is the key to success. If customers find a product/platform valuable, engaging, with superb UI/UX, and usable, they will most likely reuse it, pay for it and recommend to their connections of the world to use it.&lt;/p&gt;

&lt;p&gt;Purpose of building a product/platform for a customer fails if they cannot use it due to complexities or bugs in the system. Our inherent trait is, we do not ask for help unless in dire situation. Similarly, If customers cannot figure out how to use the product for themselves, then they would be reluctant to ask for help. Few adventurous/experimental types may contact help-desk. Besides, you need to allocate more time and valuable resources on keeping a large team of customer support executives to provide help to customers, or to complete the process on behalf of them.&lt;/p&gt;

&lt;p&gt;I think, instead of increasing the Marketing/Sales/BD budget and effort; startups should focus more on agile (fast-paced) improvement of their product to make it more usable than their competitors. They should hire more Tech Personnel (programmers, testers, and designers) to fast-track the iterative improvements of the product to make it more usable; instead of hiring more Marketing/Sales/BD people to sell vaporware.&lt;/p&gt;

</description>
      <category>startup</category>
    </item>
  </channel>
</rss>
