All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.codemodder.codemods.harden-xmlreader-just-needs-general.yaml Maven / Gradle / Ivy

There is a newer version: 0.97.3
Show newest version
rules:
  - id: harden-xmlreader-just-needs-general
    patterns:
      - pattern: $XMLR.parse(...);
      - pattern-inside: |
          $RT $METHOD ($ARGS) {
            ...
            $XMLR = XMLReaderFactory.createXMLReader(...);
            ...
          }
      - pattern-not-inside: >
          $RT $METHOD ($ARGS) {
            ...
            $XMLR.setFeature("http://xml.org/sax/features/external-general-entities", false);
            ...
          }
      - pattern-inside: >
          $RT $METHOD ($ARGS) {
            ...
            $XMLR.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
            ...
          }
      - focus-metavariable: $XMLR
    message: Semgrep found a match
    languages:
      - java
    severity: WARNING




© 2015 - 2024 Weber Informatics LLC | Privacy Policy