<?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 Prosunjit Biswas on Medium]]></title>
        <description><![CDATA[Stories by Prosunjit Biswas on Medium]]></description>
        <link>https://medium.com/@prosun.csedu?source=rss-c2eff848b3fb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*nzfRKv74sMUxkQhU</url>
            <title>Stories by Prosunjit Biswas on Medium</title>
            <link>https://medium.com/@prosun.csedu?source=rss-c2eff848b3fb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 12:15:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@prosun.csedu/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[Understanding Kubernetes API & API Services]]></title>
            <link>https://medium.com/@prosun.csedu/visualizing-kubernetes-control-plane-1751467d5156?source=rss-c2eff848b3fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/1751467d5156</guid>
            <dc:creator><![CDATA[Prosunjit Biswas]]></dc:creator>
            <pubDate>Fri, 14 Nov 2025 07:35:24 GMT</pubDate>
            <atom:updated>2025-11-14T07:40:23.486Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iGJKqK6ewZCgDp17mGPe_w.png" /><figcaption>Image Source from <a href="https://www.mirantis.com/">https://www.mirantis.com/</a></figcaption></figure><h3>Control plane components overview</h3><p>A “vanilla” Kubernetes control plane consists of:</p><pre>| Component                                 | Role                                                                         |<br>| ----------------------------------------- | ---------------------------------------------------------------------------- |<br>| **kube-apiserver**                        | Front door for all Kubernetes API calls (from `kubectl`, controllers, etc.). |<br>| **etcd**                                  | Key-value store that persists the entire cluster state.                      |<br>| **kube-controller-manager**               | Runs background controllers (replica, node, endpoint, etc.).                 |<br>| **kube-scheduler**                        | Decides which node runs each Pod.                                            |<br>| **cloud-controller-manager** *(optional)* | Integrates with cloud providers for LoadBalancers, volumes, etc.             |</pre><h3>Viewing Components</h3><pre>kubectl get apiservices<br>kubectl get componentstatuses   # deprecated but shows basic health of apiserver, etcd, scheduler, controller-manager<br>kubectl get --raw &#39;/healthz?verbose&#39;</pre><h3>Viewing API Service Registration Objects:</h3><p>The <em>APIService</em> registration objects that tell the API-aggregation layer which API group/version is handled by which backend (either local kube-apiserver or an aggregated apiserver).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*HRjQ3Lne2TANeVVaKHlpQg.png" /><figcaption>Viewing</figcaption></figure><pre>| Column        | Meaning                                                                                                                                                                                                                                                                                                           |<br>| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |<br>| **NAME**      | The *API group and version* this registration covers. Examples:&lt;br&gt;• `v1.` = the *core* API group (Pods, Services, etc.)&lt;br&gt;• `v1.apps` = the `apps` group version&lt;br&gt;• `v1beta1.metrics.k8s.io` = the metrics API served by the metrics-server                                                                   |<br>| **SERVICE**   | Where the kube-apiserver proxies requests for that API.&lt;br&gt;• **`Local`** means the built-in apiserver handles it directly (no proxying).&lt;br&gt;• A value like `kube-system/metrics-server` means this group/version is handled by an **aggregated API server** registered via that Service (in the given namespace). |<br>| **AVAILABLE** | `True` if the apiserver is reachable and responded successfully during health checks. For `Local` entries it’s almost always True.                                                                                                                                                                                |<br>| **AGE**       | How long ago this APIService object was created (usually since cluster creation or when a controller installed its API).                                                                                                                                                                                          |</pre><h3>Viewing API Resources:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4RoohXn6bb4xP6KItdvNDw.png" /></figure><pre>| Column         | Meaning                                                                            |<br>| -------------- | ---------------------------------------------------------------------------------- |<br>| **NAME**       | The plural resource name you use in kubectl (e.g. `pods`, `deployments`).          |<br>| **SHORTNAMES** | Abbreviations (e.g., `po`, `svc`, `cm`).                                           |<br>| **APIVERSION** | The group/version that owns this resource (from those `APIService` registrations). |<br>| **NAMESPACED** | `true` means resources live inside namespaces; `false` means cluster-scoped.       |<br>| **KIND**       | The singular Kind used in manifests (`Pod`, `Deployment`, etc.).                   |</pre><h3><strong>API aggregation layer</strong></h3><p>When we send any REST request to the Kubernetes API (via kubectl, SDK, or controller), the request hits the <strong>kube-apiserver</strong>, which can handle it in one of three ways:</p><pre>| Type                                 | What serves it                                                  | Example `apiVersion`              | Path                            |<br>| ------------------------------------ | --------------------------------------------------------------- | --------------------------------- | ------------------------------- |<br>| **Core (built-in)**                  | The kube-apiserver binary itself (compiled-in storage/handlers) | `v1` (Pods, Services, ConfigMaps) | `/api/v1/...`                   |<br>| **CustomResourceDefinitions (CRDs)** | kube-apiserver’s *apiextensions-apiserver* module               | `mygroup.example.com/v1`          | `/apis/mygroup.example.com/...` |<br>| **Aggregated API servers**           | **External** apiservers registered via `APIService` objects     | e.g. `metrics.k8s.io/v1beta1`     | `/apis/metrics.k8s.io/...`      |</pre><p>All requests <em>always</em> start at kube-apiserver, but only the last category is <strong>forwarded (“aggregated”)</strong> through an APIService proxy to another backend.</p><p>When kube-apiserver receives a request like <em>GET /apis/metrics.k8s.io/v1beta1/pods, </em>it looks up the APIService with NAME = v1beta1.metrics.k8s.io:</p><ul><li>If that APIService has service: kube-system/metrics-server, kube-apiserver <strong>forwards</strong> the HTTP request internally to that Service.</li><li>It acts as a reverse proxy — it handles authentication/authorization/audit first, then proxies the REST request.</li></ul><p>An example of what goes through APIService (like reverse proxy)</p><pre>| Category        | Example                                           | Served by                              | Goes through APIService? |<br>| --------------- | ------------------------------------------------- | -------------------------------------- | ------------------------ |<br>| Core built-ins  | `api/v1` (Pods, Services)                         | kube-apiserver internal                | ❌                        |<br>| Built-in groups | `apps/v1`, `batch/v1`                             | kube-apiserver internal                | ❌                        |<br>| CRDs            | `mygroup.io/v1`                                   | apiextensions-apiserver (internal)     | ❌                        |<br>| Aggregated APIs | `metrics.k8s.io/v1beta1`, `elbv2.k8s.aws/v1beta1` | External service via aggregation layer | ✅                        |</pre><h3>Viewing Kubenetes raw API</h3><pre># Full OpenAPI v3 index<br>kubectl get --raw /openapi/v3 | jq<br><br># One group/version (e.g., Deployments)<br>kubectl get --raw /openapi/v3/apis/apps/v1 | jq<br><br># Core v1<br>kubectl get --raw /openapi/v3/api/v1 | jq</pre><p>Run kubectl proxy then browse to see the API definition:</p><ul><li><a href="http://127.0.0.1:8001/openapi/v3">http://127.0.0.1:8001/openapi/v3</a></li><li><a href="http://127.0.0.1:8001/openapi/v3/apis/apps/v1">http://127.0.0.1:8001/openapi/v3/apis/apps/v1</a></li></ul><p><strong>Get list of installed CRD</strong></p><pre># List CRDs<br>kubectl get crd<br><br># See the OpenAPI schema a CRD exposes<br>kubectl get crd &lt;crd-name&gt; -o yaml | yq &#39;.spec.versions[] | {name, schema: .schema.openAPIV3Schema}&#39;<br># Then:<br>kubectl explain &lt;kind&gt;.&lt;group&gt;   # e.g., kubectl explain certificaterequest.cert-manager.io</pre><p>Viewing Control Plane components</p><pre>kubectl get componentstatuses   # deprecated but shows basic health of apiserver, etcd, scheduler, controller-manager<br>kubectl get --raw &#39;/healthz?verbose&#39;</pre><p>Seeing the Cluster-info for cluster specific details:</p><pre>$ kubectl cluster-info<br><br>Kubernetes control plane is running at https://10.0.0.1:6443<br>CoreDNS is running at https://10.0.0.10:443<br><br>To further debug and diagnose cluster problems, use &#39;kubectl cluster-info dump&#39;.</pre><h3>CLI commands to explore deeper</h3><pre>| Task                                               | Command                                                  |<br>| -------------------------------------------------- | -------------------------------------------------------- |<br>| Show component health (older API)                  | `kubectl get componentstatuses`                          |<br>| Show API server health                             | `kubectl get --raw=&#39;/healthz?verbose&#39;`                   |<br>| Show metrics for control-plane pods (self-managed) | `kubectl top pod -n kube-system`                         |<br>| Describe a specific system pod                     | `kubectl -n kube-system describe pod kube-apiserver-*`   |<br>| Inspect static manifests                           | `sudo cat /etc/kubernetes/manifests/kube-apiserver.yaml` |</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1751467d5156" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[clang-tidy — gentle introd]]></title>
            <link>https://medium.com/@prosun.csedu/clang-tidy-gentle-introd-f05031975286?source=rss-c2eff848b3fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/f05031975286</guid>
            <dc:creator><![CDATA[Prosunjit Biswas]]></dc:creator>
            <pubDate>Thu, 11 Sep 2025 06:34:07 GMT</pubDate>
            <atom:updated>2025-09-11T06:34:07.701Z</atom:updated>
            <content:encoded><![CDATA[<h3>clang-tidy — gentle introduction</h3><h3>What is clang-tidy?</h3><ul><li>A <strong>“linter” and static analysis tool</strong> for C, C++, and Objective-C.</li><li>Part of the <strong>LLVM project</strong> (ships with clang/clang++).</li><li>Works directly with the <strong>compiler front-end</strong> — so it understands your code <em>the same way the compiler does</em>.</li></ul><p>Checks for:</p><ul><li>Bugs (null deref, use-after-move, uninitialized vars)</li><li>Style issues (naming, readability)</li><li>Security issues (CERT, MISRA, modernize checks)</li><li>Performance anti-patterns</li></ul><h3>⚙️ How does it work?</h3><ul><li>Clang-tidy needs to know <strong>exactly how your code is compiled</strong> (compiler, flags, includes).</li><li>That’s why you feed it compile_commands.json (like the one you generated with Bear).</li><li>It runs each file through Clang’s parser + analysis passes + “checks”.</li></ul><h3>🛠 Basic Usage</h3><p>Assume we already have compile_commands.json in your project root.</p><h3>1. Analyze one file</h3><pre>clang-tidy src/main.c -- -I./src -DDEBUG</pre><ul><li>-- separates clang-tidy’s own options from compiler options.</li><li>You rarely pass flags manually if you have compile_commands.json.</li></ul><h3>2. Use compile_commands.json</h3><pre>run-clang-tidy -p .</pre><ul><li>-p . → points to the directory with compile_commands.json.</li><li>This automatically runs the correct compile command per file.</li></ul><h3>3. Fix issues automatically</h3><pre>clang-tidy src/main.c -fix</pre><ul><li>Some checks (like modernizing loops) can auto-rewrite code.</li></ul><h3>✅ Example Output</h3><p>Say we have buggy code:</p><pre>int *p;<br>if (cond)<br>    p = new int(42);<br>*p = 5;</pre><p>Clang-tidy might warn:</p><pre>warning: Dereference of a pointer that may be null [clang-analyzer-core.NullDereference]</pre><p>This is a <strong>static bug detection</strong>, not just style.</p><h3>🔧 Configuring Checks</h3><ul><li>Checks are grouped and can be selected:</li></ul><pre>clang-tidy src/main.c -checks=&quot;clang-analyzer-*,modernize-*,performance-*&quot;</pre><ul><li>Example groups:</li><li>clang-analyzer-* → bug finding (null deref, memory leaks)</li><li>modernize-* → suggest modern C++ features</li><li>performance-* → performance smells</li><li>readability-* → code clarity</li><li>cert-*, cppcoreguidelines-*, misc-*, etc.</li><li>You can also configure in .clang-tidy YAML file at project root:</li></ul><pre>Checks: &#39;clang-analyzer-*,modernize-*,cert-*&#39;<br>WarningsAsErrors: [&#39;clang-analyzer-*&#39;]<br>HeaderFilterRegex: &#39;.*&#39;</pre><h3>📦 Integration</h3><ul><li><strong>Editors/IDEs</strong>: Many (VS Code, CLion, QtCreator) integrate clang-tidy to show issues as you type.</li><li><strong>CI/CD</strong>: Run it in pipelines with -export-fixes=fixes.yaml to collect results.</li><li><strong>SARIF</strong> export: Use clang-tidy -export-fixes + converters to integrate with GitHub security dashboards.</li></ul><h3>🔒 Security Relevance</h3><p>Clang-tidy can enforce:</p><ul><li><strong>CERT C/C++ coding rules</strong> (cert-*)</li><li><strong>C++ Core Guidelines</strong> (cppcoreguidelines-*)</li><li>Detects real security bugs like:</li><li>Null pointer dereference</li><li>Use of uninitialized memory</li><li>Dangerous casts</li><li>Resource leaks</li><li>It’s not a full SAST “enterprise product” like Coverity, but it’s great for <strong>early bug finding</strong> and <strong>developer training</strong>.</li></ul><h3>⚖️ Strengths vs. Limitations</h3><p><strong>Strengths</strong></p><ul><li>Free, open source, fast.</li><li>Deep compiler integration = fewer false positives.</li><li>Highly configurable.</li><li>Good for CI and dev workflows.</li></ul><p><strong>Limitations</strong></p><ul><li>Only analyzes one translation unit at a time (no full cross-project dataflow like Coverity).</li><li>Not focused on license compliance, SBOM, etc. (that’s SCA, not SAST).</li><li>Some security coverage is basic compared to enterprise SAST.</li></ul><p>✅ <strong>Summary</strong>:<br> Clang-tidy is like a <strong>power-up for your compiler</strong>: it understands your real build via compile_commands.json, runs tons of bug/security/style checks, and can even fix code. It’s widely used as the <strong>first line of static analysis</strong> before heavier tools like Coverity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f05031975286" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Compiling C Hello world project with Bear]]></title>
            <link>https://medium.com/@prosun.csedu/compiling-c-hello-world-project-with-bear-b74a20f3c858?source=rss-c2eff848b3fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/b74a20f3c858</guid>
            <dc:creator><![CDATA[Prosunjit Biswas]]></dc:creator>
            <pubDate>Thu, 11 Sep 2025 06:23:27 GMT</pubDate>
            <atom:updated>2025-09-11T06:23:27.132Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s go step by step with a tiny “Hello World” C project, and see how <strong>Bear</strong> captures the build info for SAST.</p><h3>📝 Step 1: Make a simple project</h3><p>Create a folder and two files:</p><pre>mkdir hello-c &amp;&amp; cd hello-c</pre><h3>src/main.c &amp; src/util.c</h3><pre>#include &quot;util.h&quot;<br>#include &lt;stdio.h&gt;<br>int main() {<br>    printf(&quot;Hello, %s!\n&quot;, get_name());<br>    return 0;<br>}</pre><pre>#include &quot;util.h&quot;</pre><pre>const char* get_name() {<br>    return &quot;World&quot;;<br>}</pre><h3>src/util.h</h3><pre>const char* get_name();</pre><h3>📝 Step 2: Create a simple Makefile</h3><h3>Makefile</h3><pre>CC = gcc<br>CFLAGS = -I./src -Wall -DDEBUG<br><br>all: hello<br><br>hello: src/main.o src/util.o<br> $(CC) $(CFLAGS) -o hello src/main.o src/util.o<br><br>clean:<br> rm -f src/*.o hello</pre><h4>This tells make to:</h4><ul><li>Compile each .c file with gcc and given flags (-I./src, -Wall, -DDEBUG)</li><li>Link them into an executable hello.</li></ul><h3>🛠 Step 3: Install Bear</h3><p>On Ubuntu/Debian:</p><pre>sudo apt-get install bear</pre><h3>🛠 Step 4: Build with Bear</h3><p>Instead of:</p><pre>make clean &amp;&amp; make</pre><p>Run:</p><pre>make clean<br>bear -- make</pre><p>Bear intercepts each call to gcc and records it.</p><h3>🔍 Step 5: Inspect compile_commands.json</h3><p>After running, you’ll see a file compile_commands.json.<br> Open it and you’ll find something like:</p><pre>[<br>  {<br>    &quot;directory&quot;: &quot;/home/user/hello-c&quot;,<br>    &quot;command&quot;: &quot;gcc -I./src -Wall -DDEBUG -c src/main.c -o src/main.o&quot;,<br>    &quot;file&quot;: &quot;src/main.c&quot;<br>  },<br>  {<br>    &quot;directory&quot;: &quot;/home/user/hello-c&quot;,<br>    &quot;command&quot;: &quot;gcc -I./src -Wall -DDEBUG -c src/util.c -o src/util.o&quot;,<br>    &quot;file&quot;: &quot;src/util.c&quot;<br>  }<br>]</pre><p>This file shows <strong>exactly how each source file was compiled</strong>.<br> Notice:</p><ul><li>-I./src (include path for headers)</li><li>-DDEBUG (macro definition)</li><li>-Wall (warning flags)</li></ul><h3>Use it with a SAST tool</h3><p>Now any static analyzer can reuse this:</p><ul><li><strong>Clang-Tidy</strong>:</li><li>run-clang-tidy -p .</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b74a20f3c858" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Security in CI/CD]]></title>
            <link>https://medium.com/@prosun.csedu/integrating-security-in-ci-cd-74b2e6335af2?source=rss-c2eff848b3fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/74b2e6335af2</guid>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[shiftleft]]></category>
            <dc:creator><![CDATA[Prosunjit Biswas]]></dc:creator>
            <pubDate>Sat, 31 May 2025 19:18:02 GMT</pubDate>
            <atom:updated>2025-05-31T19:22:17.464Z</atom:updated>
            <content:encoded><![CDATA[<h3>Integrating Security via CI/CD</h3><p><strong>Security integration into CI/CD (Continuous Integration/Continuous Deployment)</strong> — often referred to as <strong>DevSecOps</strong> — is about embedding security controls and best practices throughout the software delivery pipeline. Below is a detailed breakdown of what it involves:</p><h3>What Is Security Integration in CI/CD?</h3><p>It’s the practice of:</p><ul><li>Shifting security <strong>left</strong> (introducing it earlier in the software development lifecycle).</li><li>Automating security scans and checks within the pipeline.</li><li>Ensuring that every code commit, build, and deployment is <strong>secure by design</strong>.</li></ul><h3>Key Areas of Security Integration</h3><h4>1. Source Code Management (SCM) Security</h4><ul><li>Enforce signed commits and protected branches.</li><li>Scan pull requests for secrets and vulnerabilities using tools like Semgrep, TruffleHog, or GitLeaks.</li><li>Use <strong>code owners</strong> and mandatory reviews.</li></ul><h4>2. Static Application Security Testing (SAST)</h4><ul><li>Integrate tools like SonarQube, Semgrep, or Snyk into the CI pipeline to catch insecure coding patterns.</li></ul><h4>3. Software Composition Analysis (SCA)</h4><ul><li>Use tools like Snyk, Dependabot, or OWASP Dependency-Check to detect vulnerable third-party dependencies.</li><li>Set up policies for blocking builds with high-risk vulnerabilities.</li><li>Use EPSS Score and/or otherhigh signal threat intelligence to prioritize vulnerabilities.</li></ul><h4>4. Secrets Detection</h4><ul><li>Automatically detect hardcoded secrets or credentials in code.</li><li>Block commits or alert if secrets are found.</li></ul><h4>5. Infrastructure as Code (IaC) Scanning</h4><ul><li>Scan Terraform, CloudFormation, or Kubernetes manifests using tools like Checkov or tfsec for misconfigurations.</li></ul><h4>6. Dynamic Application Security Testing (DAST)</h4><ul><li>Automatically scan deployed environments using tools like OWASP ZAP or Burp Suite to detect runtime issues.</li></ul><h4>7. Container Security</h4><ul><li>Scan Docker images for vulnerabilities (e.g., with Docker Scout, Grype, or Trivy).</li><li>Enforce non-root containers and minimal base images.</li></ul><h4>8. Supply Chain Security</h4><ul><li>Mitigate dependency confusion by using internal artifact proxies.</li><li>Ensure dependency version is pinned.</li></ul><h4>9. Pipeline Hardening</h4><ul><li>Use least privilege for CI/CD service accounts.</li><li>Avoid exposing secrets as environment variables and Pipeline logs</li><li>Require approvals for deployment steps.</li><li>Use ephemeral environments where possible.</li></ul><h4>10. Monitoring &amp; Alerting</h4><ul><li>Log and monitor CI/CD activities.</li><li>Alert on suspicious behaviors (e.g., new CI job creating unauthorized infrastructure).</li></ul><p><strong>References:</strong></p><ol><li><a href="https://owasp.org/www-project-top-10-ci-cd-security-risks/">https://owasp.org/www-project-top-10-ci-cd-security-risks/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74b2e6335af2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Embedding Security in SDLC — Holistic View]]></title>
            <link>https://medium.com/@prosun.csedu/embedding-security-in-sdlc-holistic-view-85e4958b0e6e?source=rss-c2eff848b3fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/85e4958b0e6e</guid>
            <category><![CDATA[secure-sdlc]]></category>
            <dc:creator><![CDATA[Prosunjit Biswas]]></dc:creator>
            <pubDate>Tue, 13 May 2025 20:39:06 GMT</pubDate>
            <atom:updated>2025-05-13T20:39:42.136Z</atom:updated>
            <content:encoded><![CDATA[<h3>Embedding Security in SDLC — a Holistic View</h3><p>I was looking to know more about Embed Security into the Development process: Guide the incorporation of secure design practices throughout the SDLC, including architecture planning, secure coding, and deployment phases.</p><p>I Came up with this process with the help of GenAI tools and from my experience.</p><h3>Overview: Secure SDLC Phases</h3><p>Security should be <strong>proactive</strong>, not reactive. Here’s how to embed security across each SDLC phase:</p><h3>1. Requirements &amp; Planning</h3><p><strong>Goal:</strong> Identify security needs and risks early.</p><p>✅ <strong>Threat Modeling</strong>: Use STRIDE, DREAD, or LINDDUN to map out threats and data flows.</p><p>✅ <strong>Security Requirements</strong>: Define non-functional requirements (e.g., data must be encrypted at rest).</p><p>✅ <strong>Security SLAs</strong>: Agree on timelines for patching, fixing critical bugs, etc.</p><p>✅ <strong>Regulatory Compliance</strong>: Identify applicable standards (e.g., GDPR, HIPAA, PCI-DSS).</p><p>📌 <em>Security artifact:</em> Security requirements document.</p><h3>2. Design / Architecture</h3><p><strong>Goal:</strong> Integrate secure design patterns and avoid known architectural flaws.</p><p>✅ <strong>Security Design Review</strong>: Evaluate architecture against known principles (e.g., least privilege, defense in depth).</p><p>✅ <strong>Secure Architecture Patterns</strong>:</p><ul><li>Use zero-trust principles.</li><li>Ensure proper authentication flows (OAuth 2.0, OpenID Connect).</li><li>Plan for secure multi-tenancy, isolation, and encryption.</li></ul><p>✅ <strong>Abuse Case Analysis</strong>: Think like an attacker to preempt design flaws.</p><p>📌 <em>Security artifact:</em> Threat model and architecture review report.</p><h3>3. Implementation / Development</h3><p><strong>Goal:</strong> Promote secure coding practices and prevent introduction of vulnerabilities.</p><p>✅ <strong>Secure Coding Standards</strong> (e.g., OWASP Top 10, CWE/SANS):</p><ul><li>Input validation, output encoding</li><li>Proper session management</li><li>Safe use of cryptography APIs</li><li>✅ <strong>Secrets Management</strong>: Use vaults (e.g., HashiCorp Vault, AWS Secrets Manager).</li><li>✅ <strong>Static Code Analysis (SAST)</strong>: Automate scanning for common code-level issues.</li><li>✅ <strong>Code Reviews</strong>: Embed security checks in peer review checklists.</li></ul><p>📌 <em>Security artifact:</em> Secure code review checklist and SAST scan reports.</p><h3>4. Testing</h3><p><strong>Goal:</strong> Validate that security controls work and identify missed vulnerabilities.</p><ul><li>✅ <strong>Dynamic Application Security Testing (DAST)</strong>: Scan running app for OWASP Top 10 issues.</li><li>✅ <strong>Interactive Application Security Testing (IAST)</strong>: Combines SAST + DAST with runtime context.</li><li>✅ <strong>Manual Penetration Testing</strong>: For logic flaws and chained exploits.</li><li>✅ <strong>Fuzzing &amp; Negative Testing</strong>: Test for input handling and edge cases.</li><li>✅ <strong>Security Unit/Integration Tests</strong>: Automate tests for authZ/authN, crypto, error handling.</li></ul><p>📌 <em>Security artifact:</em> Security test report with risk-rated findings.</p><h3>5. Deployment / Release</h3><p><strong>Goal:</strong> Ensure the deployed environment is hardened and secure by default.</p><ul><li>✅ <strong>Infrastructure as Code (IaC) Security</strong>: Scan Terraform, CloudFormation, etc., for misconfigs.</li><li>✅ <strong>Secrets Rotation &amp; Injection</strong>: Avoid hardcoding in CI/CD; inject at runtime.</li><li>✅ <strong>Environment Hardening</strong>:</li><li>Least privilege IAM roles</li><li>Secure firewall/network configurations</li><li>Enforced HTTPS/TLS policies</li><li>✅ <strong>Secure Defaults</strong>: Disable debug modes, directory listing, verbose error messages.</li></ul><p>📌 <em>Security artifact:</em> Release security checklist and deployment verification results.</p><h3>6. Operations / Monitoring</h3><p><strong>Goal:</strong> Detect, respond to, and learn from security incidents.</p><ul><li>✅ <strong>Security Logging &amp; Monitoring</strong>:</li><li>Track login failures, privilege escalation, etc.</li><li>Centralize logs (e.g., ELK, Splunk) and apply alerting rules.</li><li>✅ <strong>Incident Response Plan (IRP)</strong>: Define roles, escalation paths, and playbooks.</li><li>✅ <strong>Patch Management</strong>: Automate patching of code and third-party dependencies.</li><li>✅ <strong>Security Metrics &amp; KPIs</strong>: Track vulnerability age, time to fix, # of open issues, etc.</li></ul><p>📌 <em>Security artifact:</em> Incident logs, threat detection dashboards, SLA reports.</p><h3>🔧 Tools and Practices to Support Embedded Security</h3><p>PhaseToolsRequirementsMicrosoft Threat Modeling Tool, OWASP Threat DragonCodingSemgrep, SonarQube, Checkmarx, CodeQLTestingBurp Suite, OWASP ZAP, OWASP Amass, fuzzersCI/CDGitHub Actions, GitLab CI + Trivy, Snyk, Prisma CloudDeploymentHashiCorp Vault, Terraform + tfsec, AWS ConfigMonitoringSplunk, ELK Stack, Datadog, AWS CloudTrail</p><h3>🔄</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85e4958b0e6e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scaling SSH Authentication: The Essential Role of SSH Certificates]]></title>
            <link>https://medium.com/@prosun.csedu/scaling-ssh-authentication-the-essential-role-of-ssh-certificates-f9fd0a0aeaa7?source=rss-c2eff848b3fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9fd0a0aeaa7</guid>
            <category><![CDATA[ssh-keys]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[ssh-authentication]]></category>
            <dc:creator><![CDATA[Prosunjit Biswas]]></dc:creator>
            <pubDate>Tue, 24 Dec 2024 02:42:55 GMT</pubDate>
            <atom:updated>2024-12-24T02:42:55.239Z</atom:updated>
            <content:encoded><![CDATA[<p>In this post, we will get into how SSH-client authenticates itself with the SSH server to establish a session. We will see the common approach of session establishment based on presence of client’s public key in “authorized_keys” on the service side, outline the scalability problem with this approach. Consequently, we will show how SSH certificate solve this problem with presence of a SSH certificate authority.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*pCAOuCRy-6hhoMM-gui2vg.jpeg" /></figure><p>Secure Shell (SSH) is a protocol used primarily for secure remote login and other secure network services over an insecure network. Here’s how the communication generally happens:</p><ol><li><strong>Connection Establishment</strong>:</li></ol><ul><li>The SSH client initiates a connection to the SSH server using the server’s IP address or hostname.</li><li>The server responds, and both parties exchange protocol versions.</li></ul><p><strong>2. Algorithm Negotiation</strong>:</p><ul><li>The client and server exchange lists of supported cryptographic algorithms, agreeing on the algorithms that will be used for the session (key exchange, encryption, MAC, etc.).</li></ul><p><strong>3. Key Exchange</strong>:</p><ul><li>The parties use the agreed key exchange algorithm to establish a shared session key. This key is used to encrypt the remainder of the session.</li></ul><p><strong>4. Authentication</strong>:</p><ul><li>The client attempts to authenticate itself. Common methods include password, public key, or certificate-based authentication.</li><li>For public key authentication, the client sends a signature created with the private key. The server checks this signature using the corresponding public key stored in its authorized_keys file.</li></ul><p><strong>5. Session Establishment:</strong></p><ul><li>Once authenticated, a secure channel is established. The client can now execute commands, transfer files, or forward ports securely.</li></ul><h3>Limitations of Using Client’s Public Key in authorized_keys File</h3><ul><li><strong>Scalability</strong>: As the number of users grows, managing a large authorized_keys file across multiple servers becomes cumbersome and error-prone.</li><li><strong>Key Rotation and Revocation</strong>: There is no easy mechanism to expire or revoke keys. If a key needs to be revoked, it must be manually removed from every authorized_keys file on every server.</li><li><strong>Security Risk</strong>: If a user’s private key is compromised, any server that has the corresponding public key in its authorized_keys file is at risk until the key is manually removed.</li></ul><h3>How Certificate Authority with Signed Certificate Solves These Problems</h3><ul><li><strong>Centralized Management</strong>: A single CA signs user keys. Servers only need to know the CA’s public key to verify any user certificate, simplifying management especially in large environments.</li><li><strong>Automatic Expiry</strong>: Certificates can be issued with an expiration date. This means keys automatically expire without needing manual revocation, enhancing security.</li><li><strong>Revocation Lists</strong>: CAs can manage certificate revocation lists (CRLs) to further enhance security. Servers can periodically check these lists to deny access even before certificates expire.</li></ul><h3>Real Use-Cases</h3><p><strong>Use-Case 1: Large Enterprise with Multiple Data Centers</strong></p><ul><li><strong>Problem</strong>: A global company with thousands of employees needs to manage access to hundreds of servers across multiple data centers.</li><li><strong>Solution</strong>: Implementing an SSH CA simplifies key management. Each server only needs to trust the CA, and user certificates can be centrally managed and automatically expire.</li></ul><p><strong>Use-Case 2: Dynamic Cloud Environment</strong></p><ul><li><strong>Problem</strong>: In cloud environments where servers are frequently spun up and down, managing authorized_keys can be highly dynamic and error-prone.</li><li><strong>Solution</strong>: Using SSH certificates allows for ephemeral access control where certificates can be issued as needed and automatically expire when no longer needed, without manual cleanup.</li></ul><p><strong>Use-Case 3: Compliance-Driven Industries</strong></p><ul><li><strong>Problem</strong>: Industries such as finance or healthcare require stringent auditing and control over who accesses what data and when.</li><li><strong>Solution</strong>: SSH certificates can include custom metadata such as the user’s role or department, enhancing audit capabilities and enforcing policy compliance through access controls embedded in the certificate.</li></ul><h3>Authentication Details and configuration using CA-Signed certificate:</h3><h4>Set Up an SSH Certificate Authority</h4><p>First, you need to create an SSH Certificate Authority. This can be done using standard SSH tools like ssh-keygen:</p><pre>ssh-keygen -f ssh_ca_key -t rsa -b 4096 -C &quot;SSH Certificate Authority&quot;</pre><p>This command generates a new SSH key pair (ssh_ca_key and ssh_ca_key.pub) that will act as your CA. The private key (ssh_ca_key) will be used to sign user and host keys, while the public key (ssh_ca_key.pub) will be distributed to servers.</p><h3>2. Distribute the CA Public Key</h3><p>Copy the CA’s public key (ssh_ca_key.pub) to all servers that will trust certificates signed by this CA. This key will be used by the SSH servers to verify the authenticity of certificates presented by clients.</p><h3>3. Configure SSH Server to Trust the CA</h3><p>On each server, you need to configure the SSH daemon to trust certificates signed by your CA. Modify the SSH daemon configuration file (/etc/ssh/sshd_config) to include the following line:</p><pre>TrustedUserCAKeys /etc/ssh/ssh_ca_key.pub</pre><p>Here, /etc/ssh/ssh_ca_key.pub is the path to the CA public key you distributed in the previous step. This tells the SSH server to trust any user certificate signed by the CA.</p><h3>4. Adjust Server Settings</h3><p>While editing /etc/ssh/sshd_config, consider disabling password authentication to increase security, especially if you’re now using a more secure certificate-based authentication method:</p><pre>PasswordAuthentication no  <br>ChallengeResponseAuthentication no</pre><p>Also, make sure to restart the SSH service to apply these changes:</p><pre>sudo systemctl restart sshd</pre><h3>5. Issue Certificates to Users</h3><p>You will now issue SSH certificates to your users. This is done using the private key of the CA:</p><pre>ssh-keygen -s ssh_ca_key -I user_identifier -n username -V +52w -z serial_number user_key.pub</pre><p>This command signs the user’s public key (user_key.pub) and creates a certificate valid for 52 weeks. The -I option specifies a unique identity for the certificate, -n specifies the principal (username), and -z provides a serial number for tracking.</p><h3>6. Client Configuration</h3><p>Users can now use their private key along with the newly issued certificate to authenticate. The SSH client configuration (typically ~/.ssh/config) might need to specify the use of the certificate:</p><pre>Host example.com  <br>    IdentityFile ~/.ssh/user_key  <br>    CertificateFile ~/.ssh/user_key-cert.pub</pre><p>Transitioning from traditional public key authentication to a CA-signed certificate approach significantly enhances the scalability, security, and manageability of SSH access, especially in large or dynamic environments. By centralizing trust and automating key expiration and revocation, organizations can achieve a higher level of security and compliance, streamline their operations, and reduce administrative overhead. This method</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9fd0a0aeaa7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SPDX License Expression with use-cases]]></title>
            <link>https://medium.com/@prosun.csedu/spdx-license-expression-with-use-cases-0e88befad812?source=rss-c2eff848b3fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/0e88befad812</guid>
            <category><![CDATA[spdx]]></category>
            <dc:creator><![CDATA[Prosunjit Biswas]]></dc:creator>
            <pubDate>Wed, 29 May 2024 05:18:26 GMT</pubDate>
            <atom:updated>2024-05-29T05:23:34.044Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="SPDX license expression" src="https://cdn-images-1.medium.com/max/1024/1*heq-4m6XQPSZufPI9ear2g.jpeg" /></figure><p>SPDX license expressions allow for a precise specification of the licensing terms for software components. They are used to communicate complex licensing arrangements in a standardized and machine-readable format. Here are some examples of SPDX license expressions along with use cases:</p><p>Simple License Identifier:</p><ul><li>Expression: MIT</li><li>Use case: A project is entirely licensed under the MIT License. The SPDX expression is straightforward and indicates a single license for the entire codebase.</li></ul><p>Dual Licensing:</p><ul><li>Expression: (GPL-3.0-or-later OR MIT)</li><li>Use case: A project can be used under the terms of either the GNU General Public License version 3.0 or later, or the MIT License, at the option of the user. This is common in projects that want to offer more flexibility to users or when combining code that is licensed under different terms.</li></ul><p>License With Exception:</p><ul><li>Expression: GPL-2.0-only WITH Classpath-exception-2.0</li><li>Use case: A software library is licensed under GPL-2.0-only, but it includes a Classpath exception that allows it to be linked to from non-GPL-licensed programs without causing them to be covered by the GPL. This is a common arrangement for libraries that want to ensure freedom to modify the library itself while allowing usage in a wider range of applications.</li></ul><p>Complex Licensing:</p><ul><li>Expression: (LGPL-2.1-only OR MIT) AND BSD-3-Clause</li><li>Use case: A software component is dual-licensed under LGPL-2.1-only or MIT, and there is additional software included that is licensed under the BSD-3-Clause License. This expression indicates that users must comply with both the terms of the BSD-3-Clause License and their choice of either LGPL-2.1-only or MIT.</li></ul><p>Optional Licensing:</p><ul><li>Expression: (GPL-3.0-or-later WITH Autoconf-exception-3.0) OR Apache-2.0</li><li>Use case: A project is primarily licensed under GPL-3.0-or-later with an additional Autoconf exception, which allows for more leniency when using Autoconf-generated scripts. Alternatively, users may choose to use the project under the terms of the Apache-2.0 License. This gives users the choice to select a license that best fits their use case.</li></ul><p>License Refinement:</p><ul><li>Expression: BSD-2-Clause AND (MIT AND NOT OFL-1.1)</li><li>Use case: A software project is licensed under the BSD-2-Clause License and includes components under the MIT License. However, it explicitly excludes components under the SIL Open Font License (OFL-1.1). This expression is used to provide a clear licensing boundary, especially when a certain license (in this case, OFL-1.1) is not suitable for the project’s licensing strategy.</li></ul><p>These examples show how SPDX license expressions can be used to define the licensing of software projects in a clear and concise manner. They are particularly useful when multiple licenses are involved, and they help ensure that users and contributors understand the licensing terms that apply to a project. SPDX license expressions are widely used in package managers, software bill of materials (SBOMs), license scanning tools, and other environments where precise license information is crucial.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0e88befad812" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Towards Creating Open Source Softtare Inventory for Open Source Program office]]></title>
            <link>https://medium.com/@prosun.csedu/towards-creating-open-source-softtare-inventory-for-open-source-program-office-32c58d01e55e?source=rss-c2eff848b3fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/32c58d01e55e</guid>
            <category><![CDATA[opensourceprogramoffice]]></category>
            <category><![CDATA[open-source-software]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Prosunjit Biswas]]></dc:creator>
            <pubDate>Thu, 04 Apr 2024 23:57:05 GMT</pubDate>
            <atom:updated>2024-04-05T00:00:48.100Z</atom:updated>
            <content:encoded><![CDATA[<h3>Towards Creating Open Source Software Inventory for Open Source Program office</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q-Vug6PubwaB5fGny1T1HA.jpeg" /></figure><p>Creating a Open Source Software Inventory and License Compliance data are one of fundamental requirements of Building Open Source Program Office (OSPO) initiative.</p><p>Having the Software Inventory and license compliance data, it can significantly improve an organization’s security posture in several ways.</p><p>In this article, I like to put together notes I was able to collect/rationalize by using Internet searching, talking to ChatGPT, using my practical experience and so on.</p><p><strong>Particularly I like to highlight:</strong></p><ol><li>Specific use-cases of OpenSource Software Inventory</li><li>Data to collect for making the Inventory</li><li>Possible ways to distribute Software Inventory data within organization (probably part of a second blog post)</li></ol><p>Here are the specific security aspects that can be enhanced, along with detailed use cases:</p><h3>1. Vulnerability Management</h3><p><strong>Use Case</strong>: An organization discovers that a widely-reported vulnerability in a popular open source library affects multiple applications across different departments. With a comprehensive OSS inventory, the security team can quickly identify which applications use the affected library and its version, and then prioritize patching based on which instances are exposed to the highest risk (e.g., internet-facing systems).</p><h3>2. Patch and Update Management</h3><p><strong>Use Case</strong>: Regular updates are crucial for security. An OSPO can use the inventory to track when an open source component is due for an update or patch. This ensures that the organization is not running outdated software with known vulnerabilities. For instance, when a new version of an open source web server software is released, the OSPO can ensure all instances are upgraded to maintain security posture.</p><h3>3. Incident Response</h3><p><strong>Use Case</strong>: In the event of a security breach, having an OSS inventory with license compliance data allows incident responders to quickly assess if any OSS components could be the attack vector. For example, if an application is compromised, responders can check the inventory for any OSS components with known vulnerabilities that may need immediate attention or isolation.</p><h3>4. Risk Assessment and Management</h3><p><strong>Use Case</strong>: Before deploying a new application, the OSPO can assess the risk profile of all included OSS components. If a particular component is found to have a poor security track record or lack of active maintenance, the organization can decide to use an alternative or allocate resources to contribute to its security.</p><h3>5. Compliance with Security Standards and Regulations</h3><p><strong>Use Case</strong>: Certain industry standards or regulations may require an organization to maintain a certain level of security for their software. By having a clear inventory of OSS components and their licenses, an organization can ensure that they are in compliance with standards such as PCI DSS, HIPAA, or GDPR, which may require strict data handling and security measures.</p><h3>6. License Compliance and Security Implications</h3><p><strong>Use Case</strong>: Some open source licenses have specific security-related requirements, such as the need to distribute source code or disclose modifications. An organization may inadvertently introduce security issues by not complying with these terms. For example, if a modified version of an OSS component with security enhancements is distributed without the corresponding source code, it could violate the license and potentially expose the organization to legal action or security risks.</p><h3>7. Supply Chain Security</h3><p><strong>Use Case</strong>: An organization is evaluating a new vendor for a software solution. By reviewing the OSS inventory and license compliance data, the organization can determine if the vendor’s solution includes OSS components with potential security issues or licensing that conflicts with the organization’s policies, thus preventing supply chain risks.</p><h3>8. Mergers and Acquisitions</h3><p><strong>Use Case</strong>: During the due diligence process of a merger or acquisition, a comprehensive OSS inventory can be used to evaluate the target company’s use of OSS and any associated security risks. This can influence the terms of the acquisition or identify areas that will require attention post-merger to maintain a strong security posture.</p><h3>9. Community Engagement and Security Contributions</h3><p><strong>Use Case</strong>: While engaging with the OSS community, an organization can use its inventory to identify critical projects that they rely on and contribute to their security. For example, by providing patches, funding, or other resources, the organization can help improve the security of open source projects that are vital to its operations.</p><p>Having an accurate and up-to-date Open Source Software Inventory and license compliance data enables organizations to proactively manage the security of their software environments. It allows them to make informed decisions, respond quickly to security incidents, comply with legal and regulatory requirements, and contribute to the overall health and security of the OSS ecosystem.</p><p>Given that Open Source Program office is able to service it’s usecases properly, when developing an Open Source Inventory, it’s important to collect comprehensive metadata to understand and manage the open source software (OSS) being used. Here is a list of common metadata fields that you might consider including in your inventory for each open source software component:</p><ol><li><strong>Software Name</strong>: The official name of the open source software.</li><li><strong>Version</strong>: The specific version of the software being used.</li><li><strong>License Type</strong>: The type of open source license (e.g., MIT, GPL, Apache) under which the software is released.</li><li><strong>License URL</strong>: The URL to the actual license text or to the license overview page.</li><li><strong>Download URL</strong>: The URL where the specific version of the software can be downloaded or the page where it is hosted.</li><li><strong>Repository URL</strong>: The URL to the source code repository (e.g., GitHub, GitLab, Bitbucket).</li><li><strong>Website</strong>: The main website or project page of the software.</li><li><strong>Description</strong>: A brief description of the software, including its purpose and key features.</li><li><strong>Dependencies</strong>: Information about any other open source components it depends on.</li><li><strong>Usage</strong>: Information about how and where the software is used within your organization or project.</li><li><strong>License Compliance</strong>: Notes on compliance with the software’s license terms.</li><li><strong>Vulnerabilities</strong>: Known security vulnerabilities, ideally linked to a database like CVE.</li><li><strong>Maintainers</strong>: The individuals or organization responsible for maintaining the software.</li><li><strong>Contributors</strong>: Names or handles of key contributors, if relevant.</li><li><strong>Documentation URL</strong>: Link to the software’s documentation.</li><li><strong>Release Date</strong>: The release date of the version being used.</li><li><strong>Last Commit Date</strong>: The date of the last commit (useful for assessing activity and maintenance levels).</li><li><strong>Build Instructions</strong>: Any special instructions required to build the software from source.</li><li><strong>Compliance Artifacts</strong>: Any relevant artifacts for legal or compliance purposes (e.g., Software Bill of Materials, scan results).</li><li><strong>Patch Information</strong>: Information about any patches or modifications made to the software by your organization.</li><li><strong>Integration Points</strong>: Information about how the OSS integrates with other systems or software in your environment.</li><li><strong>Risk Assessment</strong>: An assessment of potential risks associated with the use of the software.</li><li><strong>Operational Status</strong>: The current operational status of the software (e.g., active, deprecated).</li><li><strong>Support Information</strong>: Information about where to get support for the software.</li><li><strong>Notices</strong>: Any required notices that need to be displayed or distributed with the software.</li><li><strong>Contact Information</strong>: Contact information for the person or team within your organization responsible for the OSS component.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32c58d01e55e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Open Source Software Licenses]]></title>
            <link>https://medium.com/@prosun.csedu/understanding-open-source-software-licenses-85bd553d35aa?source=rss-c2eff848b3fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/85bd553d35aa</guid>
            <category><![CDATA[software-licensing]]></category>
            <category><![CDATA[open-source-software]]></category>
            <dc:creator><![CDATA[Prosunjit Biswas]]></dc:creator>
            <pubDate>Mon, 18 Mar 2024 00:19:11 GMT</pubDate>
            <atom:updated>2024-03-18T00:19:11.530Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*USocIAIhCO6OzVVLc-s-dQ.png" /></figure><p>Informally, Open source software is computer software that is available for anyone to use, modify, and share because its source code (the part of the software that programmers can manipulate) is openly accessible. It comes with a license that permits these actions and often encourages collaboration and sharing among users and developers.</p><p>More formally, Open source software (OSS) is defined by its license, which grants users the rights to freely access, modify, and distribute the source code. The term “open source” was coined in 1998 by the Open Source Initiative (OSI), which also established a formal definition and certification process for OSS licenses.</p><p>According to the OSI, a software license must meet the following criteria to be considered open source:</p><ol><li>Free Redistribution: The license shall not restrict any party from selling or giving away the software as a component of an aggregate software distribution containing programs from several different sources. The license shall not require a royalty or other fee for such sale.</li><li>Source Code: The program must include source code, and must allow distribution in source code as well as compiled form. Where some form of a product is not distributed with source code, there must be a well-publicized means of obtaining the source code for no more than a reasonable reproduction cost, preferably downloading via the internet without charge.</li><li>Derived Works: The license must allow modifications and derived works, and must allow them to be distributed under the same terms as the license of the original software.</li><li>Integrity of The Author’s Source Code: The license may restrict source-code from being distributed in modified form only if the license allows the distribution of “patch files” with the source code for the purpose of modifying the program at build time.</li><li>No Discrimination Against Persons or Groups: The license must not discriminate against any person or group of persons.</li><li>No Discrimination Against Fields of Endeavor: The license must not restrict anyone from making use of the software in a specific field of endeavor. For example, it should not restrict the software from being used in a business, or from being used for genetic research.</li><li>Distribution of License: The rights attached to the program must apply to all to whom the program is redistributed without the need for execution of an additional license by those parties.</li><li>License Must Not Be Specific to a Product: The rights attached to the program must not depend on the program’s being part of a particular software distribution. If the program is extracted from that distribution and used or distributed within the terms of the program’s license, all parties to whom the program is redistributed should have the same rights as those that are granted in conjunction with the original software distribution.</li><li>License Must Not Restrict Other Software: The license must not place restrictions on other software that is distributed along with the licensed software. For example, the license must not insist that all other programs distributed on the same medium must be open-source software.</li><li>License Must Be Technology-Neutral: No provision of the license may be predicated on any individual technology or style of interface.</li></ol><h3>Common Licenses</h3><p>The most common open source licenses can be broadly categorized into two groups based on their approach to copyright and redistribution: permissive licenses and copyleft licenses.</p><h3>Permissive Licenses</h3><p>These licenses are often referred to as “anything goes” because they impose minimal restrictions on the use and redistribution of licensed software. The most common permissive licenses include:</p><ol><li>MIT License (MIT): Simple and permissive, this license allows for almost unrestricted freedom with the software, provided that the original copyright and license notice is included with any substantial portion of the software. Example of Software under MIT license include jQuery, Node.js, .Net Core, React and so on.</li><li>Apache License 2.0 (Apache-2.0): Similar to the MIT License, but also provides an express grant of patent rights from contributors to users and protections against patent litigation. Examples include not surprisingly Apache Hadoop, Apache Kafka, Android OS, Apache Cassandra and so on.</li><li>BSD Licenses: There are several variants, including the 2-clause (FreeBSD) and 3-clause (New BSD) licenses. They are permissive licenses with minimal requirements regarding redistribution. The 3-clause license includes an additional non-endorsement clause. Again not surprisingly examples include FreeBSD, OpenBSD, Flask and so on.</li></ol><h3>Copyleft Licenses</h3><p>Copyleft licenses allow for the use, modification, and redistribution of software, but with the stipulation that the same rights be preserved in derivative works. The most common copyleft licenses include:</p><ol><li>GNU General Public License (GPL): The GPL family of licenses ensures that derivative works are also distributed under the same license terms. The GPL has several versions, with GPLv2 and GPLv3 being the most common.</li><li>GNU Lesser General Public License (LGPL): Similar to the GPL, but allows for the licensed software to be included in proprietary software under certain conditions. It is often used for software libraries.</li><li>GNU Affero General Public License (AGPL): An extension of the GPL that requires the source code to be made available when network users interact with the software, making it particularly relevant for web applications and services.</li></ol><p>Many well-known open-source projects are licensed under various versions of the GNU General Public License (GPL). Here are some notable examples: GNU Operating System Components, Linux Kernel, WordPress, VLC media player, GNU Bash, MySQL prior to being acquired by Oracle and so on.</p><h3>Other Notable Licenses</h3><ul><li>Mozilla Public License 2.0 (MPL-2.0): A weak copyleft license that allows for the combination of MPL-licensed code with proprietary code, provided that the MPL-licensed code remains under the MPL.</li><li>Eclipse Public License 1.0 (EPL-1.0) / 2.0 (EPL-2.0): These licenses allow for the distribution of derivative works under different licenses, provided that the source code is still made available under the EPL.</li><li>Creative Commons Licenses: While not typically used for software, Creative Commons licenses are often used for creative works such as images, music, and literature. The Creative Commons Zero (CC0) license is used to release works into the public domain.</li></ul><h3>OSS licenses are not exclusive</h3><p>These licenses are not mutually exclusive, and many open source projects may dual-license their software under multiple licenses to provide users with more flexibility. When choosing a license for a project, developers consider factors such as the intended use of the software, compatibility with other licenses, and whether they wish to require derivative works to also be open source.</p><h3>OSS license can change over time</h3><p>open source software can change its license over time, but this process can be complex and may involve legal and logistical challenges, especially for well-established projects with multiple contributors. For example, in 2017, Facebook decided to relicense these projects from the BSD + Patents License to the MIT License</p><h3>Failure to comply OSS license</h3><p>Failure to comply with the terms of an open source license can have several repercussions, both legal and reputational. If a company does not follow the terms of an open source license, they could face the both legal and reputational consequences.</p><p>For example, the copyright holders of the open source software may take legal action against the infringing party. This can result in court proceedings, and if the copyright holders prevail, the infringing company may be required to cease distribution of the infringing software, provide an accounting of profits made from the infringement.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85bd553d35aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is PolynomialFeatures and it’s use in Scikit library?]]></title>
            <link>https://medium.com/@prosun.csedu/polynomialfeatures-is-a-preprocessing-tool-provided-by-the-scikit-learn-library-in-python-that-is-84118adea049?source=rss-c2eff848b3fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/84118adea049</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[skikit]]></category>
            <dc:creator><![CDATA[Prosunjit Biswas]]></dc:creator>
            <pubDate>Sat, 16 Mar 2024 17:55:16 GMT</pubDate>
            <atom:updated>2024-03-16T18:02:37.881Z</atom:updated>
            <content:encoded><![CDATA[<h4>PolynomialFeatures is a preprocessing tool provided by the scikit-learn library in Python that is used to generate polynomial and interaction features from the given set of input features. It&#39;s part of the sklearn.preprocessing module.</h4><p>Polynomial regression is a form of regression analysis where the relationship between the independent variable x and the dependent variable y is modeled as an nth degree polynomial. PolynomialFeatures is used to generate such polynomial terms from the original features.</p><h3>When to Use PolynomialFeatures:</h3><ol><li>Non-linear Relationships: When the relationship between the dependent and independent variables is suspected to be non-linear, polynomial features can help capture this non-linearity.</li><li>Interaction Effects: PolynomialFeatures can also include interaction terms (features that are products of two or more individual features), which can help capture the interaction effects between variables.</li><li>Improving Model Performance: Sometimes, including polynomial features can improve the performance of a machine learning model by providing additional information that a linear model wouldn’t capture.</li></ol><h3>Basic Usage:</h3><p>Here’s a basic example of using PolynomialFeatures:</p><pre>from sklearn.preprocessing import PolynomialFeatures  <br>   <br># Sample data  <br>X = [[0, 1], [2, 3], [4, 5]]  <br>   <br># Create an instance of PolynomialFeatures with degree=2  <br>poly = PolynomialFeatures(degree=2)  <br>   <br># Transform the data, generating polynomial features  <br>X_poly = poly.fit_transform(X)  <br>   <br>print(X_poly)</pre><p>This will output:</p><pre>[[ 1.  0.  1.  0.  0.  1.]   # 1, x1, x2, x1^2, x1*x2, x2^2  <br> [ 1.  2.  3.  4.  6.  9.]  <br> [ 1.  4.  5. 16. 20. 25.]]</pre><p>The transformed feature matrix X_poly contains the original features plus the squared terms and the interaction term.</p><h3>Parameters:</h3><ul><li>degree: The degree of the polynomial features. Default is 2.</li><li>interaction_only: If set to True, only interaction features are produced: features that are products of at most degree distinct input features, but no powers of individual features.</li><li>include_bias: If set to True (default), then include a bias column (feature in which all polynomial powers are zero, which is equivalent to a column of ones).</li></ul><h3>Advanced Usage:</h3><ul><li>Handling Higher Degrees: As the degree of polynomial features increases, the number of features can grow exponentially. This may lead to a high-dimensional feature space and can cause models to overfit. Regularization techniques like Ridge or Lasso can be used to counteract this.</li><li>Pipelines: PolynomialFeatures is often used within a pipeline to ensure that feature transformation is applied consistently during both the training and testing phases.</li><li>Scaling: Polynomial features can lead to very large feature values, so feature scaling (e.g., using StandardScaler) is often necessary when using polynomial features.</li><li>Sparse Matrices: For sparse input data, PolynomialFeatures can output sparse matrices by setting the parameter sparse_output=True.</li></ul><p>Here’s an example of using PolynomialFeatures within a pipeline with scaling and a regression model:</p><pre># Split the data into training and test sets  <br>X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)  <br>  <br># Create a pipeline  <br>model = Pipeline([  <br>    (&#39;polynomial_features&#39;, PolynomialFeatures(degree=2)),  <br>    (&#39;standard_scaler&#39;, StandardScaler()),  <br>    (&#39;ridge_regression&#39;, Ridge())  <br>])  <br>  <br># Train the model  <br>model.fit(X_train, y_train)  <br>  <br># Predict and evaluate the model  <br>y_pred = model.predict(X_test)  </pre><p>In this pipeline, PolynomialFeatures generates polynomial and interaction features, StandardScaler scales the features, and Ridge is the regression model that includes regularization to prevent overfitting.</p><p>In summary, PolynomialFeatures is a powerful tool that allows linear models to fit a wider range of data but should be used with caution to avoid overfitting and manage computational complexity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84118adea049" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>