<?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 Younes Kejji on Medium]]></title>
        <description><![CDATA[Stories by Younes Kejji on Medium]]></description>
        <link>https://medium.com/@younes-kejji?source=rss-ab2535640540------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*yOes08L0sLDLCd6H.jpg</url>
            <title>Stories by Younes Kejji on Medium</title>
            <link>https://medium.com/@younes-kejji?source=rss-ab2535640540------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 06:51:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@younes-kejji/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[Security shift left DevSecOps, SecDevOps …]]></title>
            <link>https://medium.com/ocp-digital-factory/security-shift-left-devsecops-secdevops-778ed55c59a3?source=rss-ab2535640540------2</link>
            <guid isPermaLink="false">https://medium.com/p/778ed55c59a3</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Younes Kejji]]></dc:creator>
            <pubDate>Fri, 11 Nov 2022 20:06:54 GMT</pubDate>
            <atom:updated>2022-11-11T20:06:54.144Z</atom:updated>
            <content:encoded><![CDATA[<h3>Security shift left DevSecOps, SecDevOps …</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MgRIrijY1reKwo_VBkugQw.png" /></figure><p>DevSecOps is a culture, practices and tools which aim to shift security left from early stages and during the entire Software Development Lifecycle.</p><p>Okey, We all know that security is important, but why bother shifting Security left instead of doing it at the end of the cycle as we usually do?</p><ul><li>It helps everyone in the team understand security requirements, think, design with security in mind and collaborate proactively with security teams</li><li>Vulnerabilities are identified at early stages: Cost and impact on companies’ reputation is much higher if issues are detected on production or lately.</li><li>Security checks are automated to prevent or reduce human errors</li><li>Collaboration and communication between teams are improved which speeds up the delivery iterations.</li></ul><h3>DevSecOps Culture:</h3><p>When implementing <strong>DevSecOps</strong> culture we should <strong>break the silos</strong> between <strong>Development</strong>, <strong>Security</strong> and <strong>Operations</strong> teams and make them collaborate and share responsibility to <strong>achieve a common goal</strong> (building and delivering value to end-users).</p><p>In addition, <strong>all stakeholders should be aware of the impacts and risks of security vulnerabilities</strong> with general awareness sessions. And more detailed training should be set up for each role within the team (common security features and requirements for product owners, common security vulnerabilities, how to fix them and secure programming for tech teams …)</p><h3>DevSecOps Practices:</h3><p><strong>- Knowledge</strong></p><p>The organization should encourage everyone to deliver open security dojos and sharing sessions.</p><p>Detailed Training should be scheduled and provided by internal and external experts in different security areas.</p><p>Security awareness is not limited to tech teams; business teams should be well trained to take security into account when expressing their needs and testing the increments and delivered product.</p><p><strong>- Process Guardrails</strong></p><p>Some interesting checks could be set during SDL process:</p><ul><li>In the <strong>Definition of ready,</strong> it would be interesting to check that access controls, resource ownership and security specifications are provided. And maintaining a list of common security user stories and risky feature will be very helpful.</li><li><strong>Code review</strong> practice should consider security concerns. We will discuss different tools in the next section, but they should be there as complement to human checks.</li><li>In the <strong>Definition of done</strong>, we should check that security tools (SAST, Dependency check …) didn’t raise any vulnerabilities, and all security risks are mitigated.</li></ul><p><strong>- Security Champion</strong></p><p>In the beginning of DevSecOps implementation it’s interesting to have a role of security champion. A security champion is a tech team member having security skills and real interest on different security challenges, its role mainly is to smoothly bridge the gaps Dev-Sec and Sec-Ops. The successful DevSecOps implementation is the vanishment of this role and at the same time everyone is becoming a security champion.</p><p><strong>- Observability</strong></p><p>Observability pillars should be enhanced with security aspects (Security logs, metrics, and data analysis/visualization)</p><h3>DevSecOps Tools</h3><p>Tools help automate security checks to avoid or reduce human errors. Some tools are used on developers’ machines, others on the pipeline at different stages and others on deployment environments.</p><p>Owasp web site is a great index of different tools, and every organization should choose the rights tools according to their own specifications.</p><p><a href="https://owasp.org/www-community/Free_for_Open_Source_Application_Security_Tools"><em>https://owasp.org/www-community/Free_for_Open_Source_Application_Security_Tools</em></a></p><p>Hereinafter some good open source alternatives to commercial tools:</p><p><strong>SonarLint</strong></p><p><strong>SonarQube</strong> (SAST is performed in addition to code quality)</p><p><strong>OWASP ZAP </strong>one of the most popular web apps security scanning (DAST)</p><p><strong>Dependency check</strong> (An implementation example in the pipeline will be detailed in the next article)</p><p><strong>Dependency Track</strong> (An implementation example in the pipeline will be detailed in the next article)</p><p><strong>NPM Audit Resolver </strong>(js dependency scanning tool)</p><p><strong>Clair</strong> for docker images scanning</p><h3>And</h3><p><strong>Security doesn’t end with development lifecycle</strong>; security audits and checking for vulnerable and out-dates dependencies should continue.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=778ed55c59a3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ocp-digital-factory/security-shift-left-devsecops-secdevops-778ed55c59a3">Security shift left DevSecOps, SecDevOps …</a> was originally published in <a href="https://medium.com/ocp-digital-factory">OCP digital factory</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enable remote debugging Spring Boot apps on Kubernetes]]></title>
            <link>https://medium.com/ocp-digital-factory/enable-remote-debugging-spring-boot-apps-on-kubernetes-e300be064477?source=rss-ab2535640540------2</link>
            <guid isPermaLink="false">https://medium.com/p/e300be064477</guid>
            <category><![CDATA[intellij]]></category>
            <category><![CDATA[jvm]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Younes Kejji]]></dc:creator>
            <pubDate>Wed, 10 Feb 2021 15:44:25 GMT</pubDate>
            <atom:updated>2021-02-10T15:44:25.890Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*RobMerxdzHVa2GgFD6vXnQ.png" /></figure><p>Debugging in software development is one of the techniques involved in the identification of a problem in a program.<br><em>(Tracing and Static analysis of the source code are other common techniques)</em></p><p>In this Article, I’ll be focusing on remote debugging Java Spring boot applications from IntelliJ IDE, but still useful for other JVM based applications and IDEs.</p><h3>JVM Remote debugging:</h3><p>Remote debugging is very useful to locate errors on running applications. It allows to attach the IDE (source code) with the application process.<br>Then let us set breakpoints to temporary suspend our app’s execution and watch variable values, execution paths …</p><p>In order to remotely debug the target application, we should follow two steps:</p><p><strong>- Enable debug agent in server mode on our application; by running it with extra params:</strong></p><pre>java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -jar app.jar</pre><p><strong>- Attach our IDE with exposed debug agent server:</strong></p><p>From IntelliJ IDE, create new remote Run/Debug configuration and set the appropriate Host and port:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*sXX-6gbsUGjQAt_J7gNnfg.png" /></figure><blockquote>NB: Make sure that the firewall is allowing access to the specified port.</blockquote><h3>JVM Remote debugging on Kubernetes:</h3><p>On Kubernetes we need to overcome two challenges:</p><p><strong>1 - Application is running on a docker container:<br></strong>So we need to adjust our docker file in order to enable debug agent server:</p><pre>FROM ${BASE_IMAGE}<br>ARG JAR_FILE<br>RUN addgroup appli &amp;&amp; adduser appli -D -G appli<br>WORKDIR /home/appli<br>COPY ${JAR_FILE} app.jar<br>RUN chown -R appli:appli /home/appli<br>USER appli<br>ENTRYPOINT [ “sh”, “-c”, “java $JAVA_OPTS -jar app.jar” ]</pre><p>We could directly use following Entrypoint:</p><pre>ENTRYPOINT [ “sh”, “-c”, “java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -jar app.jar” ]</pre><p>But that makes us rebuild the docker image for enabling/disabling the remote debugging. And using a variable give us a real flexibility for enabling other cool JVM features, such as <strong>VisualVM</strong>.</p><p><strong>2 - Second challenge is accessing the debug agent server from the IDE:</strong></p><p>Therefore, we first need to expose the debug agent port “<strong>5005</strong>” as containerPort in kubernetes manifest:</p><pre>spec:<br>  containers:<br>    env:<br>      - name: &quot;JAVA_OPTS&quot;<br>        value: &quot;-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005&quot;<br>    ...<br>    ports:<br>      ...<br>      - containerPort: 5005</pre><blockquote>Note, our environment variable “<strong>JAVA_OPTS</strong>” is set to the appropriate value.</blockquote><p>Now to access the exposed port from our local machine, we have two options:</p><p><strong>- Using port-forward:</strong></p><pre>kubectl port-forward <em>our-app-pod-name</em> 5005:5005</pre><p>Then from our IDE connect to host “<strong>localhost</strong>” and port “<strong>5005</strong>”</p><p><strong>- Using a Service NodePort:</strong></p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: appservice<br>spec:<br>  type: NodePort<br>  selector:<br>    app: app<br>  ports:<br>  - name: debug-agent<br>    protocol: TCP <br>    port: 5005<br>    nodePort: 30055<br>    targetPort: 5005</pre><p>Then from our IDE connect to host “<strong>node-IP</strong>” and port “<strong>30055</strong>”.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e300be064477" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ocp-digital-factory/enable-remote-debugging-spring-boot-apps-on-kubernetes-e300be064477">Enable remote debugging Spring Boot apps on Kubernetes</a> was originally published in <a href="https://medium.com/ocp-digital-factory">OCP digital factory</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ReactJs Environment variable in Kubernetes]]></title>
            <link>https://medium.com/ocp-digital-factory/reactjs-environment-variable-in-kubernetes-1f680b8d7e49?source=rss-ab2535640540------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f680b8d7e49</guid>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[environment-variables]]></category>
            <category><![CDATA[configmap]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[Younes Kejji]]></dc:creator>
            <pubDate>Tue, 09 Feb 2021 21:06:28 GMT</pubDate>
            <atom:updated>2021-02-09T22:14:09.147Z</atom:updated>
            <content:encoded><![CDATA[<h3>ReactJs Environment variables in Kubernetes</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*Y0GCy7BeRtiiIxVXMv0Z7Q.png" /></figure><p>Let’s say you are working on a reactjs web application deployed on Kubernetes. The app needs some configuration (e.g. url of analytics server, clientId, redirectUrl … for oAuth …).</p><p>Somewhere in the application you are supposed to define config variables. One way is creating a config file « appConfig.js » and its content could look like :</p><pre>var appConfig = {<br> OAUTH_CLIENT_ID: ‘myappoauthclientid’,<br> OAUTH_REDIRECT_URI: ‘<a href="https://myapp.com/">https://myapp.com/</a>‘,<br> ANALYTICS_URL: ‘<a href="https://live.analytics.com/">https://live.analytics.com</a>’,<br>…<br> };</pre><p>That’s fine, but what if the application is deployed on three different environments (staging, preproduction and production) and the configuration is not the same on each env?</p><p>To deal with this situation, I’ll be presenting three approaches. The first one is at build time, second one at runtime but in a static way and the last one (my favorite) is also at runtime but dynamic way.</p><h3>1- Build-Time :</h3><p>The first approach is really simple, the goal is to generate a different app for each environment. This can be achieved by :<br>- Maintaining 3 branches and each with appropriate content of the file « appConfig .js » : the problem with this option is that Merge/Pull requests between branches is not smooth (we should avoid overriding configs from other environments)<br>- Inject process.env variables during build process and define values in the ci/cd descriptor.</p><h3>2- Runtime / static:</h3><p>In this approach, the config file will contain values for all environments, then according to a variable (most common is hostname) we decide which variable to use:</p><p>config:</p><pre>var appConfig = {<br> OAUTH_CLIENT_ID_PROD: ‘myPRODappoauthclientid’,<br> OAUTH_REDIRECT_URI_PROD: ‘<a href="https://myapp.com/">https://myapp.com/</a>‘,<br> ANALYTICS_URL_PROD: ‘<a href="https://live.analytics.com/">https://live.analytics.com</a>’,<br> OAUTH_CLIENT_ID_PREP: ‘myPREPappoauthclientid’,<br> OAUTH_REDIRECT_URI_PREP: ‘<a href="https://prep.myapp.com/">https://prep.myapp.com/</a>‘,<br> ANALYTICS_URL_PREP: ‘<a href="https://prep.analytics.com/">https://prep.analytics.com</a>’,<br> OAUTH_CLIENT_ID_STAGING: ‘mySTAGINGappoauthclientid’,<br> OAUTH_REDIRECT_URI_STAGING: ‘<a href="https://staging.myapp.com/">https://staging.myapp.com/</a>‘,<br> ANALYTICS_URL_SATGING: ‘<a href="https://staging.analytics.com/">https://staging.analytics.com</a>’,<br>…<br> };</pre><p>Application code:</p><pre>const hostname = window &amp;&amp; window.location &amp;&amp; window.location.hostname;<br>let ANALYTICS_URL = “<a href="https://defaultanalytics/">https://defaultanalytics</a>&quot;;<br>//check undefined ….<br> if (hostname.indexOf(“myapp-staging.com”) &gt;= 0) {<br> ANALYTICS_URL = appConfig.ANALYTICS_URL_STAGING;<br> }else if (hostname.indexOf(“myapp-preprod.com”) &gt;= 0) {<br> ANALYTICS_URL = appConfig.ANALYTICS_URL_PREPROD;<br> }else if (hostname.indexOf(“myapp.com”) &gt;= 0) {<br> ANALYTICS_URL = appConfig.ANALYTICS_URL_PROD;<br> }<br>}</pre><p><strong>Cons:</strong><br><em>- Changing hostnames and variable values leads to a new version of the app.<br>- packing unnecessary information in the app</em></p><h3>3- Runtime / Dynamic (using k8s configmaps):</h3><p>The idea here is to use the same app container and according to the environment we inject the right variables using configmaps.<br>The application will load the js file « appConfig.js » but the content is provisioned (mount) through volume configmap.</p><p>The ConfigMap for staging env looks like this:</p><pre>apiVersion: v1<br>kind: ConfigMap<br>metadata:<br> name: myapp-cm-file<br> namespace: myapp<br>data:<br> appConfig.js: |<br> var appConfig = {<br> OAUTH_CLIENT_ID: ‘mySTAGINGappoauthclientid’,<br> OAUTH_REDIRECT_URI: ‘<a href="https://staging.myapp.com/">https://staging.myapp.com/</a>‘,<br> ANALYTICS_URL: ‘<a href="https://staging.analytics.com/">https://staging.analytics.com</a>’<br> };</pre><p>In the k8s deployment descriptor we mount the previous configMap in the folder config of nginx html location.</p><p><strong>NB</strong>:<em> Location should be set according to docker base image (nginx, apache, …)</em></p><pre>…</pre><pre> containers:<br> — name: front-myapp<br>   image: docker/front-myapp:latest<br>   volumeMounts:<br>     — mountPath: /usr/share/nginx/html/config<br>       name: config-files<br>   ports:<br>   — name: http<br>     containerPort: 80<br> volumes:<br>   — configMap:<br>       defaultMode: 420<br>       name: myapp-cm-file<br>       optional: true<br>     name: config-files</pre><p>Now let’s import the config script in the index.html file:</p><pre>…</pre><pre>&lt;link rel=”icon” href=”/favicon.ico” /&gt;<br> &lt;title&gt;My App&lt;/title&gt;<br> &lt;script src=”/config/adfs-configs.js”&gt;&lt;/script&gt; <br> &lt;/head&gt;</pre><pre>&lt;body&gt;</pre><p>To access/use the variables, all we need to do is getting them from window object:</p><pre>…<br>let ANALYTICS_URL = window?.appConfig?.ANALYTICS_URL;<br>…</pre><p>One more step, useful for local environment is creating a default appConfig.js file in the <em>&lt;source_main_dir&gt;/config/</em> folder. And make sure the the file is exposed (not packed).</p><p>Local config file:</p><pre>const appConfig = {<br> “OAUTH_CLIENT_ID”: “mySTAGINGappoauthclientid”,<br> “OAUTH_REDIRECT_URI”: “<a href="https://staging.myapp.com/">https://staging.myapp.com/</a>&quot;,<br> “ANALYTICS_URL”: “<a href="https://staging.analytics.com/">https://staging.analytics.com</a>&quot;<br>};</pre><pre>/* istanbul ignore next */<br>module.exports = appConfig;</pre><p><strong>In case of webpack</strong>:</p><pre>webpack.base.babel.js</pre><pre>module.exports = options =&gt; ({​<br>…</pre><pre>externals: {<br> appConfig: JSON.stringify(require( path.resolve(‘app/config/appConfig.js’))), //eslint-disable-line<br> },</pre><pre>});</pre><blockquote><strong>Caution : Do never inject secrets in js/html</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f680b8d7e49" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ocp-digital-factory/reactjs-environment-variable-in-kubernetes-1f680b8d7e49">ReactJs Environment variable in Kubernetes</a> was originally published in <a href="https://medium.com/ocp-digital-factory">OCP digital factory</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>