Skip to content

test: adds test for lua http2 library - #3232

Closed
catenacyber wants to merge 1 commit into
OISF:masterfrom
catenacyber:http2-lua-6409-v1
Closed

test: adds test for lua http2 library#3232
catenacyber wants to merge 1 commit into
OISF:masterfrom
catenacyber:http2-lua-6409-v1

Conversation

@catenacyber

Copy link
Copy Markdown
Collaborator

Ticket

Redmine ticket: https://redmine.openinfosecfoundation.org/issues/6409

Suricata PR still a draft with some questions here

@catenacyber catenacyber added the requires suricata pr Depends on a PR in Suricata label Jul 13, 2026
@@ -0,0 +1,2 @@
alert http2:stream:request_headers any any -> any any (msg: "Test HTTP2 Lua"; lua: http2.lua; sid:1;)
alert http1:request_line any any -> any any (msg: "Test HTTP2 Lua"; lua: http2.lua; sid:2;)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@jasonish what would be the good way to run lua: http2.lua; whatever the HTTP protocol ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure I know enough about how the http abstraction over http1 and http2 works to comment. I guess we need to decide if there should even be a common abstraction, or if Lua scripts should be specific enough to the version of http being processed. I guess for the command things, URLs, etc. a common abstraction would be ideal.

Would/do existing scripts need to be updated to validate what version of http they are working against to avoid making a bad call?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I guess we need to decide if there should even be a common abstraction

Indeed, asked in the suricata draft PR ;-)
I think there should be one

Would/do existing scripts need to be updated to validate what version of http they are working against to avoid making a bad call?

We can do multiple scenarios here :

  • either make lua http work for http2, like we did alert http now works transparently for http2, and add functions that could check the http version later in script
  • introduce a new get_tx_whatever_the_http_version function, and keep the get_tx for HTTP1 only, so current scripts remain http1 only, but it is is easy to upgrade them to do both HTTP versions

@@ -0,0 +1,19 @@
-- simple http match on request_headers_raw module
local http = require("suricata.http")

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think we will want for lua what we have for rules in suricata : something like :

  • http means http whatever version
  • http1 only http1
  • http2 only http2

Should I add a function a bit like LuaFlowAppLayerProto to get the HTTP version of the flow alproto ?

@jasonish jasonish Jul 13, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think that makes sense. Right now suricata.http is specifically http1 right? Not sure we'd want to break that, even on a major version upgrade.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think we want to break/extend this for 9...

@catenacyber

Copy link
Copy Markdown
Collaborator Author

Replaced by #3315

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires suricata pr Depends on a PR in Suricata

Development

Successfully merging this pull request may close these issues.

2 participants