<?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 astrialyanda on Medium]]></title>
        <description><![CDATA[Stories by astrialyanda on Medium]]></description>
        <link>https://medium.com/@alyandaastri19?source=rss-2fcf70a781ba------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by astrialyanda on Medium</title>
            <link>https://medium.com/@alyandaastri19?source=rss-2fcf70a781ba------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 00:56:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alyandaastri19/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[Monitoring your App]]></title>
            <link>https://medium.com/@alyandaastri19/monitoring-your-app-b10c2fd15bed?source=rss-2fcf70a781ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/b10c2fd15bed</guid>
            <category><![CDATA[sentry]]></category>
            <category><![CDATA[monitoring]]></category>
            <dc:creator><![CDATA[astrialyanda]]></dc:creator>
            <pubDate>Tue, 27 May 2025 11:31:49 GMT</pubDate>
            <atom:updated>2025-05-28T02:46:23.845Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AxYpQppQRYOBLoMM.png" /><figcaption><a href="https://sentry.io/welcome/">https://sentry.io/welcome/</a></figcaption></figure><p>Developing an application, your main target probably would be having a functional application. But sometimes, there are cases that you may have not meet yet, creating future bug. But, how can you make sure your app’s users would report errors to you? And how would you know what kind of error they are facing if they didn’t explain it to you? That is why we need to do monitoring on our app.</p><p>There are many tools you can use to monitor your app. Monitoring tools that are being used in my web app are Sentry and Grafana. In this blog, I will tell you how to use Sentry to monitor your web app.</p><h4>Installing Sentry</h4><p>Beginning your software development journey with sentry, of course you should start by installing Sentry on your software. In the project I’m currently doing, I’m using a dockerized django project.</p><ol><li><strong>Add sentry in your </strong>requirements.txt.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*ZtYbQkGvHRVbRSGzsILVIw.png" /><figcaption>sentry in requirements.txt</figcaption></figure><p>By adding this, if you docker script contains installing requirements, sentry will also get installed inside your project container.</p><p><strong>2. Configure sentry in your project’s</strong> settings.py.</p><pre>import sentry_sdk<br><br>sentry_sdk.init(<br>    dsn=&quot;https://6a8dcfed4d3ad26ac6760477325e73c6@o4509231174385664.ingest.us.sentry.io/4509231175892992&quot;,<br>    # Add data like request headers and IP for users,<br>    # see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info<br>    send_default_pii=True,<br>    # Set traces_sample_rate to 1.0 to capture 100%<br>    # of transactions for tracing.<br>    traces_sample_rate=1.0,<br>    # Set profile_session_sample_rate to 1.0 to profile 100%<br>    # of profile sessions.<br>    profile_session_sample_rate=1.0,<br>    # Set profile_lifecycle to &quot;trace&quot; to automatically<br>    # run the profiler on when there is an active transaction<br>    profile_lifecycle=&quot;trace&quot;,<br>)</pre><p>Basically, this configuration is the place for you to set your sentry. For example dsn is the link that will connect your local project with your sentry project.</p><p><strong>3. Testing the Sentry in your App</strong></p><p>To make sure that Sentry is already set properly in your app, you can try creating a trigger error function in your app.</p><pre>from sentry_sdk import capture_exception<br><br>def trigger_error():<br>    try:<br>        1 / 0  # Intentional division by zero error<br>    except ZeroDivisionError as e:<br>        capture_exception(e)</pre><p>Then, don’t forget to create the url to access the Sentry dashboard.</p><pre>from django.urls import path<br>from .views import trigger_error<br><br>urlpatterns = [<br>    path(&quot;sentry-debug/&quot;, trigger_error),<br>]</pre><p>Then, the error will be displayed in the Sentry dashboard by accessing /sentry-debug/ endpoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AHeptj233LNHZyy9uDmwnw.jpeg" /><figcaption>sentry dashboard</figcaption></figure><h4>Utilizing Sentry on your App</h4><p>Sentry catches error from your app. One example that Iencountered from my app is this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jzdcnfhRjJdgmYHq" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d_Dbz_MD5P6u72o5" /><figcaption>one of the errors sentry catches</figcaption></figure><p>The error that sentry shows is ValueError exception when the program trying to execute the send_mail line. Sentry also states that the crash happened outside the app, precisely happened at django/core/mail/message.py in sanitize_address. With this being told, It makes me know that the problem I have to solve is not on my django app.</p><p>For send_mail function to works properly, the app needs to have proper SMTP configuration. And because in this project it uses a custom SMTP server, which the server manager is not me since I am one of the app developer, I contacted the client, who has the server manager contact for more information regarding SMTP configuration.</p><p>With information regarding SMTP being given, and SMTP configuration being fixed inside the server environment, the problem is now handled. Now, the program can send email successfully without triggering error. Therefore, the problem can be reviewed as solved.</p><h4>More Sentry Insights</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UGoAo8YQ7b-s8FmM.png" /><figcaption>dashboard metrics</figcaption></figure><p>Sentry can shows you many things, not just catches your app’s errors. Here are other features that is shown on the dashboard metrics in your Sentry:</p><ul><li><strong>Environment and time range filter</strong>. Filter your error logs by your environment and time range choice.</li><li><strong>Crash free sessions</strong>. Shows percentage of user experiencing a crash free session while using the app. Can be used as app’s stability indicator.</li><li><strong>Number of releases. </strong>Shows how many releases are being made in the project.</li><li><strong>Apdex (Application Performance Index). </strong>Calculate app’s performance by response time. Can be used as performance indicator.</li><li><strong>Failure rate. </strong>Shows failed transactions.</li><li><strong>Transactions Per Minute (TPM). </strong>Shows how many transactions are happening in the app. Can be used to measure future server upgrade.</li><li><strong>Number of Errors. </strong>Shows number of errors happened in a specific time range.</li><li><strong>Number of Sessions.</strong> Shows sessions opened in a specific time range.</li><li><strong>Number of Transactions. </strong>Shows transaction happened in a specific time range.</li></ul><h4>Benefits</h4><p>You may be lazy too apply monitoring. But actually, there are many benefits you can get by applying monitoring tools on your software such as:</p><ul><li>Early detection of issues. Handle issues right when the error occurs to prevent even more users experiencing the error.</li><li>Performance optimization. Monitoring tools also gives insights about your app’s performance, which may indicates bottlenecks, resource usage, or load time needed.</li><li>User experience insights. We can track when users experience errors, times users access the app a lot, etc.</li></ul><p>And probably even more benefits. That’s all I can pour in this blog, Thank You!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b10c2fd15bed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nielsen’s 10 Usability Heuristics on your Application]]></title>
            <link>https://medium.com/@alyandaastri19/nielsens-10-usability-heuristics-on-your-application-1266027cadef?source=rss-2fcf70a781ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/1266027cadef</guid>
            <category><![CDATA[nielsen-heuristics]]></category>
            <category><![CDATA[ui]]></category>
            <dc:creator><![CDATA[astrialyanda]]></dc:creator>
            <pubDate>Tue, 27 May 2025 04:49:14 GMT</pubDate>
            <atom:updated>2025-06-04T10:45:02.305Z</atom:updated>
            <content:encoded><![CDATA[<p>Making an application is not just about coding a great, complex, cool, groundbreaking application. Making an app, there should be a target user. And talking about user, we should design an app that satisfies our user.</p><p>One way to ensure your user’s experience in your application is good is by designing your app following the Nielsen’s 10 Usability Heuristics. Nielsen’s 10 Usability Heuristics contains general principles for interaction design. The principles are being used to for user to have a good experience while able reaching the app’s goal clearly and efficiently.</p><p>In this blog, I will show you my implementation of Nielsen’ 10 Usability Heuristics in my app. While designing my app’s user interface, I am following and using the design system that has already made previously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Wb6lIngjHZzP8fNR" /><figcaption>my team’s design system</figcaption></figure><p>In this blog, I will be talking about the user interface for the Input Detil Program KP app. Below is the general user interface design of the app:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hbG3Vm4nEa44miDYwLVv4w.png" /><figcaption>input detil program user interface design</figcaption></figure><h4>1. Visibility of System Status</h4><blockquote>The design should always keep users informed about what is going on, through appropriate feedback within a reasonable amount of time.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*b2ZHB4XdGGYhAuLJ5n1lFA.png" /></figure><p>By the time user wants to submit the inputs, the user will click the Submit button. When the user clicks the button, the system may need some time behind the scene to process. While the process going on, the Submit button will get darker in color as well changes its display into ‘Loading…’ to tell the user that the system is working on it.</p><h4>2. Match Between the System and the Real World</h4><blockquote>The design should speak the users’ language. Use words, phrases, and concepts familiar to the user, rather than internal jargon. Follow real-world conventions, making information appear in a natural and logical order.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kXpuS1TDkRzb4iy1owtnVw.png" /></figure><p>Using icon shaped like an actual calendar to show user that this section is to fill dates.</p><h4>3. User Control and Freedom</h4><blockquote>Users often perform actions by mistake. They need a clearly marked “emergency exit” to leave the unwanted action without having to go through an extended process.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kmL6bE-ysSoPbrY-EpnOGQ.png" /></figure><p>Adding a clear button to clear every inputs that haven’t been submitted. This way, user has their emergency exit, cancelling things that they have done.</p><h4>4. Consistency and Standards</h4><blockquote>Users should not have to wonder whether different words, situations, or actions mean the same thing. Follow platform and industry conventions.</blockquote><p>One implementation to follow the industry convention is by using navigation bar that is placed on top of the page. The website logo on the navbar can also get clicked to redirect user to the home page. For more consistency, as a whole website, all apps using the same design system, creating consistency and standards.</p><h4>5. Error Prevention</h4><blockquote>Good error messages are important, but the best designs carefully prevent problems from occurring in the first place. Either eliminate error-prone conditions, or check for them and present users with a confirmation option before they commit to the action.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*Sp_JSXk_ngPfNPUM7ROZQQ.png" /></figure><p>Preventing error by showing user that some fields aren’t to be filled, as well restricting it from external edit. This way, user can’t change some permanent fields which may cause data error if they happen to change it.</p><h4>6. Recognition Rather than Recall</h4><blockquote>Minimize the user’s memory load by making elements, actions, and options visible. The user should not have to remember information from one part of the interface to another. Information required to use the design (e.g. field labels or menu items) should be visible or easily retrievable when needed.</blockquote><p>Using calendar icon for date input so user can recognize what is the field for without actually having to recall. Not making unfamiliar icons that may make user confused.</p><h4>7. Flexibility and Efficiency of Use</h4><blockquote>Shortcuts — hidden from novice users — may speed up the interaction for the expert user so that the design can cater to both inexperienced and experienced users. Allow users to tailor frequent actions.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WgY1ASBAwHdN3-ozO5yweQ.png" /></figure><p>With a navigation bar, user can be flexibly switching pages. Navbar menus are all the main or higher priority features of the website, and all clickable to redirect user to their designated page.</p><h4>8. Aesthetic and Minimalist Design</h4><blockquote>Interfaces should not contain information that is irrelevant or rarely needed. Every extra unit of information in an interface competes with the relevant units of information and diminishes their relative visibility.</blockquote><p>Using only necessary icons and shapes for the input detil page. Also, using the design system that is created by consideration to aesthetics. Making it simple yet understandable.</p><h4>9. Help Users Recognize, Diagnose, and Recover from Errors</h4><blockquote>Error messages should be expressed in plain language (no error codes), precisely indicate the problem, and constructively suggest a solution.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*huR1NFqaOUrk0oV0lgsRKQ.png" /></figure><p>Error messages are shown in the field that contains the error, as well explains the error in human readable language.</p><h4>10. Help and Documentation</h4><blockquote>It’s best if the system doesn’t need any additional explanation. However, it may be necessary to provide documentation to help users understand how to complete their tasks.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*-OWPQk143KIrYf2wq67htQ.png" /></figure><p>There are some statuses for user’s registration. Some user may not understand what does that status means. So, there is a legend placed below clock to explain what does the statuses means.</p><h4>Benchmarking</h4><p>Making a design do need some inspiration. Therefore, this design is made by following some <strong>benchmarks</strong>. Some benchmarks that is being used for this design is:</p><p><strong>scele.cs.ui.ac.id</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*4BjBHSIjSOsl5EzLUOIOnQ.png" /><figcaption>scele’s clock</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*mx--64lsZGI82rVQ1WovMQ.png" /><figcaption>constant/permanent information</figcaption></figure><p>Scele is a web app used for Fasilkom UI students, lecturers and management staff for almost all of academic process. Each role of scele users has their own task. But then, there are some features that can be used globally, such as navigation bar, clock and information box.</p><p>In the app I am developing, the target roles are pretty much the same as the scele. It also used to handle a part of academic process, but one that is not covered by scele yet, and use cases are pretty different from scele hence made into a separate web app. But generally, as an information system just like scele, some features can be reused. For this case, features that will be used benchmarking from scele are the the permanent info and clock box in the side of the page.</p><p>Scele uses clock and display it on the right side of their page. Below the clock, in another box, scele shows some information. Following this benchmark, I am displaying the clock and information on the right side of the page. This way, I can show the user about the web app’s clock as well some information regarding the page.</p><p>The clock is used to show the web app server time. Both scele and my app involves submitting requirements that have deadlines. And deadlines are not flexible. Therefore, server clock display is necessary. In case where user is not in the same time zone as the server, the clock displayed in the web app still shows the server time so user has a reference for time to the deadline.</p><p>Next is the information box. In scele, the box shows information that can be accessed globally. Using this as a benchmark with a modification, for my app the information section will be used to display legend information about statuses that are used in the page.</p><p>Following the benchmarks for this app is beneficial as it supports the use case’s needs. The placement of the benchmarks also makes it easy for the users to see without polluting the page too much.</p><p><strong>Google forms</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/419/0*1wsp16lEmtDf4Meb.png" /><figcaption><a href="https://community.make.com/t/google-form-response-not-mapping-all-values/12519">https://community.make.com/t/google-form-response-not-mapping-all-values/12519</a></figcaption></figure><p>Google form is widely known and used for digital form needs. It fulfill the necessary requirements for a form, as well serves many kinds of fields. Fields in Google forms include label input, checkbox, radiobutton, and many more. It is pretty much the common display for a digital form, with fields supporting many kinds of needs. Therefore, it is used globally by many people for form usage.</p><p>The input detil use case needs the user to input data. Therefore, forms. Forms is needed for user to input many kinds of data in once. Following the common display of a digital form is necessary to apply consistency and standards. Confusing user over complicated input interface won’t be a good user experience. Following benchmark, the fields that being taken for my app are label field, paragraph field, and date/time field.</p><p>Other than the fields for inputting data, the benchmark also serves a clear button, that will clear the input that user already fills without submitting yet. It is necessary to apply user’s freedom principle. Therefore, it is also being taken into the app.</p><p>There are things to consider while making design for your app. For example, following the Nielsen’s 10 Usability Heuristics may guide you to make a better user interface. Using the help from a couple of benchmarks can also give you a brief picture of how your page will be. This way, we can create a web app that gives user a good experience.</p><h4>Reference</h4><p><a href="https://sis.binus.ac.id/2021/05/26/kenali-10-usability-heuristics-pada-desain-user-interface/">https://sis.binus.ac.id/2021/05/26/kenali-10-usability-heuristics-pada-desain-user-interface/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1266027cadef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting your Django Deployed]]></title>
            <link>https://medium.com/@alyandaastri19/getting-your-django-deployed-f68297f91eb8?source=rss-2fcf70a781ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/f68297f91eb8</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[deployment]]></category>
            <dc:creator><![CDATA[astrialyanda]]></dc:creator>
            <pubDate>Mon, 26 May 2025 10:04:47 GMT</pubDate>
            <atom:updated>2025-06-04T14:16:46.338Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*2LwWkriuMhB0Mm8y9jFt-w.png" /><figcaption>deployed software example</figcaption></figure><p>Deployment is one of the main steps in the software development life cycle. Without deployment being made, our software can’t get utilized properly by the target users. We can’t even perform user testing nor present it properly to the stakeholders. That is why, business-wise, deploying your software sure is important.</p><p>There are many tools that can be used to support your software deployment. In this blog, I will be writing about the deployment that is being done for my current project, a dockerized django project. For this project, I will also use GitLab CI to deploy the software to the server. And for the database system, I will be using postgreSQL.</p><h4>Setting up your Docker</h4><p>For this project, I will be using at least two containers. One for the django app, which i named sikp-be, and one for the postgreSQL database, which I named postgres. Handling multiple containers at once, I’ll be using docker-compose. Compose is used to define the multi-containers. Compose usage promotes compatibility as well rapid application development. If the service is not changed, we can used the previously cached containers. We can just restart the containers.</p><ol><li><strong>Write your</strong> Dockerfile<br>Dockerfile is is the file containing the instructions for building the docker image.</li></ol><pre>FROM python:3.10-slim-buster<br><br>WORKDIR /sikp-be<br><br>ENV PYTHONUNBUFFERED=1 \<br>    PYTHONPATH=/sikp-be \<br>    DJANGO_SETTINGS_MODULE=kpbackend.settings \<br>    PORT=8000 \<br>    WEB_CONCURRENCY=2<br><br># Install system packages required for Django and debugging<br>RUN apt-get update --yes --quiet &amp;&amp; \<br>    apt-get install --yes --quiet --no-install-recommends \<br>    curl &amp;&amp; \<br>    curl -fsSL https://deb.nodesource.com/setup_18.x | bash - &amp;&amp; \<br>    apt-get install --yes --quiet nodejs &amp;&amp; \<br>    rm -rf /var/lib/apt/lists/* &amp;&amp; \<br>    addgroup --system django &amp;&amp; \<br>    adduser --system --ingroup django django<br><br># Install Python dependencies<br>COPY ./requirements.txt /requirements.txt<br>RUN pip install --no-cache-dir -r /requirements.txt<br><br># Copy project code<br>COPY . . <br><br># Install and build Tailwind (using django-tailwind), collect static files and set permissions<br>RUN python manage.py tailwind install &amp;&amp; \<br>    python manage.py tailwind build &amp;&amp; \<br>    chown -R django:django /sikp-be<br><br>USER django<br><br># Apply database migrations and start the app<br>CMD [&quot;sh&quot;, &quot;-c&quot;, &quot;python manage.py migrate &amp;&amp; python manage.py collectstatic --noinput &amp;&amp; exec gunicorn kpbackend.wsgi:application --workers $WEB_CONCURRENCY --bind 0.0.0.0:$PORT&quot;]</pre><p>This Dockerfile shows that the image is build using python 3.10 image. It also shows that the working directory is /sikp-be. It also sets the environment following above. It then install system packages as well copying requirements.py and install the python dependencies. Then, copy the current directory . in the project to the workdir .. For addition as my project uses tailwind, so tailwind installation also included. And the last one, apply python migration as well start the app.</p><p>2. <strong>Set your </strong>docker-compose.yml<br>Here, we will define the containers that will be used for the software.</p><pre>version: &quot;3.8&quot;<br><br>services:<br>  sikp-be:<br>    build:<br>      context: ./<br>      dockerfile: Dockerfile<br>    ports:<br>      - &quot;8000:8000&quot;<br>    depends_on:<br>      - postgres<br>    networks:<br>      - app-network<br>    environment:<br>      DB_NAME: $DB_NAME<br>      DB_USER: $DB_USER<br>      DB_PASSWORD: $DB_PASSWORD<br>      DB_HOST_LOCAL: $DB_HOST_LOCAL<br>      DB_PORT: 5432<br>    volumes:<br>      - static_volume:/sikp-be/staticfiles  # Mounts static files<br><br>  postgres:<br>    image: postgres:latest<br>    volumes:<br>      - pgdata:/var/lib/postgresql/data<br>    ports:<br>      - &quot;5435:5432&quot;<br>    environment:<br>      POSTGRES_DB: $DB_NAME<br>      POSTGRES_USER: $DB_USER<br>      POSTGRES_PASSWORD: $DB_PASSWORD<br>    networks:<br>      - app-network<br><br>volumes:<br>  pgdata:<br>  static_volume:<br><br>networks:<br>  app-network:<br>    driver: bridge</pre><p>Here, inside the services is the containers that are being used in the project. For this project I am currently using sikp-be container for the django project and postgres for the database. Here are the break downs of the compose file:</p><ul><li>environment is used to set the environment variables into the container. It is often used to read database credentials. Keeping the credentials private, we can use local .env file or using repository variables.</li><li>ports maps port that from our host machine to the port inside the container, making it accessible through it.</li><li>depends-on ensure that the container inside it starts before the container that depends on it. For this example, depends-on in the sikp-be container makes sure that the postgre container is started before sikp-be container starts.</li><li>volume is used to store the software’s static files inside the container.</li><li>networks is used to bridge the connection between containers. On that compose file, the bridge connection is user-defined named app-network. The bridge type is chosen as it is recommended for a standalone setup as well to support local development.</li></ul><p>Why making it in this setup? The app is currently only using a single server for all needs such as project deployment, database, as well SMTP. Therefore, standalone setup can be done. This project also is not in the structure of microservices. Thus, using a single CI script is sufficient to deploy the whole app.</p><h4>Create CI Script</h4><p>For this project, since I am using GitLab as the project repository, I am using GitLab CI to deploy my project to the server. This CI script is not only used to build and deploy, but also to run steps such as testing and pushing project into quality assurance tool server such as Sonarqube.</p><pre>stages:<br>  - unit_test<br>  - sonarqube<br>  - build<br>  - deploy<br><br>image: <br>    name: sonarsource/sonar-scanner-cli:11<br>    entrypoint: [&quot;&quot;]<br><br>variables:<br>  DOCKER_REPO: &quot;docker.io/$DOCKERHUB_USERNAME/sikp-be&quot;  <br>  DOCKER_DRIVER: &quot;overlay2&quot;<br>  DOCKER_HOST: &quot;tcp://docker:2375&quot;<br>  DOCKER_TLS_CERTDIR: &quot;&quot;<br>  SONAR_USER_HOME: &quot;${CI_PROJECT_DIR}/.sonar&quot;  # Defines the location of the analysis task cache<br>  GIT_DEPTH: &quot;0&quot;  # Tells git to fetch all the branches of the project, required by the analysis task<br><br>unit_test:<br>  stage: unit_test<br>  image: python:3.12  <br>  services:<br>    - name: postgres:16<br>    - selenium/standalone-chrome<br>  variables:<br>    DATABASE_URL: &quot;postgres://$DB_USER:$DB_PASSWORD@postgres:5432/$DB_NAME&quot;<br>    DB_HOST: &quot;postgres&quot;<br>    POSTGRES_DB: $DB_NAME<br>    POSTGRES_USER: $DB_USER<br>    POSTGRES_PASSWORD: $DB_PASSWORD<br>  before_script:<br>    - apt-get update<br>    - python -m venv env<br>    - source env/bin/activate<br>    - pip install --no-cache-dir -r requirements.txt<br>  before_script:<br>    - apt-get update<br>    - python -m venv env<br>    - source env/bin/activate<br>    - pip install --no-cache-dir -r requirements.txt<br><br>  script:<br>    - python manage.py makemigrations --noinput database <br>    - python manage.py migrate --noinput<br>    - coverage run --source=&#39;.&#39; manage.py test<br>    - coverage xml  # Generate XML report for SonarQube<br>  artifacts:<br>    paths:<br>      - coverage.xml  # Preserve coverage.xml for next stage<br>    expire_in: 1h  <br><br><br>sonarqube:<br>  stage: sonarqube<br>  cache:<br>    policy: pull-push<br>    key: &quot;sonar-cache-$CI_COMMIT_REF_SLUG&quot;<br>    paths:<br>      - &quot;${SONAR_USER_HOME}/cache&quot;<br>      - sonar-scanner/     <br>  script: <br>    - sonar-scanner -Dsonar.host.url=&quot;${SONAR_HOST_URL}&quot; -Dsonar.python.coverage.reportPaths=coverage.xml<br>  allow_failure: true<br><br>build_staging:<br>  stage: build<br>  image: docker:20.10.16<br>  services:<br>  - name: docker:20.10.16-dind<br>    command: [&quot;--tls=false&quot;]<br>  before_script:<br>  - unset DOCKER_HOST<br>  - docker login -u &quot;$DOCKERHUB_USERNAME&quot; -p &quot;$DOCKERHUB_PASSWORD&quot;<br>  script:<br>    - docker build --pull -t $DOCKER_REPO:staging-$CI_COMMIT_SHA .<br>    - docker push $DOCKER_REPO:staging-$CI_COMMIT_SHA<br>  only:<br>    - staging<br><br>build_production:<br>  stage: build<br>  image: docker:20.10.16<br>  services:<br>  - name: docker:20.10.16-dind<br>    command: [&quot;--tls=false&quot;]<br>  before_script:<br>  - unset DOCKER_HOST<br>  - docker login -u &quot;$DOCKERHUB_USERNAME&quot; -p &quot;$DOCKERHUB_PASSWORD&quot;<br>  script:<br>    - docker build --pull -t $DOCKER_REPO:latest .<br>    - docker push $DOCKER_REPO:latest<br>  only:<br>    - main<br><br>deploy_staging:<br>  stage: deploy<br>  image: docker:20.10.16<br>  services:<br>  - name: docker:20.10.16-dind<br>    command: [&quot;--tls=false&quot;]<br>  before_script:<br>  - unset DOCKER_HOST<br>  - apk upgrade &amp;&amp; apk add openssh sshpass<br>  script:<br>  - |<br>    sshpass -p &quot;$SSH_PASSWORD&quot; ssh -o StrictHostKeyChecking=no ${SERVER_USER}@${SERVER_HOST} &quot;bash -c \<br>    &#39;docker login -u \\$DOCKERHUB_USERNAME -p \\$DOCKERHUB_PASSWORD &amp;&amp; \<br>    docker pull \\$DOCKER_REPO:staging-$CI_COMMIT_SHA &amp;&amp; \<br>    docker stop sikp-be-staging || true &amp;&amp; \<br>    docker rm sikp-be-staging || true &amp;&amp; \<br>    docker system prune -af &amp;&amp; \<br>    docker create -p 8001:8000 -e ENV=staging -e CI_COMMIT_SHA=$CI_COMMIT_SHA --env-file .env --name sikp-be-staging -v /staging/staticfiles:/sikp-be/staticfiles -v /staging/media:/sikp-be/media \\$DOCKER_REPO:staging-\\$CI_COMMIT_SHA &amp;&amp; \<br>    docker start sikp-be-staging &amp;&amp; \<br>    docker cp .env sikp-be-staging:.env &amp;&amp; \<br>    docker exec sikp-be-staging python manage.py makemigrations --noinput database &amp;&amp; \<br>    docker exec sikp-be-staging python manage.py migrate --noinput &amp;&amp; \<br>    docker exec sikp-be-staging python manage.py seed_staging &amp;&amp; \<br>    sudo systemctl restart nginx&#39;&quot;<br>  only:<br>  - staging<br><br>deploy_production:<br>  stage: deploy<br>  image: docker:20.10.16<br>  services:<br>  - name: docker:20.10.16-dind<br>    command: [&quot;--tls=false&quot;]<br>  when: manual<br>  before_script:<br>  - unset DOCKER_HOST<br>  - apk upgrade &amp;&amp; apk add openssh sshpass<br>  script:<br>  - |<br>    sshpass -p &quot;$SSH_PASSWORD&quot; ssh -o StrictHostKeyChecking=no ${SERVER_USER}@${SERVER_HOST} &quot;bash -c \<br>    &#39;docker login -u \\$DOCKERHUB_USERNAME -p \\$DOCKERHUB_PASSWORD &amp;&amp; \<br>    docker pull \\$DOCKER_REPO:latest &amp;&amp; \<br>    docker stop sikp-be || true &amp;&amp; \<br>    docker rm sikp-be || true &amp;&amp; \<br>    docker system prune -af &amp;&amp; \<br>    docker create -p 8000:8000 -e ENV=production -e CI_COMMIT_SHA=$CI_COMMIT_SHA --env-file .env --name sikp-be -v /prod/staticfiles:/sikp-be/staticfiles -v /prod/media:/sikp-be/media \\$DOCKER_REPO:latest &amp;&amp; \<br>    docker start sikp-be &amp;&amp; \<br>    docker cp .env sikp-be:.env &amp;&amp; \<br>    docker exec sikp-be python manage.py makemigrations --noinput database &amp;&amp; \<br>    docker exec sikp-be python manage.py migrate --noinput &amp;&amp; \<br>    docker exec sikp-be pg_dump -U \\$DB_USER -d \\$DB_NAME &gt; backup_before_seed.sql &amp;&amp; \<br>    sudo systemctl restart nginx&#39;&quot;<br>  only:<br>  - main</pre><p>Just like on docker script, credentials are being kept secret by using repository’s variable or local .env. The variables are noted with $ in the beginning of the word, i.e. $DB_NAME. For this deployment, because the repository’s limitation, we will be using dockerhub for images.</p><p>In this project, the deployment is separated into two. The staging and the production. The staging deployment is mainly used for user testing. Making sure software’s functionality before actual release. As for the production, it is the release deployment that will be used for general usage by the target users. This way, database seedings can be separated from the production database.</p><h4>Future Improvements</h4><p>Some improvements for this deployment setup can be done. For example at the the docker compose file. Connection setting can be set so it doesn’t need to display used ports in the docker-compose.yml file to avoid external attack. Some parts of the CI script can also be improved to avoid temporary unavailability of the software in the public internet access. Pruning the docker container can be moved to avoid it. Meanwhile there may be some improvements can be done, for this moment, the current setup already able to make your software deployment running and functional.</p><h4>Reference</h4><p><a href="https://docs.docker.com/compose/intro/features-uses/">Why use Compose?</a></p><p><a href="https://docs.docker.com/compose/gettingstarted/">https://docs.docker.com/compose/gettingstarted/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f68297f91eb8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hello, Django Services]]></title>
            <link>https://medium.com/@alyandaastri19/hello-django-services-5e38bcbb28c1?source=rss-2fcf70a781ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e38bcbb28c1</guid>
            <category><![CDATA[mvc]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[astrialyanda]]></dc:creator>
            <pubDate>Sun, 25 May 2025 11:56:16 GMT</pubDate>
            <atom:updated>2025-05-25T17:57:19.194Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*M4byfq_EUMU49sTW.png" /><figcaption><a href="https://www.quickstart.com/blog/programming-language/django-cheat-sheet/">https://www.quickstart.com/blog/programming-language/django-cheat-sheet/</a></figcaption></figure><p>Handling a lot of things in one go is a big hassle. That’s why we need to break down our task. Just like that, django program may also need some break down for a better maintainability. One way to break down your program is by using a service layer.</p><p>Django’s default design pattern is the Model-View-Template architecture or casually known as the MVT architecture. When you do a django startapp, you’ll see that django only creates views.pyand models.py. And if you happened using html instead of another frontend framework, you’ll create a template folder to store your html files.</p><p>The MVT architecture splits the functionality as:</p><ol><li><strong>Model</strong>: act as the interface of our data. It is the logical data structure behind the entire application.</li><li><strong>View</strong>: is the user interface. This layer can also be called as the logic layer. It handles the logics for what we will see when we render a website.</li><li><strong>Template</strong>: act as the presentation layer, such as HTML files.</li></ol><p>Following the basic MVT architecture, all the logic for the functionality of your app are concentrated in the views layer. With an app growing more complex, applying basic MVT may lead to fat-views, which may violates the separation of concern practice. It also doesn’t promote reusability, which makes you need to copy-paste the same thing in multiple functions. Furthermore, the maintainability of the app became poor and refactoring become risky.</p><p>To solve these problems, we can try to implement the service layer. What is a service layer? Service layer is a layer that is dedicated for the software’s business logics such as creating instance, updating instance, and deleting instance. The concept is to keep the business logic happen consistently and is abstracted away for users of the module.</p><p>Here is an example of how I separate my program into views and services.</p><pre># views.py<br>@login_required<br>@require_GET<br>def input_detil_kp_form(request):<br>    mahasiswa = request.user.mahasiswa<br>    semester_aktif = Semester.objects.filter(aktif=True).first()<br><br>    existing_pendaftaran = PendaftaranKP.objects.filter(<br>        mahasiswa=mahasiswa, <br>        semester=semester_aktif<br>    ).first()<br><br>    if not PendaftaranKPService.check_has_pending_registration(existing_pendaftaran):<br>        return redirect(NO_PENDING_ROUTE)<br>    <br>    pendaftaran_kp = PendaftaranKPService.get_pending_registration(request.user)<br>    form = InputDetilKPForm(instance=pendaftaran_kp)<br>    <br>    return render(request, &#39;input_detil_kp.html&#39;, {<br>        &#39;form&#39;: form,<br>        &#39;pendaftaran&#39;: pendaftaran_kp<br>    })<br><br>@login_required<br>@require_POST<br>def simpan_detil_kp(request, pendaftaran_id):<br>    mahasiswa = request.user.mahasiswa<br>    semester_aktif = Semester.objects.filter(aktif=True).first()<br><br>    existing_pendaftaran = PendaftaranKP.objects.filter(<br>        mahasiswa=mahasiswa,<br>        semester=semester_aktif<br>    ).first()<br><br>    if not PendaftaranKPService.check_has_pending_registration(existing_pendaftaran):<br>        return redirect(NO_PENDING_ROUTE)<br><br>    pendaftaran_kp = PendaftaranKPService.get_pending_registration(request.user)<br>    form = InputDetilKPForm(request.POST, instance=pendaftaran_kp)<br><br>    if form.is_valid():<br>        registration = form.save(commit=False)<br>        registration.save()<br>        return redirect(&#39;input_detil_program:input_detil_success&#39;, pendaftaran_id=pendaftaran_kp.id)<br><br>    return render(request, &#39;input_detil_kp.html&#39;, {<br>        &#39;form&#39;: form,<br>        &#39;pendaftaran&#39;: pendaftaran_kp<br>    })</pre><pre># services.py<br>class PendaftaranKPService:<br>    @staticmethod<br>    def get_pending_registration(user):<br>        mahasiswa = get_object_or_404(Mahasiswa, user=user)<br>        return get_object_or_404(<br>            PendaftaranKP, <br>            mahasiswa=mahasiswa,<br>            status_pendaftaran=&quot;Menunggu Detil&quot;,<br>            semester__aktif=True<br>        )<br>    <br>    @staticmethod<br>    def check_has_pending_registration(pendaftaran):<br>        if pendaftaran.semester.aktif == True and pendaftaran.status_pendaftaran == &#39;Menunggu Detil&#39;:<br>            return True<br>        else:<br>            return False<br><br>class PenyeliaAccountService:<br>    @staticmethod<br>    def get_or_create_penyelia(nama, perusahaan, email):<br>        penyelia = Penyelia.objects.filter(email=email).first()<br>        if penyelia:<br>            return penyelia<br><br>        user = User.objects.filter(email=email).first()<br>        if not user:<br>            user, password = PenyeliaAccountService.create_user(email)<br>        else:<br>            password = None  <br><br>        penyelia = PenyeliaAccountService.create_penyelia(user, nama, perusahaan, email)<br><br>        if password:<br>            EmailVerificationService.send_verification_email(user.username, password, email, nama)<br><br>        return penyelia<br><br>    @staticmethod<br>    def create_user(email):<br>        username = email.split(&#39;@&#39;)[0]<br>        password = get_random_string(length=10)<br>        user = User.objects.create(<br>            username=username,<br>            email=email<br>        )<br>        user.set_password(password)<br>        user.save()<br>        return user, password  <br><br>    @staticmethod<br>    def create_penyelia(user, nama, perusahaan, email):<br>        return Penyelia.objects.create(<br>            user=user,<br>            nama=nama,<br>            perusahaan=perusahaan,<br>            email=email<br>        )<br><br>class EmailVerificationService:<br>    @staticmethod<br>    def send_verification_email(username, password, email, nama):<br>        &#39;&#39;&#39; sending email implementation &#39;&#39;&#39;</pre><p>The main functionality of my app is placed in the views.py. Meanwhile the business logic such as get, create, and checking are placed in the services layer. With this, functions in views layer can just call the service layer.</p><h4>Benefits</h4><p>The implementation of service layer promotes some benefits:</p><ul><li>Better maintainability, implementing service layer promotes separation of concern, so it is easier to maintain for the developers.</li><li>Reusability, services can be applied in multiple views functions.</li></ul><h4>Reference</h4><p><a href="https://simoncrowe.hashnode.dev/django-service-layers-beyond-fat-models-vs-enterprise-patterns">https://simoncrowe.hashnode.dev/django-service-layers-beyond-fat-models-vs-enterprise-patterns</a></p><p><a href="https://www.geeksforgeeks.org/django-project-mvt-structure/">https://www.geeksforgeeks.org/django-project-mvt-structure/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e38bcbb28c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tools, Around, You. Team Up and Tool Up]]></title>
            <link>https://medium.com/@alyandaastri19/tools-around-you-team-up-and-tool-up-9fe932af9e12?source=rss-2fcf70a781ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fe932af9e12</guid>
            <category><![CDATA[sdlc]]></category>
            <category><![CDATA[teamwork]]></category>
            <dc:creator><![CDATA[astrialyanda]]></dc:creator>
            <pubDate>Mon, 19 May 2025 17:28:20 GMT</pubDate>
            <atom:updated>2025-05-21T04:25:43.445Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KcyzXOu9ELcJLfMP" /><figcaption><a href="https://unsplash.com/photos/group-of-people-using-laptop-computer-QckxruozjRg">https://unsplash.com/photos/group-of-people-using-laptop-computer-QckxruozjRg</a></figcaption></figure><p>A software development project are usually done in team. A team, consisting of multiple people and multiple characteristics, need to align and work together to reach requirements and goals. To make sure that each member are in check, we need tools to accompany our team until the end of software project development. Tools here can be our helper to build teamwork among each other.</p><p>One kind of software project management is an agile sprint. In an agile sprint, there are three main roles in a team. They are developers, scrum master, and product owner. For each role, they have their own responsibilities. Here, the responsibilities of each role are used to create a working environment that is suitable for the team to work on.</p><p>Building a suitable working environment, a team need helps from many kinds of tools. In my current project, kinds of tool are being used such as GitLab, JIRA, SonarQube, Discord, and Google Drive. These tools are there to be utilized by each member to reach optimal working flow. Here’s how my team builds a teamwork with the use of tools.</p><h4>Agreement on Sprint Cycle</h4><p>Before beginning the sprint, every member the team are already informed of how the software development process will be done. For my project, we will be doing agile sprint, a project management where the team works in sprints. By the beginning, each members should clearly understand and agree how the development will be going.</p><p>By the initialization, members also agree for the tools to be used in sprints. Here, my team agreed to use GitLab as the online repository and to use JIRA for backlog assignments. For flexibility of communication and storing links and resources, we also agreed to use discord.</p><h4>Keeping Track with JIRA</h4><p>On the beginning of the sprint, team should do a sprint planning. Lead by product owner and assisted by scrum master, we will be doing backlog assignments. At this step, a product owner will define the sprint goals as well choose backlogs that will be taken for the sprint. Meanwhile, scrum master will lead the storypoint voting between developers to define each backlogs load.</p><p>Managing backlogs and keeping track of task progress, this is where JIRA plays. Product owner can manage backlogs that is taken at the current sprint so does assigning to members. Here, Product owner can define the sprint goals, time range, storypoints, and progress status. For the developers, it is their tasks to update their progress. Each member needs to update their progress status to inform the team about their progress. With this, each member can be updated about each others progress.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZnK1nQ46QVMiTwJeFpgoCQ.png" /><figcaption>JIRA page</figcaption></figure><h4>Working on GitLab Repository</h4><p>Keeping our work neat and tidy, we need to utilize GitLab properly. Here, we are implementing the feature branch workflow, with each branch are divided by the previously made backlogs. Therefore, each members can works on their respective branch, which are assigned by their taken backlogs for the sprint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*L_-rk2E9N39S4a-m2zIjGA.png" /><figcaption>project branches</figcaption></figure><p>In this project, my team also agreed to use TDD (Test-Driven Development) approach. To follow this approach, each commit should follow these patterns:</p><ul><li>[RED] : adding tests</li><li>[GREEN] : adding implementations</li><li>[REFACTOR] : fixing codes without changing its functionalities</li><li>[CHORE] : coding outside three main parts</li></ul><p>Another behavior that our team agree to do is commenting each other’s merge request. Comments made on each other’s merge request are done as an appreciation of teammates work also to help them review their codes. Members can give their feedback so the other members can apply the feedback to improve their code. It is a way to share and communicate with each other in coding wise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dXfdV57cApj518VdnwH0GQ.png" /><figcaption>code review by teammate</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fwjuB2XR_Q-xN6wFS6yHXQ.png" /><figcaption>future code modification following team mate’s review</figcaption></figure><h4>Quality Check with SonarQube</h4><p>Keeping the software quality in check can be helped by SonarQube. SonarQube helps each members to find issues as well their code coverage. This way, we can refactor our code easier. Also, since we often merge our branches with the staging branches, usually, other member’s code issue will also inserted in our own branch issue. With this, we can remind other members about their code issues so they can handle it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tClUGXDUOPjWdyBdrQofdw.png" /><figcaption>sonarqube page showing coverage, security hotspot, and issues</figcaption></figure><h4>Webhook to Hook your Motivation</h4><p>Applying webhooks into your team workspace is probably one of the best motivation enhancer. Real-time GitLab update notifications right in your device may reminds you to keep your progress in track. In my team, we’re hooking our project’s GitLab pipeline into a discord channel. This way, every time a member pushes their progress and triggered a pipeline, notification will show from the discord channel webhook.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pSLufUf1UJ5HohsGc6PcBw.png" /><figcaption>bot that shares gitlab pipeline notifications</figcaption></figure><h4>Strengthening Team-Work via Discord</h4><p>Communication between members is a must. Keeping updates for each apps and their dependencies toward other apps is one of the reasons why communication should be nurtured in a team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*GHzINNVycYoUli5OmfL4GA.png" /><figcaption>team’s discord channels</figcaption></figure><p>With a proper communication between teammates, we can also share experience toward programming issues by holding a call via discord together. We can code together and solve problems together with direct response via discord call. This way, we can solve problem quicker and keep our progress efficiently.</p><h4>Defining the Definition of Done (DoD)</h4><p>Keeping the software quality consistency, we defined a DoD:</p><ul><li>Feature in accordance to user story</li><li>Passes unit test, successfully integrated, and functional feature</li><li>Passes the software security gate</li><li>≥90% code coverage</li><li>No conflicts in staging branch</li></ul><p>These are the reference that are being used to define a project as done.</p><h4>Evaluation</h4><p>With many tools being used, not every tool-based behavior may be done by routine and effectively. We still experience some lacks such as unfinished works that must be retaken on the future sprint. Sometimes, each member are way too focused on their individual progress without paying attention into other member’s progress.</p><p>To enhance teamwork, I think it is best if we try to deepen bonds between. A better relationship between members may loosen the awkwardness and lead to easier communication. This can be done by doing more on-site meets, in example attending classes and make conversations or even simply by hanging out together to loosen any tension or any stress.</p><h4>Epilogue</h4><p>Software development is not just about making a functional software. Establishing a good working environment — which doesn’t sound very technical — can also be a crucial component of a software development sprint. A team need a proper communication between members to create an efficient and effective progress.</p><p>To create a better environment, we may need to utilize tools — such as GitLab, JIRA, SonarQube, etc — to help our working flows. And not just utilizing tools, discipline and routines should be implemented to ensure good working flow. Communication between members also need to be established to make sure software quality in check.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fe932af9e12" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Oh no, not Bandit! It’ll Scan Through your Python’s Vulnerabilities!]]></title>
            <link>https://medium.com/@alyandaastri19/oh-no-not-bandit-itll-scan-through-your-python-s-vulnerabilities-fb2df8a3206c?source=rss-2fcf70a781ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb2df8a3206c</guid>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[bandit]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[astrialyanda]]></dc:creator>
            <pubDate>Sun, 18 May 2025 11:42:55 GMT</pubDate>
            <atom:updated>2025-05-18T11:42:55.779Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Njw9BUUZKOLboNDg.png" /><figcaption>src: <a href="https://github.com/PyCQA/bandit">https://github.com/PyCQA/bandit</a></figcaption></figure><p>Issue — you may hear it at an entertainment magazine, or news around politics as well nature. But actually, your program may also have issues! While you code your program, you may unintentionally leaves some vulnerabilities. These vulnerabilities may be a crack for disruptions or even for cyber attackers to slip in to your program.</p><p>Handling these vulnerabilities, developers often use tools that helps them to find the vulnerabilities. There are many tools to help developers for this such as SonarQube, PMD and others. Most of these tools are used by putting them in your CI. But then, what are you gonna do if your server is down? That’s why here, I will try to use one of the popular tool for security issue tracking — <em>Bandit. </em>Bandit is a tool used to scan Python program’s security issues. It can be executed right from your local device. No more server’s disrupt may disrupt your refactoring!</p><p>Setting up Bandit is pretty easy. I am currently working on a Django project. And for this project, I’m using docker container. Here is how to set Bandit in a dockerized Django project:</p><ol><li>Place ‘bandit’ in your requirements.txt. Make sure installing your requirements.txt is included in your docker build script. This way, every time you build your project, bandit will also be installed in your container.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/1*1DgCemRVOgdpyDtenqf2sQ.png" /><figcaption>bandit in your requirements.txt</figcaption></figure><p>2. Build and Up your project</p><pre>C:\project-path&gt; docker-compose build<br>...<br>C:\project-path&gt; docker-compose up<br>...</pre><p>3. While your docker engine is running, open a separate terminal to run your bandit scanner. Run your bandit scanner with this command:</p><pre>C:\project-path&gt; docker compose exec -it &lt;container-name&gt; bandit -r /&lt;project-name&gt;/</pre><p>Or if you want to run the scan only in your app, you can run it by:</p><pre>C:\project-path&gt; docker compose exec -it &lt;container-name&gt; bandit -r /&lt;project-name&gt;/&lt;app-name&gt;</pre><p>And that is how you execute Bandit to scan your program’s vulnerabilities. It only requires a few steps so it is particularly easy.</p><h4>Output</h4><p>Here is the example of Bandit’s report:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vWcG0x51DlueBX5UR917BA.png" /><figcaption>Bandit output</figcaption></figure><p>Here, bandit shows how many lines of code it scanned and how many it skipped. It also shows how many issues are there in your app. It shows the issues in two kinds of metrics, severity and confidence.</p><p>Looking close to the issues, each issue are categorized. For example above, the issue is categorized as hardcoded_password_funcarg. It says that there a possible hardcoded password. It also gave a CWE (Common Weakness Enumeration) ID and link, as well link towards further information about the category of the issue. And one other important thing, it also states where the possible issue is. For example there, the issue is located at /sikp-be/input_detil_program/tests.py at line 520.</p><h4>Benefits</h4><p>By installing Bandit in my project of course i want it to help me to find vulnerabilities in my program. It is one of the tools i use for quality assurance. For example in my project, I use SonarQube as well. But my team faced with bottleneck when the SonarQube’s server was down. Halting any security checks that our app has. That is why, applying Bandit, which can be executed from each member’s local device, can be an alternative way for quality assurance. It may be not as complete as SonarQube, but with combination of Bandit and Coverage, we can continue refactor vulnerabilities as well as keeping check the code coverage.</p><p>That’s all I can share, check further by this <a href="https://bandit.readthedocs.io/en/latest/">link</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb2df8a3206c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Are you SOLID yet? Applying SOLID Principle in my Django Project]]></title>
            <link>https://medium.com/@alyandaastri19/are-you-solid-yet-applying-solid-principle-in-my-django-project-edad29eff5bb?source=rss-2fcf70a781ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/edad29eff5bb</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[solid-principles]]></category>
            <dc:creator><![CDATA[astrialyanda]]></dc:creator>
            <pubDate>Mon, 12 May 2025 10:18:49 GMT</pubDate>
            <atom:updated>2025-05-15T18:13:08.400Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BbMdqWfFQZhADbKE.png" /><figcaption><a href="https://sachindugimhana.medium.com/the-s-o-l-i-d-design-principles-845dadd731b6"><em>https://sachindugimhana.medium.com/the-s-o-l-i-d-design-principles-845dadd731b6</em></a></figcaption></figure><p>Coding is not just about writing line of codes. There are also some kind of “law” to follow for developers. One of the most popular principle is the SOLID principle. SOLID principle was created by Robert Martin with the goals to create a consistent, reliable, maintainable, and expandable software.</p><p>In this blog, I want to share how I apply SOLID programming principle into my Django project. And not only that, I too want to share about some of the programming best practices I have also done in my project.</p><p>But first, let’s start with the SOLID principle.</p><h4>Single Responsibility Principle</h4><p>The single responsibility principle states that a class should only be responsible for a single job or purpose. For this principle, I break down my function into single job functions.</p><pre>@login_required<br>@require_GET<br>def input_detil_kp_form(request):<br>    mahasiswa = request.user.mahasiswa<br>    semester_aktif = Semester.objects.filter(aktif=True).first()<br><br>    ...<br>    <br>    return render(request, &#39;input_detil_kp.html&#39;, {<br>        &#39;form&#39;: form,<br>        &#39;pendaftaran&#39;: pendaftaran_kp<br>    })<br><br>@login_required<br>@require_POST<br>def simpan_detil_kp(request, pendaftaran_id):<br>    mahasiswa = request.user.mahasiswa<br>    semester_aktif = Semester.objects.filter(aktif=True).first()<br><br>    ...<br><br>    return render(request, &#39;input_detil_kp.html&#39;, {<br>        &#39;form&#39;: form,<br>        &#39;pendaftaran&#39;: pendaftaran_kp<br>    })<br><br>@login_required<br>@require_GET<br>def no_pending_registration(request):<br>    mahasiswa = Mahasiswa.objects.filter(user=request.user).first()<br>    return render(request, &#39;no_pending.html&#39;, {&#39;dashboard_url&#39;: &#39;/home_mahasiswa/&#39;,<br>                                               &#39;pendaftaran_url&#39;: get_pendaftaran_url(https://medium.com/mahasiswa)})<br><br>@login_required<br>@require_GET<br>def input_detil_success(request, pendaftaran_id):<br>    pendaftaran = PendaftaranKP.objects.get(id=pendaftaran_id)<br>    return render(request, &#39;success_page.html&#39;, {&#39;pendaftaran&#39;: pendaftaran,<br>                                                 &#39;dashboard_url&#39;: &#39;/home_mahasiswa/&#39;,<br>                                                 &#39;pendaftaran_url&#39;: get_pendaftaran_url(https://medium.com/pendaftaran.mahasiswa)})</pre><p>In my app views, the functions are divided into a single job function, such as:</p><ul><li>input_detil_kp_form to display the input detil KP form</li><li>simpan_detil_kp to handle saving the form</li><li>no_pending_registration to handle page redirects if there is no Pendaftaran with no detil program</li><li>input_detil_success to handle page redirects if the form is saved successfully</li></ul><p>The SRP also applied in services.py by separating each job into different functions. In services.py, the classes are separated into three, one class to handle input detil KP business logic, such as checking for pending registration and get pendaftaran with pending registration, one class to handle creating Penyelia user instance, such as create user, abstract user</p><h4>Open/Closed Principle</h4><p>This principle states that software should be open for extension but closed for modification. OCP is implemented in my PenyeliaAccountService. This class is open for extension. For example if there will be new implementation for the created penyelia user, it can just override by making a new subclass.</p><pre>class BasePenyeliaAccountService:<br>    def get_or_create_penyelia(self, nama, perusahaan, email):<br>        penyelia = self.find_existing_penyelia(email)<br>        if penyelia:<br>            return penyelia<br><br>        user, password = self.get_or_create_user(email)<br>        penyelia = self.create_penyelia(user, nama, perusahaan, email)<br>        self.after_user_and_penyelia_created(user, password, email, nama)<br><br>        return penyelia<br><br>    def find_existing_penyelia(self, email):<br>        ...<br><br>    def get_or_create_user(self, email):<br>        ...<br><br>    def create_user(self, email):<br>        ...<br><br>    def create_penyelia(self, user, nama, perusahaan, email):<br>        ...<br><br>    def after_user_and_penyelia_created(self, user, password, email, nama):<br>        &quot;&quot;&quot;Hook for extensions&quot;&quot;&quot;<br>        pass<br><br>class PenyeliaAccountService(BasePenyeliaAccountService):<br>    def after_user_and_penyelia_created(self, user, password, email, nama):<br>        # for example, handling email sending here</pre><h4>Liskov’s Substitution Principle</h4><p>Liskov’s substitution principle states that derived class must be substitutable for their parent class. The LSP is implemented in models. By creating the OneRoleUser model, then used to create the Penyelia user instance. Here, the Penyelia instance inherits the OneRoleUser instance. and further applications, mostly relies on the child instance, where for my feature is, the Penyelia instance.</p><pre>class OneRoleUser(models.Model):<br>    user = models.OneToOneField(User, on_delete=models.CASCADE)<br>    nama = models.CharField(max_length=255)<br>    email = models.EmailField(unique=True)<br><br>    class Meta:<br>        abstract = True<br><br>    def clean(self):<br>        super().clean()<br>        validate_one_role_user(self.user)<br><br>    def save(self, *args, **kwargs):<br>        self.full_clean()<br>        super().save(*args, **kwargs)<br><br>class Penyelia(OneRoleUser):<br>    email = models.EmailField(unique=True, validators=[v.validate_email_penyelia])<br>    perusahaan = models.CharField(max_length=255)<br>    is_active = models.BooleanField(<br>        _(&#39;active&#39;),<br>        default=True,<br>        help_text=_(&#39;Designates whether this user should be treated as active.&#39;)<br>    )<br>    created_at = models.DateTimeField(auto_now_add=True)<br>    updated_at = models.DateTimeField(auto_now=True)<br>    invitation_token = models.CharField(<br>        max_length=100,<br>        null=True,<br>        blank=True,<br>        help_text=_(&#39;Token for one-time password setup link.&#39;)<br>    )<br><br>    class Meta:<br>        verbose_name = _(&#39;penyelia&#39;)<br>        verbose_name_plural = _(&#39;penyelia&#39;)<br>        ordering = [&#39;-created_at&#39;]<br><br>    def __str__(self):<br>        return f&quot;{self.nama} ({self.perusahaan})&quot;<br><br>    def get_full_name(self):<br>        return self.nama<br><br>    def get_short_name(self):<br>        return self.nama.split()[0] if self.nama else self.email</pre><p>Here, the Penyelia instance inherits the OneRoleUser behavior, where OneRoleUser is the parent class of the Penyelia instance.</p><h4>Interface Segregation Principle</h4><p>This principle states that we should not force client to implement interface that is irrelevant for them. Here is the implementation I did:</p><pre>class PendaftaranKPService:<br>    &quot;&quot;&quot;<br>    Service class untuk menangani logika bisnis PendaftaranKP.<br>    &quot;&quot;&quot;<br><br>class BasePenyeliaAccountService:<br>    &quot;&quot;&quot;<br>    Service class untuk menangani pembuatan akun Penyelia<br>    &quot;&quot;&quot;<br>    &quot;&quot;<br><br>class PenyeliaAccountService(BasePenyeliaAccountService):<br>    &quot;&quot;&quot;<br>    Service class untuk menangani extension setelah akun penyelia terbuat<br>    &quot;&quot;&quot;<br><br>class EmailVerificationService:<br>    &quot;&quot;&quot;<br>    Service class untuk menangani pengiriman email verifikasi<br>    &quot;&quot;&quot;</pre><p>In the service layer, each class are made by their own concerns. It doesn’t mix concerns into a single class.</p><h4>Dependency Inversion Principle</h4><p>This principle states that high level modules should not depends on low level modules.</p><pre># implementasi init dalam forms.py<br>def __init__(self, *args, penyelia_service=None, **kwargs):<br>        &quot;&quot;&quot;Inisialisasi form dengan data yang sudah ada dari model&quot;&quot;&quot;<br>        self.pendaftaran_kp = kwargs.get(&#39;instance&#39;, None)<br>        self.penyelia_service = penyelia_service or PenyeliaAccountService()<br>        super().__init__(*args, **kwargs)<br>        ...<br><br># implementasi save dalam forms.py<br>def save(self, commit=True):<br>        ...<br><br>        if penyelia_nama and penyelia_perusahaan and penyelia_email:<br>            penyelia = self.penyelia_service.get_or_create_penyelia(<br>                nama=penyelia_nama,<br>                perusahaan=penyelia_perusahaan,<br>                email=penyelia_email,<br>            )<br>            instance.penyelia = penyelia<br><br>        ...</pre><p>Here is the code I used in forms to get or create Penyelia. Here, my forms doesn’t directly depends on PenyeliaKPService. It doesn’t depends directly on a concrete implementation. Instead, it depends on something that has a get_or_create_penyelia function. That way, the high level modules doesn’t depend on low level modules.</p><p>Not only applying SOLID principles, there are also best practices that you can do while doing your code. Here are some of the best practices i have done in my code.</p><h4>Separation of Concern</h4><p>Separating the app into views, services, forms layer so each general functionality are encapsulated within.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/218/1*lZzKxZYb3KwsSDFGKBIrAA.png" /><figcaption><em>Adding forms and services layer</em></figcaption></figure><h4>Use of Django Features</h4><p>Utilizing Django built-in features for code implementation. Here, I’m utilizing Django’s decorator login_required, require_GET, and require_POST.</p><pre>from django.contrib.auth.decorators import login_required<br>from django.views.decorators.http import require_GET, require_POST<br><br>@login_required<br>@require_GET<br>def input_detil_kp_form(request):<br>  ...<br><br>@login_required<br>@require_POST<br>def simpan_detil_kp(request, pendaftaran_id):<br>  ...<br><br>@login_required<br>@require_GET<br>def no_pending_registration(request):<br>  ...</pre><h4>Validation</h4><p>Implementing custom validation in the code</p><pre>from database.validators import validate_tanggal_mulai_selesai<br>from database.models import validate_tanggal_mulai_selesai<br><br># validating penyelia&#39;s email input<br>penyelia_email = forms.EmailField(required=False, label=&quot;Email Penyelia&quot;, validators=[validate_email_penyelia])<br><br># validating tanggal_mulai and tanggal_selesai input<br>if tanggal_mulai and tanggal_selesai:<br>   try:<br>      dummy_instance = PendaftaranKP(<br>         ...<br>         )<br>         validate_tanggal_mulai_selesai(dummy_instance)</pre><h4>Error Handling</h4><p>Using try except to handle exceptions, for then the error message to be displayed via django’s messages.</p><pre>try:<br>   # Bangun instance tiruan untuk divalidasi<br>   dummy_instance = PendaftaranKP(<br>   tanggal_mulai=tanggal_mulai,<br>   tanggal_selesai=tanggal_selesai,<br>   semester=self.instance.semester if self.instance else None,<br>   )<br>   validate_tanggal_mulai_selesai(dummy_instance)<br><br>except ValidationError as e:<br>    # Distribusikan error ke field yang sesuai berdasarkan isi pesan<br>   for message in e.messages:<br>      if &quot;mulai&quot; in message.lower() and &quot;selesai&quot; in message.lower():<br>         self.add_error(&quot;tanggal_mulai&quot;, message)<br>         self.add_error(&quot;tanggal_selesai&quot;, message)<br>      elif &quot;mulai&quot; in message.lower():<br>         self.add_error(&quot;tanggal_mulai&quot;, message)<br>      elif &quot;selesai&quot; in message.lower():<br>         self.add_error(&quot;tanggal_selesai&quot;, message)<br>      else:<br>         self.add_error(None, message)</pre><h4>Outro</h4><p>Many kinds of best practice and coding principles can be done to get benefits. Some of the benefits by implementing these are:</p><ul><li>Easier to maintain and update one area of code without breaking or modifying stable code</li><li>Reducing the risk of contaminating stable codes with new bugs from new implementation</li><li>Easier to understand the code</li><li>Promotes flexibility and testability</li><li>Clear error reporting and validations</li></ul><h4>References</h4><p><a href="https://www.komododigital.co.uk/insights/solid-ify-your-code-with-solid-design-principles/">SOLID-ify Your Code With SOLID Design Principles | Komodo Digital</a></p><p><a href="https://www.baeldung.com/solid-principles">https://www.baeldung.com/solid-principles</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=edad29eff5bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Person of the People: People and Product Management in Agile Sprint]]></title>
            <link>https://medium.com/@alyandaastri19/the-person-of-the-people-people-and-product-management-in-agile-sprint-748c00081bb5?source=rss-2fcf70a781ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/748c00081bb5</guid>
            <category><![CDATA[sprint-planning]]></category>
            <category><![CDATA[people-management]]></category>
            <category><![CDATA[product-owner]]></category>
            <dc:creator><![CDATA[astrialyanda]]></dc:creator>
            <pubDate>Fri, 25 Apr 2025 06:20:17 GMT</pubDate>
            <atom:updated>2025-04-25T06:20:17.165Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*whroX624Faf-3z6H8kdJ_A.jpeg" /></figure><p>Working in a team to develop a software requires a good people and product management. There’s one approach called the Agile product management. It is a project management that breaks the project processes into smaller cycles called sprints. It’s goal is to enables the team to work quickly and collaboratively on a project while being able to adapt to changing requirements in development.</p><p>In this project I’m currently doing, I am entrusted to be the product owner for the third sprint out of four sprints. In a sprint development, a product owner is responsible to for prioritizing and overseeing the development team’s tasks and make sure the product delivered well.</p><h4><strong>Implementing Best Practice</strong></h4><p>For this sprint, I am implementing one of the best practice known as <strong>People over Process</strong>. It is a practice where the product owner prioritize individuals and their interactions with each other over rigid processes and tools. This practice is done by no meaning that process isn’t running. It is an approach that will be done to try understand the member’s condition. And if there is a problem, finding solution by engaging helps by other teammates that are capable.</p><p>By doing this, I am hoping to get a well made product that may satisfies the stakeholders. It is necessary to make sure the works weight of each team members stays on their capability. Overloading works may only lead to unfinished and broken feature that is not presentable to the stakeholders. Therefore, assigning backlogs and story points are done with the help of Scrum Master and the dev team members theirself by discussing the right amount of works that the members can handle.</p><h4>Ensuring Stable Team Dynamics</h4><p>As the sprint running, the team dynamics should be managed well. No one would want a sluggish team dynamic as it may affect both the people and the product. Therefore, the main points of things that I’ll be doing in this sprint are:</p><ul><li><strong>Implementing People over Process</strong>, understanding each members capability over rigid process to achieve quality works that meet the requirements.</li><li><strong>Backlog assigning</strong>, are done with the help of Scrum Master to reorganize backlogs as well tasks that will be taken for sprint, that are within developer’s capability</li><li><strong>Dev teams conditional update</strong>, privately asking member conditions that is seen abnormal as a move to understand their capability to finish the given tasks.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AC6eZtvz54aO3K68FaBVPA.jpeg" /><figcaption>asking for member’s condition</figcaption></figure><ul><li><strong>Requirements clarity</strong>, ensure project requirements clarity by reconfirm previously ambiguous requirement update to the stakeholder. Reconfirming requirements can be done by asking the stakeholder directly (e.g. when meeting in class) or by asking asynchronously (e.g. via discord server).</li></ul><h4>Innovating for the Better: Live Coding Session Together</h4><p>A team-based software development process is not only about assigning task, but also how each dev team members performs and supports each other to get conducive as well supporting environment to promote product progress. In this project I’m currently doing, adapting by the need to build team’s collaboration, the team’s current and former Product Owners as well Scrum Masters are initiating a method that we call <em>live coding together. </em>This will be a session that is focusing on collaborating with each members that is done by doing voice call via Discord.</p><p>This method is not only helping members to collaborate, but also used to resolve problems that arise from task breaking. By breaking tasks, there are some features that creates a temporary dummy feature to support it. As the sprint going, the dummy feature backlog will also being taken by the dev team, especially may be taken by another team member that didn’t take the previous feature that create the dummy feature. This may rising problem as the previous feature need to be linked with the currently taken feature. This problem needs handling by not only the member that hold the current feature, but also the member that handles the previous feature. By holding this live coding session, the previous feature member can direct the current feature member to modify where the feature needs modification with respect to current feature. Therefore, The previous feature will no longer need to use the dummy support feature.</p><h4>How Live Coding Together Works</h4><p>We hold <em>live coding together</em> sessions regularly. This session may held spontaneously as the members need in the middle of sprint, but can also held regularly before doing User Acceptance Test to make sure software’s performance.</p><ul><li><strong>Holding Discord voice call session</strong>: team members can join the voice call session in discord server to resolve their problem together with the help of other team members.</li><li><strong>Working on individual tasks as well helping the others</strong>: inside the voice call, members who needs help can start screen sharing so other team members can see and help within their capability. While this being done, other members can also synchronously doing their own tasks. When one’s meets a bottleneck, they can start asking or screen sharing to ask to other team members.</li><li><strong>Pre-UAT discord session</strong>: to prepare for UAT (User Acceptance Test), we usually did a voice call to do a last minute bug fix and performing a mini UAT by checking software flows. This is done to make sure the software’s functionality before delivering to the stakeholder on the UAT session.</li></ul><h4>Live Coding Impacts and Evaluation</h4><p>By doing this innovation, we gain some benefit for the team’s performance such as:</p><ul><li>handling problems more effectively</li><li>debugging became less time consuming</li><li>increase motivation to do the work</li><li>increase member’s understanding for the software requirements</li></ul><p>In team performance perspective, this innovation can increase performance as well nurturing bonds between team members. Hesitation to ask are now seen less and each member are now more responsive to help each other. In product management perspective, this positive supporting environment may help the product to reach better quality, and hopefully may presenting software that meets the stakeholder’s satisfaction.</p><h4>Epilogue</h4><p>Taking the role of Product Owner, it stood up to me that we can’t just prioritize product delivered in a sprint. It is necessary to create a positive environment for the members to work, so they can give their best performance, resulting in a better product quality as well process efficiency. To reach that, me, as the Product Owner, as well my teammate, as the Scrum Master, need to plan how to create a suitable methods and approaches. Doing a sprint need the understanding of human needs, not only the product needs. Thus, we, as the people person, needs planning to grow the team into better.</p><p>References:</p><p><a href="https://www.techtarget.com/searchcio/definition/Agile-project-management#:~:text=Agile%20project%20management%20enables%20project,each%20sprint%20and%20product%20cycle">https://www.techtarget.com/searchcio/definition/Agile-project-management</a></p><p><a href="https://medium.com/@kaitlinfmcnamara/what-does-people-over-process-really-mean-30b0313bb5a6#:~:text=It%20does%20not%20mean%20no,works%20best%20for%20your%20team">https://medium.com/@kaitlinfmcnamara/what-does-people-over-process-really-mean-30b0313bb5a6</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=748c00081bb5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ensuring Django Project Security based on OWASP Top 10]]></title>
            <link>https://medium.com/@alyandaastri19/ensuring-django-project-security-based-on-owasp-4d56700f457d?source=rss-2fcf70a781ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d56700f457d</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[owasp]]></category>
            <dc:creator><![CDATA[astrialyanda]]></dc:creator>
            <pubDate>Sun, 06 Apr 2025 04:19:45 GMT</pubDate>
            <atom:updated>2025-04-09T12:07:04.779Z</atom:updated>
            <content:encoded><![CDATA[<p>With so many kinds of digital threats, making sure your project is safe is a must. To make sure your project is secure, it is known by developers to follow the OWASP Top 10 guidelines.</p><p>OWASP Top 10 is a standard awareness document for developers. It represents borad consensus about critical security risks to our web apps. Here are the list of OWASP Top 10:</p><ol><li><strong>Broken Access Control</strong></li></ol><p>This vulnerability arises when users can access data or perform actions outside of their permission.</p><p><strong>2. Cryptographic Failures</strong></p><p>Failures in protecting data in transit or at rest can lead to data leaks or unauthorized access.</p><p><strong>3. Injection</strong></p><p>Injection attacks like SQL, NoSQL, or command injection occur when untrusted input executed as code or commands.</p><p><strong>4. Insecure Design</strong></p><p>Lack of secure architecture and design patterns may make your app vulnerable.</p><p><strong>5. Security Misconfiguration</strong></p><p>Misconfigured settings like leaving default admin credentials, exposing error messages, or enabling unnecessary features.</p><p><strong>6. Vulnerable and Outdated Components</strong></p><p>Using outdated libraries, frameworks, or software which vulnerabilites are already known can expose your application.</p><p><strong>7. Identification and Authentication Failures</strong></p><p>Weak or broken authentication mechanisms allow attackers to compromise user accounts.</p><p><strong>8. Software and Data Integrity Failures</strong></p><p>Failures related to code and infrastructure integrity such as not verifying software updates or using untrusted sources in CI/CD pipelines</p><p><strong>9. Security Logging and Monitoring Failures</strong></p><p>Without proper logging and monitoring, breaches can go undetected.</p><p><strong>10. Server-Side Request Forgery</strong></p><p>SSRF occurs when a server is tricked into making a request to an unintended location, often leading to internal network access or cloud metadata exposure.</p><p>For this django project I’m currently doing, these are some of things i have done to apply secure programming.</p><ol><li><strong>Authentication and authorization</strong></li></ol><p>Using django’s @login_required to authenticate user. Implement this decorator for every important endpoint to make sure the user accessing is authenticated. Also creating an is_penyelia function to handle user authorization. This implementation covers Broken Access Control and Authentication Failures.</p><pre>@login_required<br>@require_GET<br>def lihat_laporan_kegiatan(request, program, mahasiswa_id):<br>    mahasiswa = get_object_or_404(Mahasiswa, id=mahasiswa_id)<br>    <br>    # check if user penyelia<br>    if not is_penyelia(request.user):<br>        return JsonResponse({&#39;error&#39;: &#39;Unauthorized&#39;}, status=403)<br>    <br>    # fetch laporan<br>    laporan = fetch_laporan(request, mahasiswa_id, program)<br>  <br>    # get pendaftaran<br>    pendaftaran = None<br>    if program == &#39;kp&#39;:<br>        pendaftaran = get_object_or_404(PendaftaranKP, mahasiswa=mahasiswa)<br>    elif program == &#39;mbkm&#39;:<br>        pendaftaran = get_object_or_404(PendaftaranMBKM, mahasiswa=mahasiswa)<br>    <br>    context = {<br>        &#39;laporan&#39;: laporan,<br>        &#39;pendaftaran&#39;: pendaftaran,<br>        &#39;program&#39;: program,<br>    }<br><br>    return render(request, &#39;lihat_laporan_kegiatan.html&#39;, context)<br><br># decorator design pattern<br>def is_penyelia(user):<br>    return Penyelia.objects.filter(user=user).exists()</pre><p>2. <strong>CSRF Protection</strong></p><p>Implement csrf_token on html files to protect from csrf (cross-site request forgery) attack. This covers Broken Access Control.</p><pre>    &lt;div class=&quot;mt-6&quot;&gt;<br>        &lt;form method=&quot;POST&quot; action=&quot;{% url &#39;lihat_laporan_kegiatan:persetujuan_laporan&#39; program=program id_mahasiswa=laporan.pendaftaran.mahasiswa.id %}&quot;&gt;<br>        {% csrf_token %}<br>    <br>        &lt;!-- Tombol Approve --&gt;<br>        &lt;button type=&quot;submit&quot; name=&quot;action&quot; value=&quot;approve&quot; class=&quot;bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700&quot;&gt;<br>            Approve<br>        &lt;/button&gt;<br>    <br>        &lt;!-- Tombol Reject --&gt;<br>        &lt;button type=&quot;button&quot; id=&quot;rejectBtn&quot; class=&quot;bg-red-600 text-white px-4 py-2 rounded hover:bg-red-700 ml-4&quot;&gt;<br>            Reject<br>        &lt;/button&gt;<br>    <br>        &lt;!-- Textarea Feedback, awalnya disembunyikan --&gt;<br>        &lt;div id=&quot;feedbackForm&quot; class=&quot;mt-4 hidden&quot;&gt;<br>            &lt;textarea name=&quot;feedback&quot; rows=&quot;4&quot; placeholder=&quot;Masukkan feedback laporan...&quot; class=&quot;w-full border rounded p-2&quot;&gt;&lt;/textarea&gt;<br>            &lt;button type=&quot;submit&quot; name=&quot;action&quot; value=&quot;reject&quot; class=&quot;mt-2 bg-red-600 text-white px-4 py-2 rounded hover:bg-red-700&quot;&gt;<br>            Submit<br>            &lt;/button&gt;<br>        &lt;/div&gt;<br>        &lt;/form&gt;<br>    &lt;/div&gt;</pre><p>3. <strong>Input validation</strong></p><p>Ensure object that is accessed is true by doing validation using django’s get_object_or_404. This covers Injection. Also, use .clean() in forms to cover insecure design.</p><pre># get pendaftaran<br>    pendaftaran = None<br>    if program == &#39;kp&#39;:<br>        pendaftaran = get_object_or_404(PendaftaranKP, mahasiswa=mahasiswa)<br>    elif program == &#39;mbkm&#39;:<br>        pendaftaran = get_object_or_404(PendaftaranMBKM, mahasiswa=mahasiswa)</pre><p>4. <strong>Software and Data Integrity</strong></p><p>While I’m doing my project with gitlab as the repository, I’m using gitlab’s variable to store critical data such as passwords or tokens for the ci/cd pipeline. This covers Software and Data Integrity Failures.</p><pre> POSTGRES_DB: $DB_NAME<br> POSTGRES_USER: $DB_USER<br> POSTGRES_PASSWORD: $DB_PASSWORD</pre><p><strong>5. Security Logging and Monitoring Failures</strong></p><p>Using django messages to log errors so it can be detected.</p><pre>laporan = fetch_laporan(request, id_mahasiswa, program)<br>    if laporan is None:<br>        messages.error(request, &#39;Laporan tidak ditemukan.&#39;)<br>        return redirect(request.META.get(&#39;HTTP_REFERER&#39;))</pre><p>That’s all i can put here for now, advancements to be continued.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d56700f457d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>