Giter Club home page Giter Club logo

Comments (12)

psiinon avatar psiinon commented on June 11, 2024 3

How about at non LOW threshold we only scan responses if (respHeader.isHtml() || respHeader.isText() || respHeader.isJson() || respHeader.isXml()) ?
Where respHeader = msg.getResponseHeader().

from zaproxy.

psiinon avatar psiinon commented on June 11, 2024 2

@ganesh-dagadi its been assigned to you 😁 Let us know if you'd like any advice and guidance..

from zaproxy.

kingthorin avatar kingthorin commented on June 11, 2024 1

Sounds right too me. You should see other UnitTests for other rules that check/try this as well.

from zaproxy.

kingthorin avatar kingthorin commented on June 11, 2024 1

Sure. I'm not sure how that specific test class is setup but most of them have a private method creating the HttpMessage objects, you could add a default of text/html there and then override it in new tests, etc

from zaproxy.

kingthorin avatar kingthorin commented on June 11, 2024 1

Just remove isText() from your set of ORs.

from zaproxy.

ganesh-dagadi avatar ganesh-dagadi commented on June 11, 2024

I would like to work on this issue.

from zaproxy.

kingthorin avatar kingthorin commented on June 11, 2024

I'd suggest that this be tied to Threshold, some lame frameworks create a JS constants file that gets exposed so it would be good for users to be able to choose to scan them.

from zaproxy.

ganesh-dagadi avatar ganesh-dagadi commented on June 11, 2024

So as suggested by @psiinon , if the user selects Low threshold, we continue with the scan but when the threshold is not LOW and if ResourceIdentificationUtils.isJavascript() is true, we skip the scan. So can this be solved just by adding another guard clause?

from zaproxy.

kingthorin avatar kingthorin commented on June 11, 2024

Sure, yeah that sounds good.

from zaproxy.

ganesh-dagadi avatar ganesh-dagadi commented on June 11, 2024

As we are now checking based on the response header, I observed that most of the Unit tests do not set the response header - Content type. Do you recommend I add content type to all the Unit tests?

from zaproxy.

ganesh-dagadi avatar ganesh-dagadi commented on June 11, 2024

The method responseHeader.isText() return true if javascript is in content type. Here is the method

public boolean isText() {
        return this.hasContentType(new String[]{"text", "html", "javascript", "json", "xml"});
    }

https://github.com/zaproxy/zaproxy/blob/main/zap/src/main/java/org/parosproxy/paros/network/HttpResponseHeader.java#L259

So checking for isText() is returning true for javascript content type. Thus, at NON LOW threshold, javascript is also passing through the guard clause. Shall I remove isText() on NON LOW threshold or remove javascript from isText() method?

from zaproxy.

ganesh-dagadi avatar ganesh-dagadi commented on June 11, 2024

I have opened a Pull Request addressing this Issue.

from zaproxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.