Skip to content

Conversation

jlucovsky
Copy link
Contributor

@jlucovsky jlucovsky commented Aug 15, 2025

Continuation of #13621

Use unique variable names for each flowvar as they come from a global
namespace. The chosen name is: sid:<signature_id>;buffer:<buffer-name>;instance:<instance#>

Describe changes:

  • Use a unique name for flowvar by appending the signature id to the name and the occurrence value. The occurrence values start from 1 and are significant if multiple entropy values are used in a single rule. They start from 1.

Updates:

  • Add a config setting to control whether unique names are generated: logging.entropy.make-unique
  • Document new configuration setting and how output is affected.
  • Disambiguate entropy output by adding the instance number.
  • Changed variable name to sid:<signature_id>;buffer:<buffer-name>;instance:<instance#>

Issue: 7814

Link to ticket: https://redmine.openinfosecfoundation.org/issues/7814

Provide values to any of the below to override the defaults.

  • To use a Suricata-Verify or Suricata-Update pull request,
    link to the pull request in the respective _BRANCH variable.
  • Leave unused overrides blank or remove.

SV_REPO=
SV_BRANCH=OISF/suricata-verify#2588
SU_REPO=
SU_BRANCH=

Issue: 7814

Support unique flow variable names for entropy-related values.

Since this is a breaking change from Suricata 8, unique names
are configurable (default value off) with this setting

        logging:
          entropy:
            make-unique: on

When `make-unique` is on, entropy-related flow variable names are
structured as:
     sid:<sid>;buffer:<buffer>;instance:<instance>

Instance is a small integer value corresponding to the number of
entropy values in the rule. The first entropy usage will create a flow
variable with an instance value of 1; the second will use 2, and so
on. This is necessary to disambiguate the flow variable names.

When `make-unique` is off (default = off), this format is used:
     <sticky_buffer>
Discuss the new configuration variable that provides unique
names for entropy values in logging output: logging.entropy.make-unique

Issue: 7418
Copy link

codecov bot commented Aug 15, 2025

Codecov Report

❌ Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.73%. Comparing base (b93a277) to head (bfd3ad4).
⚠️ Report is 81 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13722      +/-   ##
==========================================
+ Coverage   82.99%   83.73%   +0.73%     
==========================================
  Files        1001     1011      +10     
  Lines      272978   275083    +2105     
==========================================
+ Hits       226556   230328    +3772     
+ Misses      46422    44755    -1667     
Flag Coverage Δ
fuzzcorpus 62.90% <13.04%> (+0.02%) ⬆️
livemode 19.13% <0.00%> (?)
pcap 44.70% <0.00%> (+0.01%) ⬆️
suricata-verify 65.08% <95.65%> (+<0.01%) ⬆️
unittests 59.17% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline = 27165

Comment on lines +756 to +760
"metadata": {
"entropy": {
"file_data_391933_1": 4.265743301617466
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We gave up on the idea of having an array, here, so as to not have to append the instance to the name? Or was it too ugly to implement?

entropy was calculated. Often, more context is needed and the configuration setting shown
below will amend the sticky buffer name with the signature id and instance number from the rule
that caused the entropy value calculation. The instance number changes for each ``entropy``
keyword usage within a rule. The default value is ``off``. We strongly recommend changing
Copy link
Contributor

Choose a reason for hiding this comment

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

very nit:

Suggested change
keyword usage within a rule. The default value is ``off``. We strongly recommend changing
keyword usage within a rule. The default value is ``off``. We strongly recommend changing

@catenacyber
Copy link
Contributor

Disambiguate entropy output by adding the instance number.

What is this instance number ?

@jlucovsky
Copy link
Contributor Author

Disambiguate entropy output by adding the instance number.

What is this instance number ?

The instance number tracks the occurrence of the keyword in each rule.
The first is 1, the second is 2 and so on.

Not all rules will have multiple occurrences of the keyword in a single rule.

@catenacyber
Copy link
Contributor

Disambiguate entropy output by adding the instance number.

What is this instance number ?

The instance number tracks the occurrence of the keyword in each rule. The first is 1, the second is 2 and so on.

Not all rules will have multiple occurrences of the keyword in a single rule.

So, I fear this does not remove ambiguity in case of multi-buffers, right ?

sid:<signature_id>;buffer:<buffer-name>;instance:<instance#> where instance is the occurrence of the keyword in some rule, means that you do not know which dns request or http header had too much entropy... Right ?

@catenacyber catenacyber added the needs rebase Needs rebase to main label Sep 17, 2025
Copy link
Contributor

@catenacyber catenacyber left a comment

Choose a reason for hiding this comment

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

Needs a rebase, and I would like to have a clear definition of "instance"

And maybe more tests with multi-buffer like
http.request_header; content: toto; entropy: >4; http.request_header; content: titi; entropy: <4; (and the first header titi does not have entropy < 4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs rebase Needs rebase to main
Development

Successfully merging this pull request may close these issues.

4 participants