Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2af2694
Add worker and local dev nugget tools
tj-cisco Mar 31, 2026
260d335
Polish local dev tool output and telemetry
tj-cisco Mar 31, 2026
d33d649
Default rzb-dev log mask
tj-cisco Mar 31, 2026
afb2c54
Harden local tool edge cases
tj-cisco Mar 31, 2026
150bad6
Add shared schema pointer
tj-cisco Jun 23, 2026
fe8788a
Add dispatcher-next message support
tj-cisco Jun 24, 2026
7475432
Add dispatcher-next C&C helpers
tj-cisco Jun 25, 2026
16fc3f7
Rename phase telemetry labels to stages
tj-cisco Jun 25, 2026
29406b4
Add dispatcher-next SDK runtime support
tj-cisco Jun 25, 2026
b2dc5b1
Ignore SDK-C build artifacts
tj-cisco Jun 25, 2026
72fcde7
Add phase 10 analysis result helpers
tj-cisco Jun 26, 2026
94c3522
Replace legacy transfer with HTTP fileserver
tj-cisco Jun 26, 2026
98b5d92
Update shared schema submodule
tj-cisco Jun 26, 2026
bd69a04
Update C SDK dispatcher-next message helpers
tj-cisco Jun 27, 2026
5a3f675
Point C SDK smoke at deployment stack
tj-cisco Jun 28, 2026
094daad
Align C SDK runtime telemetry with phase 14
tj-cisco Jun 28, 2026
291c984
Use relative schema submodule URL
tj-cisco Jun 30, 2026
1ca77f7
Align container image defaults with GHCR
tj-cisco Jun 30, 2026
d340824
Add AMQPS support to live smoke tests
tj-cisco Jun 30, 2026
9a7ff0f
Align search export validation with index contract
tj-cisco Jul 2, 2026
e25bde6
Update shared schema reference
tj-cisco Jul 3, 2026
a98d6cc
Enforce C SDK metadata value limits
tj-cisco Jul 6, 2026
1c20016
Declare named queues as quorum
tj-cisco Jul 8, 2026
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
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,32 @@ int main(void)
}
```

## Tooling

The API build now installs two helper binaries for nugget development and
operation.

`rzb-worker` loads a single nugget module through the existing `initNug()` /
`shutdownNug()` interface and keeps it running with the normal Razorback
runtime:

```bash
src/rzb-worker --debug --health-port=8080 /path/to/nugget.so
```

`rzb-dev` also loads a nugget through `initNug()` / `shutdownNug()`, but it
enables an internal local-only dev mode first so the created context does not
require broker connections or other external Razorback services. It runs one
file through the nugget's inspection hook and prints the resulting judgments
and submissions:

```bash
src/rzb-dev --type=image/svg+xml /path/to/nugget.so /path/to/input.file
```

If `--type` is omitted, `rzb-dev` will infer the datatype only when the nugget
registers exactly one inspection datatype.

## Health Checks

Razorback provides a small process-wide health subsystem for library consumers
Expand Down
7 changes: 4 additions & 3 deletions api.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,10 @@
<ClCompile Include="src\block_pool.c" />
<ClCompile Include="src\command_and_control.c" />
<ClCompile Include="src\config_file.c" />
<ClCompile Include="src\connected_entity.c" />
<ClCompile Include="src\crypto.c" />
<ClCompile Include="src\daemon.c" />
<ClCompile Include="src\connected_entity.c" />
<ClCompile Include="src\crypto.c" />
<ClCompile Include="src\daemon.c" />
<ClCompile Include="src\dev_mode.c" />

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Compile dispatcher-next sources in the MSVC project

When building with api.vcxproj, this adds only dev_mode.c; the same commit exposes public dispatcher-next APIs but this project still omits their implementations (config_next.c, fileserver.c, message_body.c, messages_next.c, and runtime_next.c) that are included in the autotools build. MSVC builds will produce a library without those new symbols, so Windows consumers using the new headers get unresolved externals. Add the same new sources to the project and filters.

Useful? React with 👍 / 👎.

<ClCompile Include="src\event.c" />
<ClCompile Include="src\fantasia.c" />
<ClCompile Include="src\hash.c" />
Expand Down
15 changes: 9 additions & 6 deletions api.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,15 @@
<ClCompile Include="src\string_list.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\submission.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\thread.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\submission.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\dev_mode.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\thread.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\thread_pool.c">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down
1 change: 1 addition & 0 deletions include/razorback/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ struct RazorbackCommandAndControlHooks


#define CONTEXT_FLAG_STAND_ALONE 0x00000001
#define CONTEXT_FLAG_DEV_TOOL 0x00000002

/** API Context
*/
Expand Down
16 changes: 16 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@
# MA 02110-1301, USA.

lib_LTLIBRARIES = librazorback_api.la
bin_PROGRAMS = rzb-worker rzb-dev

noinst_HEADERS = \
api_internal.h \
block_pool_private.h \
command_and_control.h \
connected_entity_private.h \
dev_mode.h \
fantasia.h \
health_internal.h \
init.h \
inspection.h \
judgment_private.h \
local_cache.h \
nugget_tool.h \
messages/core.h \
messages/cnc/core.h \
runtime_config.h \
Expand All @@ -44,6 +47,7 @@ config_file.c \
connected_entity.c \
crypto.c \
daemon.c \
dev_mode.c \
event.c \
fantasia.c \
hash.c \
Expand Down Expand Up @@ -101,6 +105,18 @@ transfer/ssh.c \
uuids.c \
telemetry_otel.cc

rzb_worker_SOURCES = \
rzb_worker.c \
nugget_tool.c

rzb_worker_LDADD = librazorback_api.la

rzb_dev_SOURCES = \
rzb_dev.c \
nugget_tool.c

rzb_dev_LDADD = librazorback_api.la

#librazorback_api_la_CFLAGS = -DBUILDING_SO -I$(top_srcdir)/libssh/include -I$(top_srcdir)/include
#librazorback_api_la_LDFLAGS = -version-info @APIVERSION@ @XCCFLAGS@ ../libssh/src/libssh.la
librazorback_api_la_CFLAGS = -DBUILDING_SO -I$(top_srcdir)/include
Expand Down
52 changes: 45 additions & 7 deletions src/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#endif //_MSC_VER
#include "api_internal.h"
#include "command_and_control.h"
#include "dev_mode.h"
#include "submission_private.h"
#include "judgment_private.h"
#include "runtime_config.h"
Expand Down Expand Up @@ -76,6 +77,8 @@ void Razorback_Destroy_Context(struct RazorbackContext *context) {
rzb_log(LOG_ERR, LOG_C_CORE, "%s: Context is NULL", __func__);
return;
}
if ((context->iFlags & CONTEXT_FLAG_DEV_TOOL) == CONTEXT_FLAG_DEV_TOOL)
Razorback_DevMode_UnregisterContext(context);
if (context->inspector.dataTypeList != NULL)
free(context->inspector.dataTypeList);
if (context->regSem != NULL)
Expand Down Expand Up @@ -152,7 +155,7 @@ Razorback_Init_Inspection_Context (uuid_t nuggetId,
uuid_copy (context->uuidNuggetId, nuggetId);
uuid_copy (context->uuidNuggetType, uuidInspector);
uuid_copy (context->uuidApplicationType, applicationType);
context->iFlags = 0;
context->iFlags = Razorback_DevMode_IsEnabled() ? CONTEXT_FLAG_DEV_TOOL : 0;
context->inspector.dataTypeCount = dataTypeCount;
context->inspector.dataTypeList = dataTypeList;
context->inspector.dataTypeList = calloc(dataTypeCount, sizeof(uuid_t));
Expand All @@ -171,6 +174,18 @@ Razorback_Init_Inspection_Context (uuid_t nuggetId,
return NULL;
}

if ((context->iFlags & CONTEXT_FLAG_DEV_TOOL) == CONTEXT_FLAG_DEV_TOOL) {
if (!Razorback_DevMode_RegisterContext(context)) {
rzb_log(LOG_ERR, LOG_C_CORE,
"%s: Failed to initialize dev-mode capture state",
__func__);
Razorback_Remove_Context(context);
Razorback_Destroy_Context(context);
return NULL;
}
return context;
}

if ((context->inspector.judgmentQueue = Queue_Create(JUDGMENT_QUEUE, false, QUEUE_FLAG_SEND)) == NULL) {
rzb_log (LOG_ERR, LOG_C_CORE, "%s: Failed to create judgment queue", __func__);
Razorback_Remove_Context(context);
Expand Down Expand Up @@ -208,7 +223,7 @@ Razorback_Init_Output_Context (uuid_t nuggetId,
uuid_copy (context->uuidNuggetId, nuggetId);
uuid_copy (context->uuidNuggetType, uuidOutput);
uuid_copy (context->uuidApplicationType, applicationType);
context->iFlags = 0;
context->iFlags = Razorback_DevMode_IsEnabled() ? CONTEXT_FLAG_DEV_TOOL : 0;
context->pCommandHooks = NULL;
context->inspector.hooks = NULL;
context->output.threads = List_Create(LIST_MODE_GENERIC,
Expand Down Expand Up @@ -244,6 +259,8 @@ Razorback_Init_Collection_Context (uuid_t nuggetId,
uuid_copy (context->uuidNuggetType, uuidCollection);
uuid_copy (context->uuidApplicationType, applicationType);
context->iFlags = CONTEXT_FLAG_STAND_ALONE;
if (Razorback_DevMode_IsEnabled())
context->iFlags |= CONTEXT_FLAG_DEV_TOOL;
context->inspector.dataTypeCount = 0;
context->inspector.dataTypeList = NULL;
context->pCommandHooks = NULL;
Expand All @@ -268,15 +285,24 @@ Kill_Output_Thread(void *ut, void *ud) {

SO_PUBLIC void
Razorback_Shutdown_Context (struct RazorbackContext *context) {
CommandAndControl_SendBye(context);
bool useCommandAndControl;

CommandAndControl_Pause();
List_Remove(sg_ContextList, context);
CommandAndControl_Unpause();
useCommandAndControl =
((context->iFlags & CONTEXT_FLAG_DEV_TOOL) != CONTEXT_FLAG_DEV_TOOL);

if (useCommandAndControl) {
CommandAndControl_SendBye(context);
CommandAndControl_Pause();
List_Remove(sg_ContextList, context);
CommandAndControl_Unpause();
} else {
List_Remove(sg_ContextList, context);
}

Inspection_Shutdown(context);
Submission_Shutdown(context);
if ((context->iFlags & CONTEXT_FLAG_STAND_ALONE) ==
if (useCommandAndControl &&
(context->iFlags & CONTEXT_FLAG_STAND_ALONE) ==
CONTEXT_FLAG_STAND_ALONE) {
CommandAndControl_Shutdown();
}
Expand Down Expand Up @@ -344,6 +370,18 @@ Razorback_Render_Verdict (struct Judgment *judgment) {
}

context = Thread_GetCurrentContext();
if (context == NULL) {
rzb_log(LOG_ERR, LOG_C_CORE, "%s: Failed to resolve current context", __func__);
return false;
}

if ((context->iFlags & CONTEXT_FLAG_DEV_TOOL) == CONTEXT_FLAG_DEV_TOOL) {
if (!Razorback_DevMode_CaptureVerdict(context, judgment)) {
rzb_log(LOG_ERR, LOG_C_CORE, "%s: Failed to capture local dev verdict", __func__);
return false;
}
return true;
}

if ((message = MessageJudgmentSubmission_Initialize (JUDGMENT_REASON_ALERT, judgment)) == NULL) {
rzb_log(LOG_ERR, LOG_C_CORE, "%s: Failed to create message", __func__);
Expand Down
12 changes: 10 additions & 2 deletions src/command_and_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,14 @@ static struct RazorbackCommandAndControlHooks sg_DefaultHooks = {

void
CommandAndControl_Pause(void) {
Mutex_Lock(processLock);
if (processLock != NULL)
Mutex_Lock(processLock);
}

void
CommandAndControl_Unpause(void) {
Mutex_Unlock(processLock);
if (processLock != NULL)
Mutex_Unlock(processLock);
}

bool
Expand All @@ -117,6 +119,12 @@ CommandAndControl_Start (struct RazorbackContext *p_pContext) {
if (p_pContext->pCommandHooks == NULL)
p_pContext->pCommandHooks = &sg_DefaultHooks;

if ((p_pContext->iFlags & CONTEXT_FLAG_DEV_TOOL) == CONTEXT_FLAG_DEV_TOOL) {
p_pContext->regOk = true;
Semaphore_Post(p_pContext->regSem);
return true;
}

if ((p_pContext->iFlags & CONTEXT_FLAG_STAND_ALONE) ==
CONTEXT_FLAG_STAND_ALONE) {
if (!sg_bQueueInitialized) {
Expand Down
Loading
Loading