-
Notifications
You must be signed in to change notification settings - Fork 485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getDecisionStream does not return custom scope decisions by default #2617
Comments
@laurentgoudet: Thanks for opening an issue, it is currently awaiting triage. In the meantime, you can:
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. |
Hi thank you for your report, We intentionally set those scopes if non is provided crowdsec/pkg/apiserver/controllers/v1/decisions.go Lines 353 to 355 in 67cdf91
I will ask the team if this should be the same as non stream or if we should not do this. |
Thanks. Arguably the inconsistency between |
You shouldnt have to rebuild it, our go SDK already has scopes yaml keys. So within all bouncers you can add the following to the configuration as an example scopes:
- ip
- range
- useragent |
What happened?
Without the
scopes
parameter set,getDecisions
returns Ip, Range, and custom scopes (UserAgent
here) decisions:However, by default (i.e. without
scopes
being set)getDecisionsStream
does not return the custom scopes decisions, acting as in anscopes=Ip,Range
filter was set:This prevents me from using https://github.com/crowdsecurity/cs-custom-bouncer for acting on custom scope decisions, since those are not returned by default by the stream API that the bouncer is using.
Note that manually setting
scopes
toIp,Range,UserAgent
makesgetDecisionsStream
return those decisions:What did you expect to happen?
I would expect all scopes to be returned by default if
scopes
is not set, matching how the non-stream endpoint behaves.How can we reproduce it (as minimally and precisely as possible)?
Add decisions with
cscli decision add -i 1.2.3.4
cscli decision add -r 1.2.3.0/24
cscli decision add --scope UserAgent --value crowdsec
Register an API key
cscli bouncer add MyTestBouncer
Use that API key to cURL the
getDecisionsStream
endpoint:curl -sS -H "X-Api-Key: 9E1uMkxZzSDYQZU/Qbm9Og" -k 'https://127.0.0.1:8080/v1/decisions?origins=cscli%2Ccrowdsec' | jq .
Notice that the custom scope (
UserAgent
) decision is missing from the list returned bygetDecisionsStream
Anything else we need to know?
No response
Crowdsec version
OS version
Enabled collections and parsers
Acquisition config
Config show
Prometheus metrics
Related custom configs versions (if applicable) : notification plugins, custom scenarios, parsers etc.
The text was updated successfully, but these errors were encountered: