Skip to content

DART-247 Modify rule S4830: Add Dart language #4978

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 2 commits into from
May 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions docs/header_names/allowed_framework_names.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,5 @@
* Helm
// Kotlin
Jetpack Compose
// Dart/Flutter
dart:io library
24 changes: 24 additions & 0 deletions rules/S4830/dart/how-to-fix-it/dart-io-library.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
== How to fix it in dart:io library

=== Code examples

include::../../common/fix/code-rationale.adoc[]

The certificate validation gets disabled by implementing a `badCertificateCallback` that always return `true`. It is highly recommended to use the original implementation and to avoid any bypass.

==== Noncompliant code example

[source,dart]
----
class MyHttpOverrides extends HttpOverrides {
@override
HttpClient createHttpClient(context) {
return super.createHttpClient(context)
..badCertificateCallback = (cert, String host, int port) => true; // Noncompliant
}
}
----

=== How does this work?

include::../../common/fix/validation.adoc[]
41 changes: 41 additions & 0 deletions rules/S4830/dart/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"securityStandards": {
"CWE": [
295
],
"OWASP": [
"A6",
"A3"
],
"OWASP Mobile": [
"M3"
],
"OWASP Mobile Top 10 2024": [
"M5"
],
"MASVS": [
"MSTG-NETWORK-3"
],
"OWASP Top 10 2021": [
"A2",
"A5",
"A7"
],
"PCI DSS 3.2": [
"4.1",
"6.5.4",
"6.5.10"
],
"PCI DSS 4.0": [
"4.2.1",
"6.2.4"
],
"ASVS 4.0": [
"1.9.2",
"9.2.1"
],
"STIG ASD_V5R3": [
"V-222550"
]
}
}
33 changes: 33 additions & 0 deletions rules/S4830/dart/rule.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
include::../summary.adoc[]

== Why is this an issue?

include::../rationale.adoc[]

include::../impact.adoc[]

// How to fix it section

include::how-to-fix-it/dart-io-library.adoc[]

== Resources

include::../common/resources/standards-mobile.adoc[]

* https://wiki.sei.cmu.edu/confluence/display/java/MSC61-J.+Do+not+use+insecure+or+weak+cryptographic+algorithms

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::../message.adoc[]

'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]

endif::env-github,rspecator-view[]