- Notifications
You must be signed in to change notification settings - Fork 12
Pull request for 10 rules ESS-ENN #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
4208c3d 2d4ea63 586888d 9015c09 68be70d 3d453a8 e7b4680 1ba2958 f182a4b ac0edaa 650b88b b0c6e4e bd0bc1d 5507b0a 456f431 30f9ae3 0970f4f 081bad0 bec0b7e 472fa36 5fea8a2 a85cbfb 22b3dca 090e6af fc5f3a1 bf350e6 85c6f95 07abf42 126ec00 b62d49a ae12535 1326f4c d26328d 57c1edb b679216 6ff4438 66dff6f File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| id: sizeof-this-c | ||
| language: c | ||
| severity: warning | ||
| message: >- | ||
| Do not use `sizeof(this)` to get the number of bytes of the object in | ||
| memory. It returns the size of the pointer, not the size of the object. | ||
| note: >- | ||
| [CWE-467]: Use of sizeof() on a Pointer Type | ||
| [REFERENCES] | ||
| - https://wiki.sei.cmu.edu/confluence/display/c/ARR01-C.+Do+not+apply+the+sizeof+operator+to+a+pointer+when+taking+the+size+of+an+array | ||
| rule: | ||
| any: | ||
| - pattern: "sizeof(this)" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| id: plaintext-http-link-html | ||
| language: html | ||
| severity: info | ||
| message: >- | ||
| This link points to a plaintext HTTP URL. Prefer an encrypted HTTPS URL | ||
| if possible. | ||
| note: >- | ||
| [CWE-319] Authentication Bypass by Primary Weakness | ||
| [REFERENCES] | ||
| - https://cwe.mitre.org/data/definitions/319.html | ||
| rule: | ||
| pattern: <a $$$ href=$URL>$C</a> | ||
| constraints: | ||
| URL: | ||
| regex: ^['"`]?([Hh][Tt][Tt][Pp]://) | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,17 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id: cbc-padding-oracle-java | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| severity: warning | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| language: java | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: >- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Using CBC with PKCS5Padding is susceptible to padding oracle attacks. A | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| malicious actor could discern the difference between plaintext with valid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| or invalid padding. Further, CBC mode does not include any integrity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| checks. Use 'AES/GCM/NoPadding' instead. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| note: >- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [CWE-327] Use of a Broken or Risky Cryptographic Algorithm. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [REFERENCES] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - https://capec.mitre.org/data/definitions/463.html | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rule: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pattern: Cipher.getInstance($MODE) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| constraints: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MODE: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| regex: '.*/CBC/PKCS5Padding' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id: cbc-padding-oracle-java | |
| severity: warning | |
| language: java | |
| message: >- | |
| Using CBC with PKCS5Padding is susceptible to padding oracle attacks. A | |
| malicious actor could discern the difference between plaintext with valid | |
| or invalid padding. Further, CBC mode does not include any integrity | |
| checks. Use 'AES/GCM/NoPadding' instead. | |
| note: >- | |
| [CWE-327] Use of a Broken or Risky Cryptographic Algorithm. | |
| [REFERENCES] | |
| - https://capec.mitre.org/data/definitions/463.html | |
| rule: | |
| pattern: Cipher.getInstance($MODE) | |
| constraints: | |
| MODE: | |
| regex: '.*/CBC/PKCS5Padding' | |
| id: cbc-padding-oracle-java | |
| severity: warning | |
| language: java | |
| message: >- | |
| Using CBC with PKCS5Padding is susceptible to padding oracle attacks. A | |
| malicious actor could discern the difference between plaintext with valid | |
| or invalid padding. Further, CBC mode does not include any integrity | |
| checks. Use 'AES/GCM/NoPadding' instead. | |
| note: >- | |
| [CWE-327] Use of a Broken or Risky Cryptographic Algorithm. | |
| [REFERENCES] | |
| - https://capec.mitre.org/data/definitions/463.html | |
| rule: | |
| pattern: Cipher.getInstance($MODE) | |
| constraints: | |
| MODE: | |
| regex: '.*/CBC/PKCS5Padding' | |
| # Adding a newline at the end of the file | |
Tools
yamllint
[warning] 16-16: wrong indentation: expected 2 but found 6
(indentation)
[warning] 17-17: wrong indentation: expected 8 but found 10
(indentation)
[error] 17-17: no new line character at the end of file
(new-line-at-end-of-file)
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,16 @@ | ||||||||||||||
| id: desede-is-deprecated-java | ||||||||||||||
| language: java | ||||||||||||||
| severity: warning | ||||||||||||||
| message: >- | ||||||||||||||
| Triple DES (3DES or DESede) is considered deprecated. AES is the recommended cipher. Upgrade to use AES. | ||||||||||||||
| note: >- | ||||||||||||||
| [CWE-326]: Inadequate Encryption Strength | ||||||||||||||
| [OWASP A03:2017]: Sensitive Data Exposure | ||||||||||||||
| [OWASP A02:2021]: Cryptographic Failures | ||||||||||||||
| [REFERENCES] | ||||||||||||||
| - https://find-sec-bugs.github.io/bugs.htm#TDES_USAGE | ||||||||||||||
| - https://csrc.nist.gov/News/2017/Update-to-Current-Use-and-Deprecation-of-TDEA | ||||||||||||||
| rule: | ||||||||||||||
| any: | ||||||||||||||
| - pattern: $CIPHER.getInstance("=~/DESede.*/") | ||||||||||||||
| - pattern: $CRYPTO.KeyGenerator.getInstance("DES") | ||||||||||||||
| Comment on lines +14 to +16 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refine rule patterns to accurately target deprecated usage. The first pattern is well-targeted and should effectively catch instances of DESede usage. However, the second pattern might inadvertently flag all DES usages, not just DESede. This could lead to false positives since DES and DESede are related but distinct. Consider refining the second pattern to specifically include "DESede" to avoid broad matches that could affect the accuracy of the rule. Suggested change for the second pattern: - - pattern: $CRYPTO.KeyGenerator.getInstance("DES") + - pattern: $CRYPTO.KeyGenerator.getInstance("=~/DESede.*/")This change ensures that the pattern only flags the deprecated DESede usage, aligning it with the intent of the rule. Committable suggestion
Suggested change
| ||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,17 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id: no-null-cipher-java | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| severity: warning | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| language: java | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: >- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| NullCipher was detected. This will not encrypt anything; the cipher | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| text will be the same as the plain text. Use a valid, secure cipher: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Cipher.getInstance("AES/CBC/PKCS7PADDING"). See | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for more information. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| note: >- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [CWE-327] Use of a Broken or Risky Cryptographic Algorithm. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [REFERENCES] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - https://owasp.org/Top10/A02_2021-Cryptographic_Failures | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rule: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| any: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - pattern: new NullCipher($$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - pattern: new javax.crypto.NullCipher($$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id: no-null-cipher-java | |
| severity: warning | |
| language: java | |
| message: >- | |
| NullCipher was detected. This will not encrypt anything; the cipher | |
| text will be the same as the plain text. Use a valid, secure cipher: | |
| Cipher.getInstance("AES/CBC/PKCS7PADDING"). See | |
| https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions | |
| for more information. | |
| note: >- | |
| [CWE-327] Use of a Broken or Risky Cryptographic Algorithm. | |
| [REFERENCES] | |
| - https://owasp.org/Top10/A02_2021-Cryptographic_Failures | |
| rule: | |
| any: | |
| - pattern: new NullCipher($$$) | |
| - pattern: new javax.crypto.NullCipher($$$) | |
| id: no-null-cipher-java | |
| severity: warning | |
| language: java | |
| message: >- | |
| NullCipher was detected. This will not encrypt anything; the cipher | |
| text will be the same as the plain text. Use a valid, secure cipher: | |
| Cipher.getInstance("AES/CBC/PKCS7PADDING"). See | |
| https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions | |
| for more information. | |
| note: >- | |
| [CWE-327] Use of a Broken or Risky Cryptographic Algorithm. | |
| [REFERENCES] | |
| - https://owasp.org/Top10/A02_2021-Cryptographic_Failures | |
| rule: | |
| any: | |
| - pattern: new NullCipher($$$) | |
| - pattern: new javax.crypto.NullCipher($$$) | |
| # Ensure there is a newline at the end of the file |
Tools
yamllint
[warning] 16-16: wrong indentation: expected 12 but found 10
(indentation)
[error] 17-17: no new line character at the end of file
(new-line-at-end-of-file)
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||||||||
| id: rsa-no-padding-java | ||||||||||
| severity: warning | ||||||||||
| language: java | ||||||||||
| message: >- | ||||||||||
| Using RSA without OAEP mode weakens the encryption. | ||||||||||
| note: >- | ||||||||||
| [CWE-326] Inadequate Encryption Strength | ||||||||||
| [REFERENCES] | ||||||||||
| - https://rdist.root.org/2009/10/06/why-rsa-encryption-padding-is-critical/ | ||||||||||
| rule: | ||||||||||
| pattern: $YST.getInstance($MODE) | ||||||||||
| constraints: | ||||||||||
| MODE: | ||||||||||
| regex: 'RSA/[Nn][Oo][Nn][Ee]/NoPadding' | ||||||||||
| ||||||||||
| MODE: | |
| regex: 'RSA/[Nn][Oo][Nn][Ee]/NoPadding' | |
| MODE: | |
| regex: 'RSA/[Nn][Oo][Nn][Ee]/NoPadding' |
Tools
yamllint
[warning] 13-13: wrong indentation: expected 2 but found 6
(indentation)
[warning] 14-14: wrong indentation: expected 8 but found 10
(indentation)
[error] 14-14: no new line character at the end of file
(new-line-at-end-of-file)
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| id: desede-is-deprecated-kotlin | ||
| language: kotlin | ||
| severity: warning | ||
| message: >- | ||
| Triple DES (3DES or DESede) is considered deprecated. AES is the recommended cipher. Upgrade to use AES. | ||
| note: >- | ||
| [CWE-326]: Inadequate Encryption Strength | ||
| [OWASP A03:2017]: Sensitive Data Exposure | ||
| [OWASP A02:2021]: Cryptographic Failures | ||
| [REFERENCES] | ||
| - https://find-sec-bugs.github.io/bugs.htm#TDES_USAGE | ||
| - https://csrc.nist.gov/News/2017/Update-to-Current-Use-and-Deprecation-of-TDEA | ||
| rule: | ||
| any: | ||
| - pattern: $CIPHER.getInstance("=~/DESede.*/") | ||
| - pattern: $CRYPTO.KeyGenerator.getInstance("DES") |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,15 @@ | ||||||||||||||||||||||
| id: rsa-padding-set-scala | ||||||||||||||||||||||
| language: scala | ||||||||||||||||||||||
| severity: warning | ||||||||||||||||||||||
| message: >- | ||||||||||||||||||||||
| Usage of RSA without OAEP (Optimal Asymmetric Encryption Padding) may. | ||||||||||||||||||||||
| ||||||||||||||||||||||
| note: >- | ||||||||||||||||||||||
| [CWE-780] Use of RSA Algorithm without OAEP | ||||||||||||||||||||||
| [REFERENCES] | ||||||||||||||||||||||
| - https://owasp.org/Top10/A02_2021-Cryptographic_Failures | ||||||||||||||||||||||
| rule: | ||||||||||||||||||||||
| any: | ||||||||||||||||||||||
| - pattern: $CIPHER.getInstance($MODE) | ||||||||||||||||||||||
| constraints: | ||||||||||||||||||||||
| MODE: | ||||||||||||||||||||||
| regex: '.*RSA/.*/NoPadding.*' | ||||||||||||||||||||||
| ||||||||||||||||||||||
| any: | |
| - pattern: $CIPHER.getInstance($MODE) | |
| constraints: | |
| MODE: | |
| regex: '.*RSA/.*/NoPadding.*' | |
| any: | |
| - pattern: $CIPHER.getInstance($MODE) | |
| constraints: | |
| MODE: | |
| regex: '.*RSA/.*/NoPadding.*' |
Tools
yamllint
[warning] 14-14: wrong indentation: expected 2 but found 6
(indentation)
[warning] 15-15: wrong indentation: expected 8 but found 10
(indentation)
[error] 15-15: no new line character at the end of file
(new-line-at-end-of-file)
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| id: xmlinputfactory-dtd-enabled-scala | ||
| language: scala | ||
| severity: warning | ||
| message: >- | ||
| XMLInputFactory being instantiated without calling the setProperty | ||
| functions that are generally used for disabling entity processing. User | ||
| controlled data in XML Document builder can result in XML Internal Entity | ||
| Processing vulnerabilities like the disclosure of confidential data, | ||
| denial of service, Server Side Request Forgery (SSRF), port scanning. Make | ||
| sure to disable entity processing functionality. | ||
| note: >- | ||
| [CWE-611] Improper Restriction of XML External Entity. | ||
| [REFERENCES] | ||
| - https://owasp.org/Top10/A05_2021-Security_Misconfiguration | ||
| rule: | ||
| any: | ||
| - pattern: XMLInputFactory.newFactory($$$) | ||
| - pattern: XMLInputFactory.newInstance($$$) | ||
| - pattern: new XMLInputFactory($$$) | ||
| precedes: | ||
| not: | ||
| pattern: $XMLFACTORY.setProperty($MODE, false) | ||
| constraints: | ||
| MODE: | ||
| regex: 'javax.xml.stream.isSupportingExternalEntities' | ||
| ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| id: insecure-biometrics-swift | ||
| language: swift | ||
| severity: info | ||
| message: >- | ||
| The application was observed to leverage biometrics via Local | ||
| Authentication, which returns a simple boolean result for authentication. | ||
| This design is subject to bypass with runtime tampering tools such as | ||
| Frida, Substrate, and others. Although this is limited to rooted | ||
| (jailbroken) devices, consider implementing biometric authentication the | ||
| reliable way - via Keychain Services. | ||
| note: >- | ||
| [CWE-305] Authentication Bypass by Primary Weakness | ||
| [REFERENCES] | ||
| - https://mobile-security.gitbook.io/mobile-security-testing-guide/ios-testing-guide/0x06f-testing-local-authentication | ||
| - https://shirazkhan030.medium.com/biometric-authentication-in-ios-6c53c54f17df | ||
| rule: | ||
| pattern: | | ||
| $X.evaluatePolicy | ||
| ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| id: cbc-padding-oracle-java | ||
| snapshots: | ||
| Cipher.getInstance("AES/CBC/PKCS5Padding");: | ||
| labels: | ||
| - source: Cipher.getInstance("AES/CBC/PKCS5Padding") | ||
| style: primary | ||
| start: 0 | ||
| end: 42 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| id: desede-is-deprecated-java | ||
| snapshots: | ||
| ? | | ||
| Cipher.getInstance("DESede/ECB/PKCS5Padding"); | ||
| javax.crypto.KeyGenerator.getInstance("DES") | ||
| : labels: | ||
| - source: javax.crypto.KeyGenerator.getInstance("DES") | ||
| style: primary | ||
| start: 47 | ||
| end: 91 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| id: desede-is-deprecated-kotlin | ||
| snapshots: | ||
| ? | | ||
| Cipher.getInstance("DESede/ECB/PKCS5Padding"); | ||
| javax.crypto.KeyGenerator.getInstance("DES") | ||
| : labels: | ||
| - source: javax.crypto.KeyGenerator.getInstance("DES") | ||
| style: primary | ||
| start: 47 | ||
| end: 91 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| id: insecure-biometrics-swift | ||
| snapshots: | ||
| ? | | ||
| context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: "Authenticate to the application" | ||
| : labels: | ||
| - source: context.evaluatePolicy | ||
| style: primary | ||
| start: 0 | ||
| end: 22 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| id: no-null-cipher-java | ||
| snapshots: | ||
| ? |- | ||
| Cipher doNothingCihper = new NullCipher(); | ||
| new javax.crypto.NullCipher(); | ||
| : labels: | ||
| - source: new NullCipher() | ||
| style: primary | ||
| start: 25 | ||
| end: 41 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| id: plaintext-http-link-html | ||
| snapshots: | ||
| ? | | ||
| <a href="http://astgrep.dev">Astgrep</a> | ||
| <a href='http://astgrep.dev'>Astgrep</a> | ||
| <a href=http://astgrep.dev>Astgrep</a> | ||
| <a class="foo" href="http://astgrep.dev">Astgrep</a> | ||
| <a class='foo' href='http://astgrep.dev'>Astgrep</a> | ||
| <a class=foo href=http://astgrep.dev>Astgrep</a> | ||
| <a href="HTTP://ASTGREP.DEV">Astgrep</a> | ||
| : labels: | ||
| - source: <a href="http://astgrep.dev">Astgrep</a> | ||
| style: primary | ||
| start: 0 | ||
| end: 40 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| id: rsa-no-padding-java | ||
| snapshots: | ||
| ? |- | ||
| Cipher.getInstance("RSA/None/NoPadding"); | ||
| Cipher.getInstance("RSA/NONE/NoPadding"); | ||
| : labels: | ||
| - source: Cipher.getInstance("RSA/None/NoPadding") | ||
| style: primary | ||
| start: 0 | ||
| end: 40 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| id: rsa-padding-set-scala | ||
| snapshots: | ||
| Cipher.getInstance("RSA/ECB/NoPadding"): | ||
| labels: | ||
| - source: Cipher.getInstance("RSA/ECB/NoPadding") | ||
| style: primary | ||
| start: 0 | ||
| end: 39 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| id: sizeof-this-c | ||
| snapshots: | ||
| ? | | ||
| return sizeof(this); | ||
| : labels: | ||
| - source: sizeof(this) | ||
| style: primary | ||
| start: 7 | ||
| end: 19 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| id: xmlinputfactory-dtd-enabled-scala | ||
| snapshots: | ||
| ? |- | ||
| val factory = XMLInputFactory.newFactory() | ||
| val fileReader = new FileReader(file) | ||
| val fileReader = new FileReader(file) | ||
| : labels: | ||
| - source: XMLInputFactory.newFactory() | ||
| style: primary | ||
| start: 14 | ||
| end: 42 | ||
| Comment on lines +11 to +19 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicate line detected. There appears to be a duplicate line for creating a val fileReader = new FileReader(file)This might be a copy-paste error. Please confirm if this duplication is intentional or if one instance should be removed. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| id: sizeof-this-c | ||
| valid: | ||
| - | | ||
| return sizeof(*this); | ||
| invalid: | ||
| - | | ||
| return sizeof(this); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| id: plaintext-http-link-html | ||
| valid: | ||
| - | | ||
| <a href="https://astgrep.dev">Astgrep</a> | ||
| <a href="https://astgrep.dev/http://">Astgrep</a> | ||
| <a href="javascript:alert(1)">Astgrep</a> | ||
| invalid: | ||
| - | | ||
| <a href="http://astgrep.dev">Astgrep</a> | ||
| <a href='http://astgrep.dev'>Astgrep</a> | ||
| <a href=http://astgrep.dev>Astgrep</a> | ||
| <a class="foo" href="http://astgrep.dev">Astgrep</a> | ||
| <a class='foo' href='http://astgrep.dev'>Astgrep</a> | ||
| <a class=foo href=http://astgrep.dev>Astgrep</a> | ||
| <a href="HTTP://ASTGREP.DEV">Astgrep</a> |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,7 @@ | ||||||||
| id: cbc-padding-oracle-java | ||||||||
| valid: | ||||||||
| - | | ||||||||
| Cipher.getInstance("AES/GCM/NoPadding"); | ||||||||
| invalid: | ||||||||
| - | | ||||||||
| Cipher.getInstance("AES/CBC/PKCS5Padding"); | ||||||||
| ||||||||
| Cipher.getInstance("AES/CBC/PKCS5Padding"); | |
| Cipher.getInstance("AES/CBC/PKCS5Padding"); | |
Tools
yamllint
[error] 7-7: no new line character at the end of file
(new-line-at-end-of-file)
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| id: desede-is-deprecated-java | ||
| valid: | ||
| - | | ||
| Cipher.getInstance("AES/GCM/NoPadding"); | ||
| invalid: | ||
| - | | ||
| Cipher.getInstance("DESede/ECB/PKCS5Padding"); | ||
| javax.crypto.KeyGenerator.getInstance("DES") |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,8 @@ | ||||||||||||||||||||||||
| id: no-null-cipher-java | ||||||||||||||||||||||||
| valid: | ||||||||||||||||||||||||
| - | | ||||||||||||||||||||||||
| Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); | ||||||||||||||||||||||||
| invalid: | ||||||||||||||||||||||||
| - | | ||||||||||||||||||||||||
| Cipher doNothingCihper = new NullCipher(); | ||||||||||||||||||||||||
| new javax.crypto.NullCipher(); | ||||||||||||||||||||||||
| ||||||||||||||||||||||||
| Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); | |
| invalid: | |
| - | | |
| Cipher doNothingCihper = new NullCipher(); | |
| new javax.crypto.NullCipher(); | |
| Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); | |
| invalid: | |
| - | | |
| Cipher doNothingCihper = new NullCipher(); | |
| new javax.crypto.NullCipher(); | |
Tools
yamllint
[error] 8-8: no new line character at the end of file
(new-line-at-end-of-file)
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,8 @@ | ||||||||
| id: rsa-no-padding-java | ||||||||
| valid: | ||||||||
| - | | ||||||||
| Cipher.getInstance("RSA/ECB/OAEPWithMD5AndMGF1Padding"); | ||||||||
| invalid: | ||||||||
| - | | ||||||||
| Cipher.getInstance("RSA/None/NoPadding"); | ||||||||
| Cipher.getInstance("RSA/NONE/NoPadding"); | ||||||||
| ||||||||
| Cipher.getInstance("RSA/NONE/NoPadding"); | |
| Cipher.getInstance("RSA/NONE/NoPadding"); | |
Tools
yamllint
[error] 8-8: no new line character at the end of file
(new-line-at-end-of-file)
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| id: desede-is-deprecated-kotlin | ||
| valid: | ||
| - | | ||
| Cipher.getInstance("AES/GCM/NoPadding"); | ||
| invalid: | ||
| - | | ||
| Cipher.getInstance("DESede/ECB/PKCS5Padding"); | ||
| javax.crypto.KeyGenerator.getInstance("DES") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review of the new security rule for HTML: plaintext HTTP links.
plaintext-http-link-htmland the language specificationhtmlare appropriately set for the rule's purpose.info. Considering the security implications of using HTTP over HTTPS, this might be too low. It is recommended to increase the severity to at leastwarningto reflect the potential security risks more accurately.^['"]?([Hh][Tt][Tt][Pp]://)` might be overly restrictive as it assumes the URL starts immediately at the beginning of the attribute value. Consider modifying it to accommodate potential leading spaces or other characters.Consider the following improvements: