Skip to content

Add: more socket ssl builtin functions#2217

Open
jjnicola wants to merge 7 commits into
mainfrom
rs-tls-socket
Open

Add: more socket ssl builtin functions#2217
jjnicola wants to merge 7 commits into
mainfrom
rs-tls-socket

Conversation

@jjnicola

@jjnicola jjnicola commented May 21, 2026

Copy link
Copy Markdown
Member

What:
Add:

  • socket_get_ssl_session_id()
  • socket_get_ssl_ciphersuite()

Fix:

  • socket_get_ssl_version()

SC-1450
SC-1447
SC-1449

Why:

How:

Checklist:

  • Tests
  • PR merge commit message adjusted

@jjnicola jjnicola requested a review from a team as a code owner May 21, 2026 12:42
@jjnicola jjnicola marked this pull request as draft May 21, 2026 12:42
@github-actions

github-actions Bot commented May 21, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA 569202d.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

Scanned Files

None

@github-actions github-actions Bot added minor_release creates a minor release and removed minor_release creates a minor release labels May 21, 2026
@jjnicola jjnicola marked this pull request as ready for review May 25, 2026 11:00
@jjnicola jjnicola enabled auto-merge (squash) May 25, 2026 11:00
Comment thread rust/src/nasl/builtin/network/tcp.rs Outdated
Comment on lines +81 to +89

// pub fn get_tls_ticket (&self) -> &[u8] {
// let mut unique_binding = [0u8; 32];
// if let Some(conn) = self.tls {
// return conn.export_keying_material(&mut unique_binding, b"", None).unwrap();
// }
// &[]
//
// }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove?

Comment thread rust/src/nasl/builtin/network/tls.rs Outdated

#[derive(Debug)]
pub struct MemoryKeyLogger {
// Usamos Arc<Mutex<>> para que sea seguro modificarlo entre hilos

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As much as I am for the diversification of our code base, we should probably translate this :D

Comment thread rust/src/nasl/builtin/network/tls.rs Outdated
Comment on lines +72 to +91
//#[derive(Debug)]
//pub struct SessionIdLogger{
// pub storage: Arc<Mutex<Vec<String>>>,
//}
//
//impl KeyLog for SessionIdLogger {
// fn log(&self, label: &str, client_random: &[u8], _secret: &[u8]) {
// // Only log on the first handshake secret message to avoid duplicate log noise
// if label == "CLIENT_HANDSHAKE_TRAFFIC_SECRET" || label == "CLIENT_RANDOM" {
// // Format bytes as a hex string for easy readability in your log aggregator
// let session_hex: String = client_random
// .iter()
// .map(|b| format!("{:02x}", b))
// .collect();
// if let Ok(mut lock) = self.storage.lock() {
// lock.push(session_hex);
// }
// }
// }
//}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove?

Comment thread rust/src/nasl/builtin/network/tls.rs Outdated
if label == "CLIENT_HANDSHAKE_TRAFFIC_SECRET" {
let session_hex: String = client_random.iter().map(|b| format!("{:02x}", b)).collect();

// Bloqueamos el Mutex temporalmente para añadir el ID a la lista

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment thread rust/src/nasl/builtin/network/tcp.rs Outdated
sock: Socket,
tls: Option<ClientConnection>,
transport: Option<OpenvasEncaps>,
session_id: Arc<Mutex<Vec<String>>>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the data structure here, why is this a Vec?

@github-actions github-actions Bot added minor_release creates a minor release and removed minor_release creates a minor release labels Jun 23, 2026
Comment thread rust/src/nasl/builtin/network/socket.rs Outdated

#[nasl_function(named(socket))]
async fn socket_get_ssl_ciphersuite(
nasl_sockets: &mut NaslSockets,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this &mut here? Feels like we should be able to change this to &NaslSockets and use get_open_socket below.

Doesn't look to relevant right now, but this might be something blocking concurrency once we introduce it properly

Comment thread rust/src/nasl/builtin/network/socket.rs Outdated

#[nasl_function(named(socket))]
async fn socket_get_ssl_session_id(
nasl_sockets: &mut NaslSockets,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Comment thread rust/src/nasl/builtin/network/tls.rs
@github-actions github-actions Bot added minor_release creates a minor release and removed minor_release creates a minor release labels Jun 24, 2026
@github-actions github-actions Bot added minor_release creates a minor release and removed minor_release creates a minor release labels Jun 24, 2026
@github-actions github-actions Bot added minor_release creates a minor release and removed minor_release creates a minor release labels Jun 24, 2026
@jjnicola jjnicola requested a review from Tehforsch June 24, 2026 13:33
Tehforsch
Tehforsch previously approved these changes Jun 25, 2026

@Tehforsch Tehforsch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Tehforsch
Tehforsch previously approved these changes Jun 25, 2026
@github-actions github-actions Bot removed the minor_release creates a minor release label Jun 25, 2026
@github-actions github-actions Bot added the minor_release creates a minor release label Jun 25, 2026
@github-actions github-actions Bot added minor_release creates a minor release and removed minor_release creates a minor release labels Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor_release creates a minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants