slightly improve error tracking related to appsec-config loading#4535
slightly improve error tracking related to appsec-config loading#4535buixor wants to merge 1 commit into
Conversation
|
@buixor: There are no 'kind' label on this PR. You need a 'kind' label to generate the release automatically.
DetailsI am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository. |
|
@buixor: There are no area labels on this PR. You can add as many areas as you see fit.
DetailsI am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository. |
There was a problem hiding this comment.
Pull request overview
This PR improves troubleshooting for appsec-config loading/build failures by tracking which config file paths were merged into an AppsecConfig, and surfacing that provenance when appsec runtime build fails (so users can more quickly identify which config(s) to inspect).
Changes:
- Added
AppsecConfig.LoadedFromand populated it duringLoadByPath()to preserve merge/load order. - Added tests asserting
LoadedFromis populated during multi-file loads. - Wrapped appsec
Build()errors in the acquisition appsec source with the list of loaded config file paths.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/appsec/appsec.go | Introduces LoadedFrom metadata and records it during LoadByPath(). |
| pkg/appsec/appsec_config_test.go | Adds assertions for LoadedFrom and a build-failure test case. |
| pkg/acquisition/modules/appsec/config.go | Enriches Build() failure errors with the LoadedFrom path list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // A hook filter that fails to compile must surface an error naming the | ||
| // appsec-config file it came from, so `crowdsec -t` points at the faulty config. | ||
| func TestBuildErrorNamesSourceFile(t *testing.T) { | ||
| cfg := newTestConfig() |
| // LoadedFrom lists the appsec-config file(s) merged into this config, in load order. | ||
| // Used to track error origins at load time | ||
| LoadedFrom []string `yaml:"-"` |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4535 +/- ##
===========================================
+ Coverage 41.78% 64.29% +22.50%
===========================================
Files 480 489 +9
Lines 37202 37799 +597
===========================================
+ Hits 15546 24303 +8757
+ Misses 19746 11202 -8544
- Partials 1910 2294 +384
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
No description provided.