Skip to content

Add Swift UIWebView nil baseURL detection rule and update snapshots #189

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
bb7b8e1
removed missing-secure-java
Dec 16, 2024
308e947
Merge branch 'coderabbitai:main' into main
ESS-ENN Jan 6, 2025
46efd55
Merge branch 'coderabbitai:main' into main
ESS-ENN Jan 8, 2025
3ac0204
Merge branch 'coderabbitai:main' into main
ESS-ENN Jan 8, 2025
7caba92
Merge branch 'coderabbitai:main' into main
ESS-ENN Jan 9, 2025
d3a2776
Merge branch 'coderabbitai:main' into main
ESS-ENN Jan 10, 2025
2e86380
Merge branch 'coderabbitai:main' into main
ESS-ENN Jan 14, 2025
b072db7
Merge branch 'coderabbitai:main' into main
ESS-ENN Jan 20, 2025
65dce29
Merge branch 'coderabbitai:main' into main
ESS-ENN Jan 22, 2025
12bb3aa
httponly-false-csharp
ESS-ENN Jan 22, 2025
2c5ea88
use-of-md5-digest-utils-java
ESS-ENN Jan 22, 2025
d3067f1
removing use-of-md5-digest-utils and httponly-false-csharp
ESS-ENN Jan 22, 2025
56d4011
Merge branch 'coderabbitai:main' into main
ESS-ENN Jan 28, 2025
f7f1d72
Merge branch 'coderabbitai:main' into main
ESS-ENN Jan 29, 2025
0d53f8e
Merge branch 'coderabbitai:main' into main
ESS-ENN Feb 4, 2025
b622bca
Merge branch 'coderabbitai:main' into main
ESS-ENN Feb 6, 2025
67459bf
Merge branch 'coderabbitai:main' into main
ESS-ENN Feb 7, 2025
b8b2adb
Merge branch 'coderabbitai:main' into main
ESS-ENN Feb 18, 2025
9b29d0a
Merge branch 'coderabbitai:main' into main
ESS-ENN Mar 3, 2025
24510d4
Merge branch 'coderabbitai:main' into main
ESS-ENN Mar 4, 2025
6c6d229
Merge remote-tracking branch 'upstream/main' into main
ESS-ENN Mar 4, 2025
c5f0d85
Merge branch 'main' of https://github.com/ESS-ENN/ast-grep-essentials…
ESS-ENN Mar 4, 2025
4104e61
Merge branch 'coderabbitai:main' into main
ESS-ENN Mar 5, 2025
36b1114
Merge remote-tracking branch 'upstream/main' into main
ESS-ENN Mar 5, 2025
befc6b0
Merge branch 'main' of https://github.com/ESS-ENN/ast-grep-essentials…
ESS-ENN Mar 5, 2025
7bc886d
Merge branch 'coderabbitai:main' into main
ESS-ENN Mar 10, 2025
fc13546
Merge remote-tracking branch 'upstream/main' into main
ESS-ENN Mar 10, 2025
e4a1853
Merge branch 'main' of https://github.com/ESS-ENN/ast-grep-essentials…
ESS-ENN Mar 10, 2025
b6203b0
Merge branch 'coderabbitai:main' into main
ESS-ENN Mar 18, 2025
5327545
Merge remote-tracking branch 'upstream/main' into main
ESS-ENN Mar 20, 2025
f59e083
Merge remote-tracking branch 'upstream/main' into main
ESS-ENN Mar 25, 2025
e0d7253
Merge branch 'coderabbitai:main' into main
ESS-ENN Mar 27, 2025
a545c52
Merge remote-tracking branch 'upstream/main' into main
ESS-ENN Mar 27, 2025
a6d049d
Merge branch 'main' of https://github.com/ESS-ENN/ast-grep-essentials…
ESS-ENN Mar 27, 2025
33141b9
Merge branch 'coderabbitai:main' into main
ESS-ENN Mar 27, 2025
9996ae6
Merge remote-tracking branch 'upstream/main' into main
ESS-ENN Mar 27, 2025
8c3da56
Merge branch 'main' of https://github.com/ESS-ENN/ast-grep-essentials…
ESS-ENN Mar 27, 2025
836704e
swift-webview-config-base-url-swift
ESS-ENN Mar 27, 2025
e59366c
Removed python-neo4j extra files
ESS-ENN Mar 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions rules/swift/security/swift-webview-config-base-url-swift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
id: swift-webview-config-base-url-swift
severity: warning
language: swift
message: >-
UIWebView instances were observed where the baseURL is misconfigured as
nil, which allows for origin abuse within the webview. In order to remove
the effective origin, the application should explicitly set the baseURL to
`about:blank` or similar.
note: >-
[CWE-272] Least Privilege Violation.
[REFERENCES]
- https://mas.owasp.org/MASVS/controls/MASVS-PLATFORM-2/

ast-grep-essentials: true

utils:
matches_patttern_loadHTMLString_&_load:
kind: call_expression
all:
- has:
kind: navigation_expression
all:
- has:
kind: simple_identifier
pattern: $W
- has:
kind: navigation_suffix
has:
kind: simple_identifier
regex: ^(loadHTMLString|load)$
- has:
kind: call_suffix
has:
stopBy: end
kind: value_argument
all:
- has:
kind: simple_identifier
regex: "^baseURL$"
- has:
regex: "^nil$"
- any:
- follows:
stopBy: end
kind: property_declaration
all:
- has:
stopBy: end
kind: pattern
has:
stopBy: neighbor
kind: simple_identifier
pattern: $W
- has:
stopBy: neighbor
kind: call_expression
all:
- has:
stopBy: neighbor
kind: simple_identifier
regex: "^UIWebView$"
- has:
stopBy: neighbor
kind: call_suffix
- inside:
stopBy: end
follows:
stopBy: end
kind: property_declaration
all:
- has:
stopBy: end
kind: pattern
has:
stopBy: neighbor
kind: simple_identifier
pattern: $W
- has:
stopBy: neighbor
kind: call_expression
all:
- has:
stopBy: neighbor
kind: simple_identifier
regex: "^UIWebView$"
- has:
stopBy: neighbor
kind: call_suffix
rule:
kind: call_expression
matches: matches_patttern_loadHTMLString_&_load
not:
all:
- has:
stopBy: end
kind: ERROR
- inside:
stopBy: end
kind: ERROR

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id: swift-webview-config-base-url-swift
snapshots: {}
Loading