<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Avishka Medagamagodage on Medium]]></title>
        <description><![CDATA[Stories by Avishka Medagamagodage on Medium]]></description>
        <link>https://medium.com/@aimedagamagodage2003?source=rss-4fd2d263ac5a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wqVp13IWDoT04mvJx4IYhg.png</url>
            <title>Stories by Avishka Medagamagodage on Medium</title>
            <link>https://medium.com/@aimedagamagodage2003?source=rss-4fd2d263ac5a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 17:38:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aimedagamagodage2003/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Securing Uni-ShowCase: A Deep Dive into Our Project Vulnerabilities and Fixes]]></title>
            <link>https://medium.com/@aimedagamagodage2003/securing-uni-showcase-a-deep-dive-into-our-project-vulnerabilities-and-fixes-d03a3717fdfd?source=rss-4fd2d263ac5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d03a3717fdfd</guid>
            <dc:creator><![CDATA[Avishka Medagamagodage]]></dc:creator>
            <pubDate>Sat, 29 Aug 2026 08:20:36 GMT</pubDate>
            <atom:updated>2026-08-29T08:20:36.901Z</atom:updated>
            <content:encoded><![CDATA[<p>When building complex web applications, security cannot be an afterthought. This article serves as a post - mortem and educational breakdown of our recent project, <strong>Uni-ShowCase</strong>. It is designed to share our architectural decisions, identify the security vulnerabilities we encountered during development, and explain the steps we took to mitigate them.<br>Building a platform that connects multiple user types - while handling sensitive academic and professional data - requires a robust architecture and a paranoid approach to security. Recently, our team wrapped up development on <strong>Uni-ShowCase</strong>, a comprehensive web platform dedicated to information security and project portfolio management.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cvRDiqoAdphI8gux.png" /></figure><h3>What is Uni-ShowCase?</h3><p><strong>Uni-ShowCase</strong> is a centralized platform designed to bridge the gap between university students and potential employers. The application features specialized, role-based interfaces, including:</p><ul><li>A <strong>Students Dashboard</strong> for uploading and managing academic projects.</li><li>A <strong>Recruiter Dashboard</strong> for discovering and interacting with student talent.</li><li>An <strong>Admin Dashboard</strong> for platform moderation and oversight</li></ul><p><a href="https://github.com/Avishka-Medagamagodage/Uni-ShowCase---Information-Security-"><strong>Github URL : https://github.com/Avishka-Medagamagodage/Uni-ShowCase---Information-Security-</strong></a></p><h3>The Architecture</h3><p>To support this, we utilized a modern full-stack JavaScript environment:</p><ul><li><strong>Frontend:</strong> Built with React and Vite, featuring protected routes (ProtectedRoute.jsx) and dedicated UI components like ProjectCard.jsx and NotificationsModal.jsx.</li><li><strong>Backend:</strong> Powered by a Node.js ecosystem, connecting to a database and utilizing Cloudinary for media storage (cloudinary.js)</li><li><strong>Core Services:</strong> The backend is modularly split into specific controllers and services for Authentication, Interactions, Notifications, Projects, and Users.</li></ul><p>With a system handling user uploads, authentication, and varied access levels, the attack surface was significant. Here is a look at the vulnerabilities we discovered and how we patched them.</p><h3>Vulnerability #1: Insecure Hardcoded JWT Secret Fallback</h3><p>The application was found using a <strong>hardcoded JWT secret as a fallback</strong> when the JWT_SECRET environment variable was unavailable:</p><pre>const JWT_SECRET =<br>  process.env.JWT_SECRET || &#39;super_secret_jwt_key_net_centric_2026&#39;;</pre><p>This created a critical authentication vulnerability because the fallback secret was publicly visible in the source code. An attacker with access to the repository could use the known secret to <strong>forge valid JWT tokens</strong>, potentially impersonating users or escalating privileges to roles such as <strong>Admin or Recruiter</strong>.</p><p>The vulnerability could also affect invite-token generation and verification, allowing attackers to create unauthorized registration or invitation tokens.</p><h3>How It Was Fixed</h3><p>The hardcoded fallback was completely removed. A centralized getJwtSecret() function was implemented to retrieve JWT_SECRET from the environment and <strong>throw an error when it is missing</strong>.</p><p>This follows the <strong>fail-secure principle</strong>: rather than silently using an insecure default, the application refuses to operate without a properly configured cryptographic secret.</p><p><strong>Key takeaway:</strong> Cryptographic secrets should never be hardcoded or have predictable default fallbacks. They should be securely managed through environment variables or a dedicated secrets-management system.</p><p>Commit : <a href="https://github.com/Avishka-Medagamagodage/Uni-ShowCase---Information-Security-/commit/e434ce3a7a6f8484d4ce4d9e1ac352feddb9b179">https://github.com/Avishka-Medagamagodage/Uni-ShowCase---Information-Security-/commit/e434ce3a7a6f8484d4ce4d9e1ac352feddb9b179</a></p><h3>Vulnerability #2: Privilege Escalation &amp; Invite Token Reuse</h3><p>During the security assessment, a critical vulnerability was identified in the application’s <strong>invitation-based registration workflow</strong>. The issue allowed invitation tokens to potentially be <strong>reused multiple times</strong> and did not properly bind an invitation to the email address of the intended recipient.</p><h3>What Was the Problem?</h3><p>The application used JWT-based invitation tokens containing the invited user’s email and assigned role:</p><pre>const token = jwt.sign(<br>  {<br>    role: &#39;Admin&#39;,<br>    email: &#39;faculty@university.edu&#39;,<br>    type: &#39;INVITE&#39;<br>  },<br>  JWT_SECRET,<br>  { expiresIn: &#39;7d&#39; }<br>);</pre><p>The original implementation verified that the JWT was cryptographically valid, but it did not sufficiently verify whether the corresponding invitation in MongoDB was still Pending.</p><p>This created a <strong>Token Replay</strong> vulnerability. Once an invitation was used, the same valid token could potentially be reused to create additional accounts.</p><p>A second issue was the lack of strict email verification. For example, an invitation intended for:</p><pre>faculty@university.edu</pre><p>could potentially be used by:</p><pre>attacker@gmail.com</pre><p>if the server only trusted the role stored in the invitation token.</p><h3>Security Impact</h3><p>An attacker who obtained an invitation token could potentially:</p><ul><li>Reuse the same invitation multiple times.</li><li>Register unauthorized accounts.</li><li>Obtain privileged roles such as Admin or Recruiter.</li><li>Bypass the intended restriction that an invitation belongs to a specific email address.</li></ul><p>This could lead to <strong>privilege escalation, unauthorized account creation, and compromise of protected application functionality</strong>.</p><h3>How It Was Fixed</h3><p>The invitation workflow was redesigned with multiple security checks.</p><h3>1. Strict Email Binding</h3><p>The authenticated Google account is now compared with the email associated with the invitation:</p><pre>const normalizedEmail = email.toLowerCase().trim();</pre><pre>if (<br>  decodedInvite.email &amp;&amp;<br>  decodedInvite.email.toLowerCase().trim() !== normalizedEmail<br>) {<br>  throw new Error(<br>    &#39;Invitation email does not match authenticated email&#39;<br>  );<br>}</pre><p>This ensures that an invitation issued to one user cannot simply be used with another Google account.</p><h3>2. Atomic One-Time Invitation Validation</h3><p>The invitation is now retrieved and marked as completed atomically:</p><pre>const invitationRecord = await Invitation.findOneAndUpdate(<br>  {<br>    token: inviteToken,<br>    status: &#39;Pending&#39;,<br>    email: normalizedEmail<br>  },<br>  {<br>    $set: {<br>      status: &#39;Completed&#39;<br>    }<br>  },<br>  {<br>    new: true<br>  }<br>);</pre><pre>if (!invitationRecord) {<br>  throw new Error(<br>    &#39;Invitation token is invalid, expired, or has already been used.&#39;<br>  );<br>}</pre><p>The important part is:</p><pre>status: &#39;Pending&#39;</pre><p>Only a pending invitation can be consumed.</p><p>Once successfully used:</p><pre>Pending<br>   ↓<br>Completed</pre><p>A second attempt using the same token will fail because the invitation is no longer Pending.</p><h3>3. Role Taken From the Validated Invitation</h3><p>After successfully validating the invitation, the user’s role is assigned from the database record:</p><pre>role =<br>  invitationRecord.role ||<br>  decodedInvite.role ||<br>  &#39;Student&#39;;</pre><p>This ensures that role assignment occurs only after the invitation has passed the required validation checks.</p><h3>Secure Workflow</h3><p>The corrected registration process is:</p><pre>Google Authentication<br>        ↓<br>Verify JWT Invitation<br>        ↓<br>Find Pending Invitation<br>        ↓<br>Check Invited Email<br>        ↓<br>Does Email Match?<br>     ↓          ↓<br>    No         Yes<br>     ↓          ↓<br>   Reject   Consume Invite<br>                  ↓<br>          Mark as Completed<br>                  ↓<br>           Create Account</pre><p>This approach ensures that an invitation is:</p><p><strong>Valid + Pending + Email-Bound + One-Time-Use</strong></p><p>Commit : <a href="https://github.com/Avishka-Medagamagodage/Uni-ShowCase---Information-Security-/commit/d7537c09d15a68570e3cdb91888ced31dd7d8633">https://github.com/Avishka-Medagamagodage/Uni-ShowCase---Information-Security-/commit/d7537c09d15a68570e3cdb91888ced31dd7d8633</a></p><h3>Vulnerability #3: Unauthenticated Socket.io Registration &amp; Notification Eavesdropping</h3><h3>What Was the Problem?</h3><p>The application uses <strong>Socket.io</strong> to provide real-time notifications such as project approvals, follows, likes, and system alerts.</p><p>The original implementation allowed clients to establish Socket.io connections without authentication. After connecting, the client could send its own userId through the following event:</p><pre>socket.on(&#39;register&#39;, (userId) =&gt; {<br>  registerSocket(userId, socket.id);<br>});</pre><p>The main security issue was that the server <strong>trusted the </strong><strong>userId provided by the client</strong>.</p><p>An attacker could potentially connect to the Socket.io server and register their socket using another user’s ID:</p><pre>socket.emit(&#39;register&#39;, &#39;ADMIN_USER_ID&#39;);</pre><p>The server would then associate the attacker’s socket with the targeted user’s account.</p><h3>Impact</h3><p>This could allow an attacker to receive private real-time notifications intended for another user, including:</p><ul><li>Project approval notifications</li><li>Follow and like notifications</li><li>System alerts</li><li>Administrative notifications</li></ul><p>It could also interfere with socket routing and potentially prevent the legitimate user from receiving their notifications.</p><h3>How It Was Fixed</h3><p>A <strong>server-side Socket.io authentication middleware</strong> was introduced.</p><p>The client must now provide a valid JWT during the Socket.io handshake:</p><pre>io.use((socket, next) =&gt; {<br>  try {<br>    const token = socket.handshake.auth.token;</pre><pre>const decoded = jwt.verify(<br>      token,<br>      getJwtSecret()<br>    );    socket.userId = decoded.id;    next();<br>  } catch (error) {<br>    next(new Error(&#39;Authentication failed&#39;));<br>  }<br>});</pre><p>The important security improvement is that the server derives the user’s identity from the <strong>verified JWT</strong>:</p><pre>socket.userId = decoded.id;</pre><p>The insecure client-controlled registration event was removed:</p><pre>// ❌ Removed<br>socket.on(&#39;register&#39;, (userId) =&gt; {<br>  registerSocket(userId, socket.id);<br>});</pre><p>The socket is now registered using the authenticated identity:</p><pre>io.on(&#39;connection&#39;, (socket) =&gt; {<br>  registerSocket(<br>    socket.userId,<br>    socket.id<br>  );<br>});</pre><p>On the frontend, the JWT is supplied during the Socket.io connection:</p><pre>const socket = io(SOCKET_URL, {<br>  auth: {<br>    token<br>  }<br>});</pre><h3>Secure Flow</h3><pre>User Login<br>    ↓<br>JWT Token<br>    ↓<br>Socket.io Handshake<br>    ↓<br>Server Verifies JWT<br>    ↓<br>Extract userId from JWT<br>    ↓<br>Register Socket<br>    ↓<br>Receive Only Own Notifications</pre><p>This prevents users from simply claiming another user’s identity by providing an arbitrary userId.</p><h3>Vulnerability #4: Broken Access Control — Student Self-Approval of Projects</h3><h3>What Was the Problem?</h3><p>The application follows a project moderation workflow where student projects should initially remain <strong>private</strong> until they are reviewed.</p><p>The intended workflow is:</p><pre>Student Creates Project<br>        ↓<br>     Private<br>        ↓<br>Admin / Recruiter Review<br>        ↓<br>    Approved<br>        ↓<br>     Public</pre><p>However, the original backend allowed students to control the isPublic value.</p><p>For example, a student could potentially send:</p><pre>{<br>  &quot;title&quot;: &quot;My Project&quot;,<br>  &quot;description&quot;: &quot;Project description&quot;,<br>  &quot;isPublic&quot;: true<br>}</pre><p>If the backend accepted this value, the student could immediately publish the project without the required moderation process.</p><p>The same issue existed during project updates. A student could potentially send:</p><pre>PUT /api/projects/:id</pre><p>with:</p><pre>{<br>  &quot;isPublic&quot;: true<br>}</pre><p>This effectively allowed a student to <strong>approve their own project</strong>.</p><h3>Impact</h3><p>This vulnerability could result in:</p><ul><li>Content moderation bypass</li><li>Unauthorized publication of unreviewed projects</li><li>Inappropriate or malicious content appearing in the public showcase</li><li>Violation of the intended university approval workflow</li></ul><p>There was also an additional access-control issue in getProjectById, where Recruiters could potentially access private projects directly if they knew the project&#39;s ID.</p><h3>How It Was Fixed</h3><h3>1. Enforced Private State for Students</h3><p>The backend now ensures that student projects are created as private:</p><pre>if (user.role === &#39;Student&#39;) {<br>  projectData.isPublic = false;<br>}</pre><p>Therefore, even if a student sends:</p><pre>{<br>  &quot;isPublic&quot;: true<br>}</pre><p>the backend overrides it:</p><pre>Student<br>   ↓<br>isPublic = true<br>   ↓<br>Backend checks role<br>   ↓<br>isPublic = false</pre><h3>2. Protected Visibility Updates</h3><p>Changes to isPublic are now restricted to authorized roles:</p><pre>if (<br>  &#39;isPublic&#39; in projectData &amp;&amp;<br>  user.role !== &#39;Admin&#39; &amp;&amp;<br>  user.role !== &#39;Recruiter&#39;<br>) {<br>  throw new Error(<br>    &#39;Only Admin or Recruiter can change project visibility&#39;<br>  );<br>}</pre><p>Therefore:</p><pre>Student → isPublic=true<br>              ↓<br>           ❌ Rejected</pre><p>while:</p><pre>Admin → isPublic=true<br>           ↓<br>        ✅ Allowed</pre><p>and:</p><pre>Recruiter → isPublic=true<br>              ↓<br>           ✅ Allowed</pre><h3>3. Protected Private Projects</h3><p>The getProjectById logic was also strengthened so that Recruiters can only access public projects:</p><pre>if (<br>  user.role === &#39;Recruiter&#39; &amp;&amp;<br>  !project.isPublic<br>) {<br>  throw new Error(&#39;Access denied&#39;);<br>}</pre><p>This prevents unauthorized inspection of private or unapproved student projects.</p><h3>Final Secure Project Workflow</h3><p>The corrected authorization model is:</p><pre>Student<br>                    ↓<br>             Create Project<br>                    ↓<br>              isPublic=false<br>                    ↓<br>            ┌───────┴───────┐<br>            ↓               ↓<br>         Private          Review<br>                            ↓<br>                   Admin / Recruiter<br>                            ↓<br>                       Approve?<br>                       ↙      ↘<br>                     No        Yes<br>                     ↓          ↓<br>                  Private    Public</pre><p>Commit : <a href="https://github.com/Avishka-Medagamagodage/Uni-ShowCase---Information-Security-/commit/c0e91e2137101060315610e78652b23c7b3ca81a">https://github.com/Avishka-Medagamagodage/Uni-ShowCase---Information-Security-/commit/c0e91e2137101060315610e78652b23c7b3ca81a</a></p><h3>Vulnerability #5: Regular Expression Denial of Service (ReDoS) &amp; NoSQL Query Injection</h3><p>The application allowed users to search projects and users using query parameters such as:</p><pre>/api/projects?search=javascript</pre><p>The search and technologies values were taken directly from req.query and passed into MongoDB $regex queries or JavaScript RegExp() without proper sanitization.</p><p>The vulnerable approach was effectively:</p><pre>// ❌ VULNERABLE<br>const search = req.query.search;</pre><pre>const regex = new RegExp(search);const projects = await Project.find({<br>  title: { $regex: regex }<br>});</pre><p>Because the input was controlled by the user, an attacker could supply regular-expression metacharacters such as:</p><pre>* + ? ^ $ ( ) [ ] { } | \</pre><p>An attacker could also provide a complex expression such as:</p><pre>((a+)+)+$</pre><p>which can cause excessive regex processing and potentially block the Node.js event loop.</p><p>Another issue was that query parameters were not strictly validated as strings. An attacker could attempt to submit an object-style parameter such as:</p><pre>?search[$gt]=</pre><p>which could result in unexpected query structures being passed toward MongoDB.</p><h3>What is the Impact?</h3><ul><li><strong>Regular Expression Denial of Service (ReDoS)</strong>: Maliciously crafted regular expressions can consume excessive CPU and cause the Node.js event loop to become unresponsive.</li><li><strong>Application-Level Denial of Service</strong>: If the event loop becomes blocked, legitimate users may experience slow responses or complete API unavailability.</li><li><strong>Regex Injection</strong>: Attackers could use regex operators to change the intended behavior of search queries.</li><li><strong>Invalid Regex Errors</strong>: Inputs such as [ or (a+ can cause RegExp() compilation errors and unexpected server exceptions.</li><li><strong>NoSQL Query Injection Risk</strong>: Unexpected object-based query parameters could potentially introduce MongoDB operators into query construction.</li></ul><p>A successful ReDoS attack could follow this pattern:</p><pre>Attacker<br>   ↓<br>Malicious Regex Input<br>   ↓<br>Backend<br>   ↓<br>RegExp / MongoDB $regex<br>   ↓<br>Excessive CPU Usage<br>   ↓<br>Node.js Event Loop Blocked<br>   ↓<br>Application Becomes Unresponsive ❌</pre><h3>How it was Fixed</h3><p>A dedicated regex sanitization utility was introduced in:</p><p>Backend/src/utils/sanitize.js</p><pre>// ✅ SECURE<br>const escapeRegex = (str) =&gt; {<br>  if (typeof str !== &#39;string&#39;) return &#39;&#39;;</pre><pre>return str.replace(<br>    /[.*+?^${}()|[\]\\]/g,<br>    &#39;\\$&amp;&#39;<br>  );<br>};module.exports = {<br>  escapeRegex<br>};</pre><p>This function escapes regex metacharacters so that user input is treated as <strong>literal text instead of a regular-expression pattern</strong>.</p><p>For example:</p><pre>User Input:<br>C++</pre><pre>Escaped:<br>C\+\+</pre><p>The + characters are therefore treated as normal characters instead of regex operators.</p><h3>Type Validation &amp; Safe Query Building</h3><p>The application now verifies that search is actually a string before using it:</p><pre>// ✅ SECURE<br>const search = req.query.search;</pre><pre>if (<br>  typeof search !== &#39;string&#39; ||<br>  !search.trim()<br>) {<br>  // Reject or ignore invalid input<br>}</pre><p>The input is then sanitized before being passed to MongoDB:</p><pre>const { escapeRegex } = require(&#39;../utils/sanitize&#39;);</pre><pre>const safeSearch = escapeRegex(<br>  search.trim()<br>);const projects = await Project.find({<br>  title: {<br>    $regex: safeSearch,<br>    $options: &#39;i&#39;<br>  }<br>});</pre><p>This prevents users from injecting arbitrary regex syntax into the query.</p><h3>Secure Technology Filtering</h3><p>Technology filters were also updated to prevent regex manipulation.</p><p>Instead of directly using the user-provided technology:</p><pre>// ❌ Vulnerable<br>{<br>  technologies: {<br>    $regex: technology<br>  }<br>}</pre><p>the value is escaped and converted into an exact-match pattern:</p><pre>// ✅ Secure<br>const safeTechnology =<br>  `^${escapeRegex(technology)}$`;</pre><p>For example:</p><pre>Input:<br>C++</pre><pre>Safe Pattern:<br>^C\+\+$</pre><p>This ensures that the application searches for the intended technology rather than allowing the user to provide arbitrary regex logic.</p><h3>Secure Request Flow</h3><p>The corrected process is:</p><pre>User Search Input<br>       ↓<br>Validate Data Type<br>       ↓<br>Trim Input<br>       ↓<br>Escape Regex Characters<br>       ↓<br>Build Safe MongoDB Query<br>       ↓<br>Execute Query<br>       ↓<br>Return Results ✅</pre><p>Instead of:</p><pre>User Input<br>     ↓<br>Directly into RegExp / $regex<br>     ↓<br>Attacker-Controlled Regex<br>     ↓<br>ReDoS / Query Injection ❌</pre><p>Commit : <a href="https://github.com/Avishka-Medagamagodage/Uni-ShowCase---Information-Security-/commit/d04a08309a924d97bab51b5d4b5cd0392e619f27">https://github.com/Avishka-Medagamagodage/Uni-ShowCase---Information-Security-/commit/d04a08309a924d97bab51b5d4b5cd0392e619f27</a></p><h3>Vulnerability #6: Stored Cross-Site Scripting (XSS) via Unsanitized Project URLs</h3><p><strong>Affected Files</strong>:</p><ul><li>Backend/src/services/projectService.js</li><li>Backend/src/utils/sanitize.js</li><li>frontend/src/components/ProjectCard.jsx</li><li>frontend/src/pages/ProjectDetail.jsx</li><li>frontend/src/pages/AdminDashboard.jsx</li></ul><h3>What was the Problem?</h3><ul><li>The backend accepted demoUrl and gitRepoUrl in project creation and update endpoints without validating the URL protocol or scheme.</li><li>The frontend rendered these values directly in anchor tag href attributes: &lt;a href={project.demoUrl}&gt;.</li><li>An attacker could submit javascript:/* malicious payload */ or data:text/html,... as their demo link.</li></ul><h3>What is the Impact?</h3><ul><li><strong>Stored Cross-Site Scripting (XSS)</strong>: Whenever an Admin, Recruiter, or peer student browses the showcase and clicks <strong>“Live Demo”</strong> or <strong>“View Repository”</strong>, the malicious JavaScript executes inside the victim’s authenticated browser session.</li><li><strong>Account Hijacking &amp; Session Token Theft</strong>: The payload can read localStorage tokens (localStorage.getItem(&#39;token&#39;)) and silently transmit them to an external server.</li></ul><h3>How it was Fixed</h3><ol><li><strong>Server-Side Strict Protocol Validation</strong>:</li></ol><ul><li>Added isValidHttpUrl() and sanitizeUrl() helpers in</li><li>Backend/src/utils/sanitize.js requiring URLs to strictly start with http: or https:.</li></ul><p>In</p><ul><li>Backend/src/services/projectService.js, both createProject and updateProject now reject non-HTTP/HTTPS URLs and sanitize URL values before database storage.</li></ul><ol><li><strong>Defense-in-Depth on Frontend</strong>:</li></ol><ul><li>Added getSafeUrl() in</li><li>ProjectCard.jsx,</li><li>ProjectDetail.jsx, and</li><li>AdminDashboard.jsx to ensure that only verified http:// / https:// URLs are rendered in &lt;a href={...}&gt;.</li></ul><p>Commit : <a href="https://github.com/Avi511/Uni-ShowCase/commit/7137a0085213c464991f4ba43dc9a44536b56e10">https://github.com/Avi511/Uni-ShowCase/commit/7137a0085213c464991f4ba43dc9a44536b56e10</a></p><h3>Vulnerability #7: Permissive Wildcard CORS Origin Bypass</h3><p><strong>Affected File</strong>: Backend/src/app.js</p><h3>What was the Problem?</h3><ul><li>The backend previously used origin.endsWith(&#39;.vercel.app&#39;) while also having credentials: true enabled.</li><li>Since anyone can deploy an arbitrary free website to any-attacker-subdomain.vercel.app, any third-party website on Vercel could make authenticated cross-origin XMLHttpRequests/fetch calls with credentials to the backend.</li></ul><h3>What is the Impact?</h3><ul><li><strong>Cross-Site Data Theft &amp; Unauthorized State Modification</strong>: An attacker’s website could perform actions on behalf of authenticated users (such as reading private notifications, deleting projects, or following students).</li></ul><h3>How it was Fixed</h3><p>In</p><p>Backend/src/app.js:</p><ul><li>Removed the wildcard endsWith(&#39;.vercel.app&#39;) rule.</li><li>Configured an exact whitelist parsed from process.env.FRONTEND_URL (supports multiple comma-separated URLs) alongside local development hosts (localhost:5173, localhost:3000, 127.0.0.1:5173).</li></ul><h3>Vulnerability #8: Insufficient File MIME &amp; Extension Validation (Uploads)</h3><p><strong>Affected Files</strong>:</p><ul><li>Backend/src/middlewares/uploadMiddleware.js</li><li>Backend/src/utils/cloudinary.js</li></ul><h3>What was the Problem?</h3><ul><li>uploadMiddleware.js only inspected file.mimetype.startsWith(&#39;image/&#39;), which trusted the client-sent Content-Type header without verifying file extensions or restricting disallowed image types (such as executable .svg or .html).</li><li>Cloudinary upload used resource_type: &#39;auto&#39; with un-sanitized raw filenames.</li></ul><h3>What is the Impact?</h3><ul><li><strong>Stored XSS via Scriptable Uploads</strong>: Attackers could upload malicious SVG or HTML files with embedded scripts.</li><li><strong>Serverless Denial of Service</strong>: Unbounded multi-file uploads could overwhelm memory.</li></ul><h3>How it was Fixed</h3><ol><li><strong>Double-Verification Whitelist in </strong><strong>uploadMiddleware.js</strong>:</li></ol><ul><li>Strictly validates both the MIME type (image/jpeg, image/png, image/webp, image/jpg) <strong>and</strong> the file extension (/\.(jpg|jpeg|png|webp)$/i).</li><li>Added limits on file size (5MB) and total files (maximum 6 files per request).</li></ul><ol><li><strong>Hardened Cloudinary Storage in </strong><strong>cloudinary.js</strong>:</li></ol><ul><li>Enforced resource_type: &#39;image&#39; (preventing executable/raw interpretations).</li><li>Sanitized all public IDs and file names using sanitizeFilename() to strip path traversals and dangerous characters.</li></ul><h3>Vulnerability #9: Missing Security Headers (helmet) &amp; Rate Limiting</h3><p><strong>Affected File</strong>:</p><ul><li>Backend/src/app.js</li></ul><h3>What was the Problem?</h3><ul><li>The Express server omitted critical defense-in-depth HTTP security headers (e.g. X-Content-Type-Options, X-Frame-Options, Strict-Transport-Security).</li><li>The API lacked rate limiting, exposing the Google OAuth authentication endpoint and email invitation generation endpoints to automated brute-force attacks and email spamming.</li></ul><h3>What is the Impact?</h3><ul><li><strong>Clickjacking &amp; MIME Sniffing</strong>: Vulnerable to framing attacks and browser MIME confusion.</li><li><strong>Denial of Service / Mail Quota Exhaustion</strong>: Automated bots could flood /api/auth/invite and /api/auth/invite/bulk to exhaust Gmail SMTP quotas.</li></ul><h3>How it was Fixed</h3><p><strong>Installed &amp; Configured </strong><strong>helmet</strong>:</p><ul><li>Registered helmet({ crossOriginResourcePolicy: { policy: &#39;cross-origin&#39; } }) to set secure response headers, disable X-Powered-By: Express, and enforce clickjacking protection.</li></ul><p><strong>Configured </strong><strong>express-rate-limit</strong>:</p><ul><li>generalLimiter: Limits general API requests to 200 per 15 minutes per IP.</li><li>authLimiter: Strictly limits authentication and invitation endpoints (/api/auth/*) to 30 requests per 15 minutes per IP.</li></ul><p><strong>Global Error Handler Hardening</strong>:</p><ul><li>Added automated interception for CastError (invalid MongoDB ObjectIDs) and ValidationError, returning clean 400 Bad Request responses instead of internal 500 error stack traces.\</li></ul><p>Commit message : <a href="https://github.com/Avi511/Uni-ShowCase/commit/240b5678bd16189025c5d573117d625f3f8daafc">https://github.com/Avi511/Uni-ShowCase/commit/240b5678bd16189025c5d573117d625f3f8daafc</a></p><h3>Conclusion</h3><p>Securing Uni-ShowCase was more than just fixing individual vulnerabilities ,it was a practical lesson in thinking like an attacker while building like a developer. From JWT security and privilege escalation to Socket.io authentication, access control, NoSQL injection, XSS, CORS, file uploads, rate limiting, and error handling, each vulnerability showed how a small assumption can become a serious security risk. The biggest takeaway from this project is that security should be built into every layer of an application, from the frontend and API to authentication, database queries, file handling, and infrastructure. There is no such thing as a completely secure application, but continuous testing, threat modeling, secure coding practices, and regular security reviews can significantly reduce the attack surface. <strong>Uni-ShowCase is not just a project we built, it is a project that taught us how to build more securely.</strong></p><p>README.md URL : <a href="https://github.com/Avishka-Medagamagodage/Uni-ShowCase---Information-Security-/tree/main/Vulnerabilities">https://github.com/Avishka-Medagamagodage/Uni-ShowCase---Information-Security-/tree/main/Vulnerabilities</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d03a3717fdfd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding JWT (JSON Web Tokens): A Complete Guide for Developers]]></title>
            <link>https://medium.com/@aimedagamagodage2003/understanding-jwt-json-web-tokens-a-complete-guide-for-developers-2389b69534d6?source=rss-4fd2d263ac5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/2389b69534d6</guid>
            <dc:creator><![CDATA[Avishka Medagamagodage]]></dc:creator>
            <pubDate>Tue, 05 May 2026 06:28:20 GMT</pubDate>
            <atom:updated>2026-05-05T06:28:20.183Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BGghFiTodtpVxhW5gINKUQ.png" /></figure><h3><strong>Introduction</strong></h3><p>Authentication is a core part of modern applications. Traditionally, web apps relied on <strong>session based authentication</strong>, where the server stores user session data and tracks users using cookies.</p><p>But this approach doesn’t scale well for:</p><ul><li>Single Page Applications (SPAs)</li><li>Mobile apps</li><li>Distributed systems (microservices)</li></ul><p>That’s where <strong>JWT (JSON Web Tokens)</strong> comes in.</p><p>JWT enables <strong>token-based authentication</strong>, where the server doesn’t store session state. Instead, all necessary information is stored inside a token that the client sends with every request.</p><p>👉 This makes JWT ideal for <strong>stateless, scalable systems</strong>.</p><h3>What is JWT?</h3><p>A <strong>JSON Web Token (JWT)</strong> is a compact, URL-safe token used for securely transmitting information between parties.</p><h4>Key characteristics:</h4><ul><li><strong>Stateless</strong> → No server-side session storage</li><li><strong>Compact</strong> → Small enough to send in HTTP headers</li><li><strong>Self-contained</strong> → Contains user data (claims)</li></ul><h3>Structure of JWT</h3><p>A JWT consists of 3 parts:</p><pre>Header.Payload.Signatur</pre><p>Example:</p><pre>eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...</pre><h3>How JWT Works (Step-by-Step)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4zQYLvpyh8cC8s2UMSVVqw.png" /></figure><h3>Flow:</h3><p>User logs in</p><p>Server verifies credentials</p><p>Server generates JWT</p><p>Client stores token (cookie or memory)</p><ul><li>Authorization: Bearer &lt;token&gt;</li></ul><p>Server verifies signature &amp; expiration</p><h3>JWT vs Session-Based Authentication</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PVU6YKG_d5BzOoJ770yQXg.png" /></figure><h3>Security Concerns</h3><p>🔹 Common vulnerabilities</p><ul><li>XSS (Token theft) → attacker steals token</li><li>Replay attacks → reused stolen tokens</li><li>No logout issue → token remains valid</li><li>local Storage risk → accessible via JavaScript</li></ul><p>🔹 Best practices</p><p>✅ Use Http Only cookies<br> ✅ Set short expiration time<br> ✅ Implement refresh tokens<br> ✅ Always use HTTPS<br> ✅ Validate signature strictly</p><h3>Access Token vs Refresh Token</h3><p><strong>Access Token</strong></p><ul><li>Short-lived (e.g., 15 mins)</li><li>Used for API requests</li></ul><p><strong>Refresh Token</strong></p><ul><li>Long-lived</li><li>Used to generate new access tokens</li></ul><h4><strong>Flow</strong></h4><ol><li>Access token expires</li><li>Client sends refresh token</li><li>Server issues new access token</li></ol><p>Signing algorithms in JWT come in two main types: <strong>HS256</strong>, which uses a shared secret and is simple and fast, and <strong>RS256</strong>, which uses public and private keys and is more suitable for distributed systems. Generally, HS256 is used for simpler applications, while RS256 is preferred for microservices or external APIs.</p><p>JWT is widely used in real systems for purposes such as REST API authentication, communication between microservices, and in standards like OAuth and OpenID Connect. It also enables role-based access control by including roles or permissions inside the token.</p><p>However, JWT has some limitations. Tokens are difficult to revoke once issued, they can become large if too much data is stored, and their security heavily depends on proper implementation. In some cases, traditional session-based authentication can be a simpler and safer option.</p><p>In terms of implementation, developers typically generate tokens using functions like jwt.sign() and verify them using middleware with jwt.verify(). This helps protect routes and ensure only authenticated users can access certain resources.</p><p>Testing JWT is straightforward using tools like Postman to send requests and platforms like jwt.io to decode and inspect tokens. It’s important to verify aspects such as expiration time and signature validity during testing.</p><p>Finally, best practices include keeping the payload small, avoiding sensitive data in the token, always using HTTPS, setting expiration times, using refresh tokens, and storing tokens securely — preferably in HttpOnly cookies rather than local storage.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2389b69534d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[URSIE 2025: Insights, Inspiration, and What Comes Next]]></title>
            <link>https://medium.com/@aimedagamagodage2003/ursie-2025-insights-inspiration-and-what-comes-next-03568814f2cd?source=rss-4fd2d263ac5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/03568814f2cd</guid>
            <dc:creator><![CDATA[Avishka Medagamagodage]]></dc:creator>
            <pubDate>Thu, 25 Dec 2025 15:18:36 GMT</pubDate>
            <atom:updated>2025-12-25T15:18:36.402Z</atom:updated>
            <content:encoded><![CDATA[<p>Walking into the B1 Building at the Faculty of Science on 10th October, <strong>URSIE 2025</strong> immediately felt different from a typical academic event. The space was buzzing students explaining their work, lecturers asking questions, and posters packed with ideas that clearly went far beyond classroom theory. It didn’t feel like an assignment showcase; it felt like a place where ideas were being tested against the real world.</p><p>As a student at the University of Kelaniya, events like URSIE always remind me why we study what we study. The equations, models, and theories we learn aren’t just abstract concepts they’re tools for understanding how real systems behave, whether in nature, society, or technology.</p><p>With so many strong projects on display, it wasn’t easy to choose just one. But one poster stood out to me because it showed how mathematical modeling can be used to study and guide biological systems in a meaningful and practical way.</p><p><strong>The research that stood out to me was titled:</strong></p><ul><li><strong>Research Title:</strong> Optimal Control for Maximizing Total Population in a PredatorPrey System</li><li><strong>Authors:</strong> Arachchi C.N.D. and Hasasemeenu W.P.T.</li><li><strong>Paper ID:</strong> 07</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*wTzGreeJP1LOtg1Zo7ngiA.jpeg" /></figure><h3>Why This Research Matters</h3><p>Predator prey interactions are fundamental to ecosystems, but managing them is far from simple. Traditional models often describe how populations change naturally, without considering how human intervention such as harvesting or conservation strategies can influence long-term outcomes.</p><p>What made this project particularly interesting was its use of <strong>optimal control theory</strong>. Instead of letting the system evolve on its own, the researchers introduced a control variable designed to maximize the total population over a fixed time period. This approach helps identify the best strategy for intervention while maintaining ecological stability.</p><p>Using mathematical formulations and numerical simulations implemented in MATLAB, the study demonstrated how controlled actions can significantly affect population dynamics. The phase portraits and cost functional graphs provided clear visual evidence of how optimal strategies outperform uncontrolled systems.</p><p>Seeing these results made me realize how powerful mathematical modeling can be in areas like wildlife management, fisheries, and environmental conservation fields where poor decisions can have irreversible consequences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*fWMrK675KxwEjpbfxs5jMQ.jpeg" /></figure><h3>Final Thoughts</h3><p>Attending URSIE 2025 was an inspiring experience, and this particular project reinforced the importance of applied mathematics in solving real-world problems. Paper ID 07 showed that even abstract concepts like differential equations and control theory can have meaningful applications when applied thoughtfully.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=03568814f2cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building MiniOS: A Journey into Real Mode OS Development]]></title>
            <link>https://medium.com/@aimedagamagodage2003/building-minios-a-journey-into-real-mode-os-development-62f0258b952b?source=rss-4fd2d263ac5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/62f0258b952b</guid>
            <dc:creator><![CDATA[Avishka Medagamagodage]]></dc:creator>
            <pubDate>Wed, 25 Jun 2025 16:52:06 GMT</pubDate>
            <atom:updated>2025-06-25T16:52:06.635Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*VcQQJSmGtIoLqiEn8p12ow.jpeg" /></figure><p>This article documents my first foray into the fascinating world of operating systems. To truly understand the fundamentals, I decided to build a simple real-mode OS from scratch. I call it <strong>MiniOS</strong>. This post will break down its structure, how it boots, and the core components that make it work.</p><p>The entire OS is written in 16-bit x86 Assembly and compiled using the Netwide Assembler (NASM). For testing, I used an emulator (like QEMU or VirtualBox) to run the final disk image. The process has been an incredible learning experience, and I hope by sharing it, I can demystify some of the magic that happens when a computer turns on.</p><h3>The Boot Process: From Power-On to Prompt</h3><p>When you turn on a PC, it first runs the BIOS (Basic Input/Output System). The BIOS performs some initial hardware checks and then looks for a bootable device (like a floppy disk or hard drive). It identifies a bootable device by checking the very first sector for a special signature: 0xAA55.</p><p>If this signature is present, the BIOS loads the first 512 bytes of that device (the “boot sector”) into memory at address 0x7C00 and starts executing it. This small program is our <strong>bootloader</strong>.</p><h3>Part 1: The Bootloader — The Key to the Kingdom</h3><p>The job of the MiniOS bootloader is simple but crucial: load the main operating system (the “kernel”) from the disk into memory and transfer control to it.</p><p>Here is the core logic from bootloader.asm:</p><pre>; Load kernel from second sector (LBA 1) to 0x1000<br>mov ah, 0x02      ; AH=0x02 -&gt; BIOS read sector function<br>mov al, 1         ; Read 1 sector<br>mov ch, 0         ; Cylinder 0<br>mov cl, 2         ; Sector 2 (Kernel starts here)<br>mov dh, 0         ; Head 0<br>mov dl, 0x00      ; Drive 0 (Floppy)<br>mov bx, 0x1000    ; Load address for the kernel<br>int 0x13          ; Call BIOS disk interrupt<br><br>jc disk_error     ; If error, jump to error routine<br>jmp 0x0000:0x1000 ; Jump to the kernel&#39;s entry point</pre><p>The bootloader uses BIOS interrupt 0x13 to perform the disk read. It tells the BIOS to read one sector (sector 2, since our bootloader is in sector 1) and place it at memory address 0x1000. Once the kernel is loaded, the bootloader makes a final jump to 0x1000, and MiniOS officially begins to run.</p><h3>Part 2: The Kernel — The Heart of MiniOS</h3><p>With the bootloader’s job done, our kernel takes over. The kernel, located at 0x1000, is responsible for all the &quot;OS&quot; functionality, which in our case is a simple, interactive command shell.</p><p>Upon starting, the kernel first clears the screen and displays a friendly welcome message.</p><pre>show_startup_msg:<br>    mov si, welcome_string<br>    call print_string<br>    call print_newline<br><br>    mov si, intro_string<br>    call print_string<br>    call print_newline<br>    ; ... and so on</pre><h3>The Main Loop: Our Simple Shell</h3><p>After the welcome message, the kernel enters its main_loop. This is the core of the user experience. The logic is straightforward:</p><ul><li>Print the prompt MiniOS &gt;&gt;.</li><li>Wait for the user to type a command and press Enter.</li><li>Compare the input against a list of known commands.</li><li>Execute the corresponding function.</li><li>Repeat.</li></ul><pre>main_loop:<br>    call print_newline<br>    mov si, prompt_string<br>    call print_string<br><br>    mov di, command_buffer<br>    call read_string<br>    mov si, command_buffer<br>    mov di, info_cmd<br>    call string_compare<br>    je handle_info<br>    mov si, command_buffer<br>    mov di, help_cmd<br>    call string_compare<br>    je handle_help<br>    ; ... and so on for other commands</pre><h3>Core Functions Explained</h3><p>To make the shell work, the kernel relies on a few essential functions:</p><p><strong>1. Printing to the Screen (</strong><strong>print_string)</strong> This function prints a string of characters one by one until it hits a null terminator (a byte with the value 0). It uses the BIOS teletype interrupt 0x10 with AH=0x0E.</p><pre>print_string:<br>    mov ah, 0Eh<br>.repeat:<br>    lodsb        ; Load byte from SI into AL, and increment SI<br>    cmp al, 0    ; Compare the character to 0 (null)<br>    je .done     ; If it&#39;s null, we&#39;re done<br>    int 10h      ; Otherwise, call BIOS video service to print it<br>    jmp .repeat<br>.done:<br>    ret</pre><p><strong>2. Reading from the Keyboard (</strong><strong>read_string)</strong> This function waits for keyboard input using interrupt 0x16. It handles printable characters, the Enter key (which finishes the input), and the Backspace key for basic editing.</p><pre>read_string:<br>    ; ...<br>.read_loop:<br>    mov ah, 00h     ; AH=0x00 -&gt; BIOS get keystroke function<br>    int 16h         ; Call BIOS keyboard interrupt<br>    cmp al, 0Dh     ; Was it the Enter key?<br>    je .done<br>    cmp al, 08h     ; Was it the Backspace key?<br>    je .backspace<br>    <br>    ; Otherwise, store and echo the character<br>    mov [di], al<br>    mov ah, 0Eh<br>    int 10h<br>    inc di<br>    jmp .read_loop<br>;...</pre><h3>MiniOS Commands</h3><p>MiniOS currently supports three built-in commands:</p><ul><li><strong>info</strong>: Displays version information for the kernel. For now, it&#39;s a static message, but it lays the groundwork for displaying real hardware data in the future.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*reGRxDnbNnlV6Cez_Obupg.jpeg" /></figure><ul><li><strong>help</strong>: Shows the list of available commands and a brief description of each.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*FSzJkE8DTs99C0bQZybETQ.jpeg" /></figure><ul><li><strong>clear</strong>: Clears the entire screen and redisplays the initial startup message, providing a clean slate. This is achieved by calling the BIOS interrupt 0x10 to reset the video mode.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*jJDlg81E-6GTV6E5tznQgw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*_uTTYEeU8MBWVJ1g8y1vTg.jpeg" /></figure><pre>handle_clear:<br>    call clear_screen<br>    call show_startup_msg<br>    jmp main_loop<br><br>clear_screen:<br>    pusha<br>    mov ah, 0x00      ; AH=0x00 -&gt; Set Video Mode<br>    mov al, 0x03      ; AL=0x03 -&gt; 80x25 16-color text mode<br>    int 10h<br>    popa<br>    ret</pre><h3>Conclusion and What’s Next</h3><p>Building MiniOS has been a fantastic exercise in understanding the boot process, interacting with the BIOS, and structuring a basic command-line interface. It demonstrates that at its core, an operating system is a program that manages resources (like the screen and keyboard) and provides a platform for interaction.</p><p>This is just the beginning. The simplicity of MiniOS makes it a perfect foundation to build upon. Future plans include adding more commands, perhaps for reading the system time from the RTC (Real-Time Clock), or even implementing a very simple file system to read and write data to the floppy disk. The journey into OS development is a deep one, and there is always more to discover.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62f0258b952b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Types of Software Licenses and Why They Matter?]]></title>
            <link>https://medium.com/@aimedagamagodage2003/what-is-software-license-f139fdd9350c?source=rss-4fd2d263ac5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f139fdd9350c</guid>
            <dc:creator><![CDATA[Avishka Medagamagodage]]></dc:creator>
            <pubDate>Mon, 26 May 2025 12:50:16 GMT</pubDate>
            <atom:updated>2025-05-26T12:52:17.089Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Software License?</h3><p>A <strong>software license</strong> is a legal agreement that defines how a user can use, share, modify, or distribute a particular piece of software. It sets the terms and conditions between the software creator (or company) and the end user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0wdXXfRQEY7XeNFnavk9uw.jpeg" /></figure><p>Let’s dive into few primary categories of software licenses.</p><p>🔓 1. <strong>Open Source Licenses</strong></p><p>An <strong>open source license</strong> lets users freely use, modify, and share a program’s source code. It encourages collaboration and transparency. Some licenses require shared changes to use the same license. These licenses are popular for promoting innovation and open development.</p><p><em>But not all open source licenses are the same. Here’s a quick breakdown for open source license.</em></p><p>1.📘 MIT License</p><p>2.📗 Apache License 2.0</p><p>3.📙 GNU General Public License (GPL)</p><p>4.📕 GNU Lesser GPL (LGPL)</p><p>5.📒 Mozilla Public License (MPL)</p><p>🔒 2. <strong>Proprietary Licenses</strong></p><p>A <strong>proprietary license</strong> is a type of software license that restricts access to the source code and limits how the software can be used, shared, or modified. Users typically must pay to use the software and follow strict usage terms set by the owner.</p><p>1.🖥️ Commercial Licenses</p><p>2.🧩 Freemium Licenses</p><p>3.🕹️ Shareware</p><p>🎮 3. <strong>Creative Commons (For Software Content)</strong></p><p><strong>Creative Commons (CC)</strong> licenses are used to share creative works like software documentation, designs, or educational materials. While not meant for software code itself, CC licenses allow creators to control how others use, share, and adapt their content.This is used for,</p><ul><li>Documentation</li><li>Design assets</li><li>Educational materials</li></ul><p>📋 4. <strong>Dual Licensing</strong></p><p><strong>Dual licensing</strong> is a model where software is released under both an open-source and a commercial license. This allows individual users and the developer community to use and contribute freely, while offering businesses a paid option with added features, support, or legal flexibility. It balances openness with the potential for revenue.</p><p>Some software offers <strong>two licenses</strong>:</p><ul><li><strong>One open source</strong>, for the community.</li><li><strong>One commercial</strong>, for businesses who want fewer restrictions.</li></ul><h4><strong>Example:</strong></h4><ul><li><strong>MySQL</strong> — available under GPL and a commercial license.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R6sd_CzhoTeULa5cLrrlPg.png" /></figure><h3><strong>💡 Why This Matters</strong></h3><p>Software licenses might seem boring or too technical, but they’re super important because they <strong>define what you’re allowed to do</strong> with a piece of software.<br>For example:</p><ul><li>If you’re a <strong>developer</strong>, choosing the right license helps protect your code and decide if others can reuse or profit from it.</li><li>If you’re a <strong>user or business</strong>, it tells you what you can legally do — like whether you can use the software in your project, modify it, or resell it.</li></ul><p>Getting it wrong could lead to <strong>legal issues</strong> or accidentally giving away your rights. So, understanding software licenses is key for <strong>both protecting your work and using others’ work safely and legally</strong>.</p><h3>✅ Conclusion</h3><p>Understanding software licenses is essential for anyone using, developing, or distributing software. Whether it’s the freedom of open-source, the control of proprietary licenses, the sharing nature of Creative Commons, or the flexibility of dual licensing, each type serves a specific purpose. Choosing the right license helps protect your work, ensures legal use, and supports collaboration or business goals. Always read the license terms carefully and pick one that aligns with your project’s vision.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f139fdd9350c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding DevOps: Culture, Concepts, and Benefits]]></title>
            <link>https://medium.com/@aimedagamagodage2003/understanding-devops-culture-concepts-and-benefits-c00ada1b3f17?source=rss-4fd2d263ac5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c00ada1b3f17</guid>
            <dc:creator><![CDATA[Avishka Medagamagodage]]></dc:creator>
            <pubDate>Sun, 04 May 2025 04:27:28 GMT</pubDate>
            <atom:updated>2025-05-04T04:27:28.810Z</atom:updated>
            <content:encoded><![CDATA[<p>DevOps is a modern approach that combines practices, culture, and tools to speed up and improve how software is developed, deployed, and managed. It’s not just about technology it’s a shift in mindset and teamwork.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mj_P8IPlZ9ViA0xXM6_4rA.png" /><figcaption>DevOps Diagram</figcaption></figure><p><strong>What is DevOps Culture ?</strong></p><p>DevOps culture is the foundation upon which successful DevOps implementation rests. It’s characterized by:</p><ul><li><strong>Collaboration and Communication:</strong> Breaking down silos and fostering open communication between development, operations, and other relevant teams (e.g., security, quality assurance)</li><li><strong>Shared Responsibility:</strong> A collective ownership of the entire software lifecycle, where everyone is invested in the success and stability of the product.</li><li><strong>Trust and Transparency:</strong> Building an environment of trust where teams can openly share information, challenges, and successes.</li><li><strong>Learning and Experimentation:</strong> Encouraging a culture of continuous learning, experimentation, and embracing failure as an opportunity for growth.</li><li><strong>Empathy:</strong> Understanding the challenges and perspectives of different teams involved in the software delivery process.</li></ul><p><strong>DevOps Concepts and Practices</strong></p><p>DevOps is built upon several key concepts and practices:</p><ul><li>Continous Itegration(CI)</li><li>Continous Delivery(CD)</li><li>Continous Deployment</li><li>Infrastructure as Code (IaC)</li><li>Automation</li><li>Monitoring &amp; Logging</li><li>Feedback Loops</li><li>Microservices</li><li>Agile Methodologies</li></ul><p><strong>DevOps Tools</strong></p><p>A wide array of tools supports DevOps practices. Some common categories include:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vKF8CPwGfXyEKwet4N-4jw.png" /><figcaption>DevOps Tools</figcaption></figure><p><strong>Benefits of Using DevOps</strong></p><ul><li>Faster Release Cycles</li><li>Improved Software Quality and Stability</li><li>Increased Efficiency and Automation</li><li>Better Collaboration and Communication</li><li>Enhanced Scalability and Reliability</li><li>Faster Time to Market</li><li>Increased Customer Satisfaction</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c00ada1b3f17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Store Procedures in MySQL]]></title>
            <link>https://medium.com/@aimedagamagodage2003/store-procedures-in-mysql-92cae8605fa0?source=rss-4fd2d263ac5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/92cae8605fa0</guid>
            <dc:creator><![CDATA[Avishka Medagamagodage]]></dc:creator>
            <pubDate>Mon, 27 Jan 2025 19:11:18 GMT</pubDate>
            <atom:updated>2025-01-27T19:13:18.948Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is a Stored Procedure?</h3><p>A stored procedure is a precompiled set of SQL statements and optional control-of-flow logic that is stored in a database. It executes as one unit and may take in parameters, process those inputs, and return values or results. It is common to encapsulate business logic within the database layer using a stored procedure for performance and maintainability.</p><h3>Advantages of Stored Procedures</h3><ol><li>Performance Optimization:</li></ol><p>Since stored procedures are precompiled and remain in the database, there is a saving on query parsing and execution time.</p><p>2.Reduced Network Traffic</p><p>A single call to a procedure will suffice, rather than sending multiple queries across the network.</p><p>3.Code Reusability and Modularity:</p><p>Procedures can be reused across different applications and queries, reducing code duplication.</p><p>4.Improved Security:</p><p>Permissions can be granted at the procedure level, allowing restricted access to sensitive data.</p><p>5.Improved Maintainability:</p><p>The rationale behind this: Centralized business logic in stored procedures is easier to update and maintain.</p><h3>Disadvantages of Stored Procedures</h3><p>1.Complex Debugging:</p><p>By nature, debugging stored procedures is more complicated compared to application-level code.</p><p>2.Database Dependency:</p><p>This places the business logic within the database and couples the application tightly with the database.</p><p>3.Limited Portability:</p><p>Generally, stored procedures are specific to a certain database, which complicates migration between different database systems.</p><p>4.Version Control:</p><p>Version control for stored procedures is not as good as application code stored in Git or similar repositories.</p><h3>How to Write and Execute Stored Procedures in MySQL</h3><h4>1. Writing a Stored Procedure</h4><p>To create a stored procedure in MySQL, use the CREATE PROCEDURE statement. A procedure typically includes input parameters, output parameters, and a body of SQL statements.</p><p>DELIMITER //<br>CREATE PROCEDURE procedure_name (parameters)<br>BEGIN<br> — SQL statements<br>END //<br>DELIMITER ;</p><ul><li><strong>DELIMITER</strong>: Changes the default statement delimiter (;) to another symbol (e.g., //) to allow the use of semicolons within the procedure.</li><li><strong>procedure_name</strong>: Name of the stored procedure.</li><li><strong>parameters</strong>: Input (IN), output (OUT), or input-output (INOUT) parameters.</li><li><strong>BEGIN … END</strong>: Used to define the body of the procedure.</li></ul><h4>Example: Creating and Using a Stored Procedure</h4><p><strong>Use Case</strong>: A stored procedure to fetch the total sales for a given product category.</p><p><strong>Create the Stored Procedure</strong></p><p>DELIMITER //<br>CREATE PROCEDURE GetLowGradeCustomer (IN GRADE_BELOW INT(2))<br>BEGIN<br>SELECT CUST_CODE, CUST_NAME<br> FROM customers<br> WHERE GRADE &lt; GRADE_BELOW;<br>END //<br>DELIMITER ;</p><p><strong>Execute the Stored Procedure</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*xTCEfcPk5S2KxqesCeuLBw.jpeg" /></figure><ul><li><strong>CALL</strong>: Executes the stored procedure.</li></ul><h3>Conclusion</h3><p>Stored procedures are a valuable feature in database systems, offering improved performance, reusability, and security for managing complex business logic directly within the database. They reduce redundancy and make applications more efficient by encapsulating logic in a central place. However, developers must carefully weigh the benefits against potential drawbacks like vendor lock-in and debugging challenges.</p><p>When used strategically, stored procedures can streamline database operations, improve code maintainability, and enhance the overall performance of applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92cae8605fa0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CIA Triad in Cyber Security]]></title>
            <link>https://medium.com/@aimedagamagodage2003/cia-triad-in-cyber-security-dce86a9a8046?source=rss-4fd2d263ac5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/dce86a9a8046</guid>
            <dc:creator><![CDATA[Avishka Medagamagodage]]></dc:creator>
            <pubDate>Mon, 15 Jul 2024 15:40:11 GMT</pubDate>
            <atom:updated>2024-07-15T15:40:11.774Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Information security is also defined as the process of guarding information and any related technologies from certain risks that are related to the unwanted use, revelation, modification or destruction of the information. They are, indeed, essential to ensure the protection of the information attributes: confidentiality, integrity, and availability. Security of information is very crucial in making certain that intrusive individuals and organizations do not retrieve such information and thus infringe clients’ privacy as well as disrupt smooth and effective operation of companies and organizations. CIA is an acronym for Confidentiality, Integrity, and Availability and is at the foundation of information security providing an organization with the skeleton for protection of data.</em></p><p>“Preservation of confidentiality, integrity and availability of information. Note: In addition, other properties, such as authenticity, accountability, non-repudiation and reliability can also be involved.” (ISO/IEC 27000:2018)<br><a href="https://en.wikipedia.org/wiki/Information_security">https://en.wikipedia.org/wiki/Information_security</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YMhYPebchts79eYVhk5ojw.jpeg" /><figcaption>Figure 1- image about CIA triad in cyber security -<a href="https://www.itgovernance.co.uk/blog/what-is-the-cia-triad-and-why-is-it-important"> https://www.itgovernance.co.uk/blog/what-is-the-cia-triad-and-why-is-it-important</a></figcaption></figure><h3>What is CIA Triad</h3><p>The CIA triad is one of the most important pillars of cybersecurity as it implements the guidelines for protecting information and the systems where it is stored. In three words of CIA represents Confidentiality, Integrity, and Availability . All these principles are significant and useful with regard to protection and maintenance of data and systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*mzgCTvuXV-ebJ7C-sGBdww.png" /><figcaption>Figure 2- image of CIA definition - <a href="https://www.coretelligent.com/blog/what-is-the-cia-triad-and-why-does-your-cybersecurity-position-depend-on-it/">coretelligent.com</a></figcaption></figure><p>Confidentiality:</p><p>This principle relates to protection of confidential information from people who ought not to have access to it. Keeping information confidential implies that data can only be viewed by people who are authorized to do so. Measures of ensuring confidentiality include methods such as, encrypting the information, limiting access to certain individuals and authenticating the persons who are allowed to access the information. Information security is another important concept that involves safeguarding of information from exposure to the wrong people.</p><p>Integrity:</p><p>Speaking of integrity, it refers to the ability to preserve data, making sure that it is not only correct, but also comprehensive. It avoids situation where information is changed or manipulated by other persons who are not supposed to do so. This principle is fundamental for maintaining credibility of the obtained data. Some of the approaches of verifying integrity can be achieved include hashing, use of digital signatures and use of checksums. Preserving data integrity avoids problems like data loss and unauthorized changes to be made to it. <br> <br>Availability:</p><p>Availability means the information and resources that are required at a specific time by authorized users, should be easily retrievable. This principle entails that systems should work efficiently and should be available despite situations like hacking, or system/computer breakdowns and so on. The methods that can be used in order to achieve the objective of availability are redundancy, fail-over systems and maintenance. Preserving reliability guarantees that services and information to consumers and the general public stays available.</p><h3>Why should you use CIA Triad</h3><p>The CIA triad Confidentiality, Integrity, and Availability is essential in cybersecurity and information security for several reasons<br> <br>First one is <strong>Comprehensive Framework.</strong> This is a feature of CIA triad is quite useful since it draws a circle round information security and enables us to address each of the four quadrants. Thus, confidentiality, integrity, and availability are the most crucial factors that should be taken into consideration so that organizations could protect data, exclude unauthorized users’ access or alteration, and provide data availability to authorized users if necessary. Second one is <strong>Risk Management</strong> . In this context therefore the CIA triad is useful in risk identification and management. This paper recommends risk assessments with regard to each component so that suitable security measures can be put in place to prevent impact that threatens the security of organizational information resources. Third one is <strong>Security Policy Development.</strong> CIA triad forms a basis for implementing security policies and measures. It leads the development of policies that secure data and adherence to the legal and regulatory standards. Fourth reason is <strong>Incident Response. </strong>Incident response instance in the case of a security breach, the CIA triad comes to assist in evaluating the consequences on confidentiality, integrity, and availability. This evaluation should commence shortly after the occurrence of an incident to facilitate correct handling and reporting of the case. <strong>Trust and Reliability is </strong>the principles of confidentiality, integrity and availability enhance confidence of the stakeholders such as customers, partners and even the employees. It increases the probability and assurance of organizational systems and services.</p><p><strong>Strategic Planning.</strong> CIA triad helps in positioning of cybersecurity investments for strategic planning. In this way, by focusing on confidentiality, integrity, and availability measures, it is possible to prioritize these measures and increase the overall effectiveness of the organization’s protection.</p><p>In general, the CIA triad is essential for any pragmatic message about information and information systems security because it describes a logically structured methodology and granulated set of advices on what should be protected and how it should be protected when it is under threats.</p><h3>When should you use CIA Triad</h3><ol><li><strong>Developing Security Policies</strong>: The CIA Triad is specifically useful in the field of security policy development or modification. Policies may be easily constructed focusing one by one on confidentiality, integrity and availability thus forming an organized approach.</li><li><strong>Risk Assessment and Management</strong>: With the assistance of the CIA Triad and the particular perspectives it offers, risk assessments become the tools to the identification and evaluation of the might-be risks and vulnerabilities to information assets. This contributes to the selection of proper security measures that are to be put into place to handle the risks faced.</li><li><strong>Designing and Implementing Systems:</strong> Throughout the whole process of building new information systems and installing software, the CIA Triad takes a central and starting point place in the sense that it ensures that security solutions are implemented from the beginning. The key measures to be taken here are data encryption (confidentiality), integrity validation, and the maintenance of the uptime of the system (availability).</li><li><strong>Incident Response Planning</strong>: Incident response planning is critically dependent on the CIA Triad. By thinking through how a privacy invasion might impact the confidentiality, integrity, and availability of data, companies can develop plans to minimize loss and recover even faster.</li><li><strong>Compliance and Auditing</strong>: There is a large number of regulatory frameworks and principles that call for adherence to precepts similar to those pertaining to the CIA Triad. Through the triad, organizations can be sure that they are adhering to the laws and standards, as well as of the fact that they will be able to show this during audits.</li><li><strong>Training and Awareness Programs</strong>: The knowledge of the CIA Triad among the employees may contribute to their being properly informed about the security of information a company wants to have. Training programs that highlight the importance of confidentiality, integrity, and availability can support security culture development within the organization.</li><li><strong>Evaluating Security Technologies:</strong> As they select and launch security technologies (e.g. firewalls, intrusion detection systems, and encryption tools), the CIA Triad provides them with a benchmark for deciding the effectiveness of these solutions in keeping the data safe.</li><li><strong>Continuous Monitoring and Improvement:</strong> The CIA Triad is beneficial to the regular security monitoring and enhancing the security of the biometric scanners as well. Through regular analysis of the performance of the current measures to protect data, confidentiality, integrity, and availability organizations can adjust to new threats and vulnerabilities.</li></ol><h3>Conclusion</h3><p><em>In summary, the CIA Triad is a vital structure to address complete safety of a company’s information. The framework aims to protect data and to cope with the security measures effectively that will help organizations to come up with a security policy that is both strong and guarantees the safety of their like organizations. The practice of information security is central in compliance, system design, and security technology evaluation, which promotes a secure environment and continuous development. The integration of the CIA Triad systems in the lifecycle of information ensures the protection, the reliability and the availability of critical data and thus increases the whole security reading of an organization.</em></p><h3>References</h3><ol><li><strong>What is the CIA Triad? Definition &amp; Examples in Cybersecurity-by The Coretelligent Team(June 2, 2022)<br></strong><a href="https://www.coretelligent.com/blog/what-is-the-cia-triad-and-why-does-your-cybersecurity-position-depend-on-it/">https://www.coretelligent.com/blog/what-is-the-cia-triad-and-why-does-your-cybersecurity-position-depend-on-it/</a></li><li><strong>Demystifying the CIA Triad: Why It’s Crucial for Cyber Security by </strong><a href="https://www.itgovernance.co.uk/blog/author/lirwin">Luke Irwin</a> (14th February 2023)<br><a href="https://www.itgovernance.co.uk/blog/what-is-the-cia-triad-and-why-is-it-important">https://www.itgovernance.co.uk/blog/what-is-the-cia-triad-and-why-is-it-important</a></li><li><strong>The CIA Triad (Confidentiality, Integrity, and Availability)</strong> <br>Blog Author — <a href="https://www.knowledgehut.com/blog/author/mrinal-prakash-2">Mrinal Prakash</a>, Published on 17th Jun, 2024<br>https://www.knowledgehut.com/blog/security/cia-in-cyber-security#what-is-cia-triad%C2%A0in-cyber-security?</li><li><strong>CIA triad (confidentiality, integrity and availability)</strong> By <a href="https://www.techtarget.com/contributor/Cameron-Hashemi-Pour">Cameron Hashemi-Pour</a><br><a href="https://www.techtarget.com/whatis/definition/Confidentiality-integrity-and-availability-CIA">https://www.techtarget.com/whatis/definition/Confidentiality-integrity-and-availability-CI</a>A</li><li><strong>Information security</strong> <a href="https://en.wikipedia.org/wiki/Information_security">https://en.wikipedia.org/wiki/Information_security</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dce86a9a8046" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>