Skip to content

[Feature/Testing]: Add native Go fuzzing target for urunc system configuration loading and validation #919

Description

@ParthMozarkar

Summary

urunc parses its system configuration file (/etc/urunc/urunc.json or custom path) via LoadUruncConfig() and UruncConfig.Validate() in pkg/unikontainers/urunc_config.go.

Currently:

  1. urunc_config_test.go contains static unit tests for valid JSON formats, but does not systematically test malformed JSON structures, invalid base64 string paths, or out-of-range memory/vCPU integers.
  2. The repository lacks automated Go native fuzzing (go test -fuzz) to detect unexpected panics or unhandled errors when processing arbitrary configuration payloads (aligning with Add fuzzing and robustness testing #852).

Expected Behavior

  • pkg/unikontainers should include a native Go fuzzing target FuzzLoadUruncConfig(f *testing.F) that generates random byte payloads to fuzz JSON decoding and validation.
  • Validated configurations should guarantee clean error returns without triggering nil-pointer panics or slice bounds errors on Validate().

Proposed Changes

  • Expose a memory-slice helper ParseUruncConfigBytes(data []byte) (*UruncConfig, error) in pkg/unikontainers/urunc_config.go.
  • Implement FuzzLoadUruncConfig(f *testing.F) in pkg/unikontainers/urunc_config_test.go with initial seed corpuses for valid JSON structures.
  • Verify invariant execution using go test -v -fuzz=FuzzLoadUruncConfig -fuzztime=30s ./pkg/unikontainers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions