Practice input checks, access boundaries and defensive software habits.

Before starting: HTTP, HTML, and basic programming.

Practice project: Explain an output context and check a defensive encoding example.

Foundation and first practice

  1. Keep text separate from HTML markup

    An injection problem occurs when data is interpreted as instructions in the wrong context. The example encodes text for insertion into an HTML text node. It is not a general sanitizer for every output context. SQL parameters, URL handling, JavaScript values, authentication, and authorization each need their own controls.

    Python 3; local defensive example

    from html import escape
    
    message = "<b>study</b> & revise"
    print(escape(message, quote=True))
    Check the output
    &lt;b&gt;study&lt;/b&gt; &amp; revise

    Explain why encoding an HTML text node does not make the same data safe inside a script block. Practice only with synthetic inputs in your own environment.

Open the Cybersecurity learning path on DevStudyHub · Play coding games on this blog

logoblog

No comments:

Post a Comment

Please do not enter any spam link in the comment box.