crashappsec / crashappsec/chalk

Better user error when passing a config file with a dash in the filename (which fails)

Open Beginner friendly
#645 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Nim
Stars
436
Forks
25
PR merge metrics
No merged PRs in 30d

Description

## Description

`chalk load` doesn't support a config filename with a dash in it. It doesn't need to support that, but the error is opaque. Chalk should at least tell the user that the issue is because there's a dash in the filename.

```
admin@ubuntu:~$ ./chalk load heartbeat-config.c4m
warn: Could not find or install cosign; cannot sign or verify.
info: Attempting to load module from: heartbeat-config.c4m

Configuring Component: /home/admin/heartbeat-config
Finished configuration for /home/admin/heartbeat-config
info: [testing config]: Validating configuration.
error: chalk: [testing config]: 2:5:
Parse error: Expected either end of statement or: TtFrom
use heartbeat-config from "/home/admin"
^
admin@ubuntu:~$ mv heartbeat-config.c4m heartbeat_config.c4m
admin@ubuntu:~$ ./chalk load heartbeat_config.c4m
warn: Could not find or install cosign; cannot sign or verify.
info: Attempting to load module from: heartbeat_config.c4m

Configuring Component: /home/admin/heartbeat_config
Finished configuration for /home/admin/heartbeat_config
info: [testing config]: Validating configuration.
info: [testing config]: Configuration successfully validated.
info: Configuration replaced in binary: /home/admin/chalk
info: /home/admin/.local/chalk/chalk.log: Open (sink conf='default_out')
info: Full chalk report appended to: ~/.local/chalk/chalk.log
```

## Result

Instead it should do something like this:

```
admin@ubuntu:~$ ./chalk load heartbeat-config.c4m
error: c4m config file name must not contain dash
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the `chalk load` command entry point and trace how the supplied config filename becomes the module name before validation. Reproduce the two commands shown in the issue, then make the dash case report the requested filename error while preserving the successful underscore case. Confirm the resulting message matches the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
nim
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.