• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

OISF / suricata / 22618661228

02 Mar 2026 09:33PM UTC coverage: 42.258% (-34.4%) from 76.611%
22618661228

push

github

victorjulien
github-actions: bump actions/download-artifact from 7.0.0 to 8.0.0

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 7.0.0 to 8.0.0.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/37930b1c2...70fc10c6e)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 8.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

91511 of 216553 relevant lines covered (42.26%)

3416852.41 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.21
/src/detect-base64-data.c
1
/* Copyright (C) 2015 Open Information Security Foundation
2
 *
3
 * You can copy, redistribute or modify this Program under the terms of
4
 * the GNU General Public License version 2 as published by the Free
5
 * Software Foundation.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 * GNU General Public License for more details.
11
 *
12
 * You should have received a copy of the GNU General Public License
13
 * version 2 along with this program; if not, write to the Free Software
14
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15
 * 02110-1301, USA.
16
 */
17

18
#include "suricata-common.h"
19
#include "detect.h"
20
#include "detect-engine.h"
21
#include "detect-engine-content-inspection.h"
22
#include "detect-parse.h"
23
#include "detect-base64-data.h"
24
#include "detect-engine-build.h"
25

26
#include "util-unittest.h"
27

28
static int DetectBase64DataSetup(DetectEngineCtx *, Signature *, const char *);
29
#ifdef UNITTESTS
30
static void DetectBase64DataRegisterTests(void);
31
#endif
32

33
void DetectBase64DataRegister(void)
34
{
7✔
35
    sigmatch_table[DETECT_BASE64_DATA].name = "base64_data";
7✔
36
    sigmatch_table[DETECT_BASE64_DATA].desc =
7✔
37
        "Content match base64 decoded data.";
7✔
38
    sigmatch_table[DETECT_BASE64_DATA].url =
7✔
39
        "/rules/base64-keywords.html#base64-data";
7✔
40
    sigmatch_table[DETECT_BASE64_DATA].Setup = DetectBase64DataSetup;
7✔
41
#ifdef UNITTESTS
42
    sigmatch_table[DETECT_BASE64_DATA].RegisterTests =
43
        DetectBase64DataRegisterTests;
44
#endif
45
    sigmatch_table[DETECT_BASE64_DATA].flags |= SIGMATCH_NOOPT;
7✔
46
}
7✔
47

48
static int DetectBase64DataSetup(DetectEngineCtx *de_ctx, Signature *s,
49
    const char *str)
50
{
31✔
51
    SigMatch *pm = NULL;
31✔
52

53
    /* Check for a preceding base64_decode. */
54
    pm = SCDetectGetLastSMFromLists(s, DETECT_BASE64_DECODE, -1);
31✔
55
    if (pm == NULL) {
31✔
56
        SCLogError("\"base64_data\" keyword seen without preceding base64_decode.");
×
57
        return -1;
×
58
    }
×
59

60
    s->init_data->list = DETECT_SM_LIST_BASE64_DATA;
31✔
61
    return 0;
31✔
62
}
31✔
63

64
#ifdef UNITTESTS
65

66
static int g_file_data_buffer_id = 0;
67

68
static int DetectBase64DataSetupTest01(void)
69
{
70
    DetectEngineCtx *de_ctx = DetectEngineCtxInit();
71
    FAIL_IF_NULL(de_ctx);
72

73
    de_ctx->flags |= DE_QUIET;
74
    Signature *s = DetectEngineAppendSig(de_ctx,
75
            "alert smtp any any -> any any (msg:\"DetectBase64DataSetupTest\"; "
76
            "base64_decode; base64_data; content:\"content\"; sid:1; rev:1;)");
77
    FAIL_IF_NULL(s);
78

79
    SigMatch *sm = s->init_data->smlists[DETECT_SM_LIST_PMATCH];
80
    FAIL_IF_NULL(sm);
81
    FAIL_IF_NOT(sm->type == DETECT_BASE64_DECODE);
82
    FAIL_IF_NULL(s->init_data->smlists[DETECT_SM_LIST_BASE64_DATA]);
83

84
    DetectEngineCtxFree(de_ctx);
85
    PASS;
86
}
87

88
/**
89
 * \test Test that the list can be changed to post-detection lists
90
 *     after the base64 keyword.
91
 */
92
static int DetectBase64DataSetupTest04(void)
93
{
94
    DetectEngineCtx *de_ctx = DetectEngineCtxInit();
95
    FAIL_IF_NULL(de_ctx);
96

97
    de_ctx->flags |= DE_QUIET;
98
    Signature *s = DetectEngineAppendSig(de_ctx,
99
            "alert tcp any any -> any any (msg:\"some b64thing\"; flow:established,from_server; "
100
            "file_data; content:\"sometext\"; fast_pattern; base64_decode:relative; base64_data; "
101
            "content:\"foobar\"; nocase; tag:session,120,seconds; sid:1111111; rev:1;)");
102
    FAIL_IF_NULL(s);
103

104
    DetectEngineCtxFree(de_ctx);
105
    PASS;
106
}
107

108
static void DetectBase64DataRegisterTests(void)
109
{
110
    g_file_data_buffer_id = DetectBufferTypeGetByName("file_data");
111

112
    UtRegisterTest("DetectBase64DataSetupTest01", DetectBase64DataSetupTest01);
113
    UtRegisterTest("DetectBase64DataSetupTest04", DetectBase64DataSetupTest04);
114
}
115
#endif /* UNITTESTS */
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc