Skip to content
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

fix: handle InvalidLabelChar in URL validation to prevent panic #24080

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift click to select a range
f979e0c
handle InvalidLabelChar in URL validation to prevent panic
yazan-abdalrahman Jun 2, 2024
2d8e29a
ci: trigger CI pipeline
yazan-abdalrahman Jun 3, 2024
ba2b828
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 3, 2024
a5199a3
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 4, 2024
78ddde1
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 4, 2024
1fe2399
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 5, 2024
6d254a1
fix lint issues
yazan-abdalrahman Jun 6, 2024
c8488b6
Merge remote-tracking branch 'origin/fix-url-validation-panic' into f…
yazan-abdalrahman Jun 6, 2024
3a875fd
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 6, 2024
9971b64
handle empty value
yazan-abdalrahman Jun 9, 2024
6a92d09
Merge branch 'main' of https://github.com/yazan-abdalrahman/deno into…
yazan-abdalrahman Jun 9, 2024
5db82f3
fix cyclic dependence
yazan-abdalrahman Jun 10, 2024
f942a31
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 10, 2024
9146e36
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 11, 2024
e8b5b29
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 11, 2024
c20874c
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 11, 2024
7cff4e2
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 11, 2024
a8324ae
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 12, 2024
2a4dc4b
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 12, 2024
3655231
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 13, 2024
41b0cb2
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 13, 2024
94fe173
Merge branch 'main' of https://github.com/yazan-abdalrahman/deno into…
yazan-abdalrahman Jun 20, 2024
5178a56
Merge branch 'main' of https://github.com/yazan-abdalrahman/deno into…
yazan-abdalrahman Jun 23, 2024
d4ed2f9
Merge branch 'main' of https://github.com/yazan-abdalrahman/deno into…
yazan-abdalrahman Jun 24, 2024
7a50fde
fix test failures
yazan-abdalrahman Jun 24, 2024
8701009
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 24, 2024
378a168
Remove file
dsherret Jun 24, 2024
f0642d3
Remove processing a URL &&
yazan-abdalrahman Jun 25, 2024
f156f3f
Merge remote-tracking branch 'origin/fix-url-validation-panic' into f…
yazan-abdalrahman Jun 25, 2024
8012e79
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 25, 2024
731de60
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 25, 2024
81cee0c
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 25, 2024
a566a11
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 26, 2024
57da102
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jun 27, 2024
4f7d572
add support for latin characters for domain and fix IPv6 parsing
yazan-abdalrahman Jul 1, 2024
3978b24
Merge branch 'main' into fix-url-validation-panic
yazan-abdalrahman Jul 1, 2024
e7df56f
Merge remote-tracking branch 'refs/remotes/origin/main' into fix-url-…
yazan-abdalrahman Jul 2, 2024
a1441e4
format
yazan-abdalrahman Jul 2, 2024
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
Prev Previous commit
Next Next commit
fix cyclic dependence
  • Loading branch information
yazan-abdalrahman committed Jun 10, 2024
commit 5db82f325505bfa2780a54de39f4261df1c109c6
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 14 additions & 8 deletions ext/net/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

pub mod host;
pub mod io;
pub mod ops;
pub mod ops_tls;
Expand All @@ -10,11 9,12 @@ pub mod raw;
pub mod resolve_addr;
mod tcp;

use crate::host::extract_host;
use crate::host::split_host_port;
use crate::host::Host;
use deno_core::error::AnyError;
use deno_core::OpState;
use deno_permissions::host::extract_host;
use deno_permissions::host::split_host_port;
use deno_permissions::host::Host;
use deno_permissions::NetDescriptor;
use deno_tls::rustls::RootCertStore;
use deno_tls::RootCertStoreProvider;
use std::path::Path;
Expand Down Expand Up @@ -67,12 67,18 @@ pub trait NetPermissions {

impl NetPermissions for deno_permissions::PermissionsContainer {
#[inline(always)]
fn check_net<T: AsRef<str>>(
fn check_net(
&mut self,
host: &(T, Option<u16>),
host: &NetPermissionHost,
api_name: &str,
) -> Result<(), AnyError> {
deno_permissions::PermissionsContainer::check_net(self, host, api_name)
let _host = host.clone().host;
let _port = host.clone().port;
deno_permissions::PermissionsContainer::check_net(
self,
&NetDescriptor(_host, _port),
api_name,
)
}

#[inline(always)]
Expand Down Expand Up @@ -217,7 223,7 @@ mod ops_unix {
#[cfg(test)]
mod tests {
use super::NetPermissionHost;
use crate::host::Host;
use deno_permissions::host::Host;
use fqdn::FQDN;
use std::net::Ipv4Addr;
use std::net::Ipv6Addr;
Expand Down
6 changes: 3 additions & 3 deletions ext/net/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 14,6 @@ use deno_core::error::AnyError;
use deno_core::op2;
use deno_core::CancelFuture;

use crate::host::extract_host;
use crate::host::split_host_port;
use crate::host::Host;
use deno_core::AsyncRefCell;
use deno_core::ByteString;
use deno_core::CancelHandle;
Expand All @@ -26,6 23,9 @@ use deno_core::OpState;
use deno_core::RcRef;
use deno_core::Resource;
use deno_core::ResourceId;
use deno_permissions::host::extract_host;
use deno_permissions::host::split_host_port;
use deno_permissions::host::Host;
use serde::Deserialize;
use serde::Serialize;
use socket2::Domain;
Expand Down
1 change: 0 additions & 1 deletion runtime/permissions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 15,6 @@ path = "lib.rs"

[dependencies]
deno_core.workspace = true
deno_net.workspace = true
deno_terminal.workspace = true
fqdn.workspace = true
libc.workspace = true
Expand Down
File renamed without changes.
8 changes: 5 additions & 3 deletions runtime/permissions/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

pub mod host;

use deno_core::anyhow::Context;
use deno_core::error::custom_error;
use deno_core::error::type_error;
Expand All @@ -16,9 18,6 @@ use deno_core::url;
use deno_core::url::ParseError;
use deno_core::url::Url;
use deno_core::ModuleSpecifier;
use deno_net::host::extract_host;
use deno_net::host::split_host_port;
use deno_net::host::Host;
use deno_terminal::colors;
use once_cell::sync::Lazy;
use std::borrow::Cow;
Expand All @@ -39,6 38,9 @@ use prompter::permission_prompt;
use prompter::PromptResponse;
use prompter::PERMISSION_EMOJI;

use crate::host::extract_host;
use crate::host::split_host_port;
use crate::host::Host;
pub use prompter::set_prompt_callbacks;
pub use prompter::PromptCallback;

Expand Down