-
Notifications
You must be signed in to change notification settings - Fork 73
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
[ BUG ] Get-FalconVulnerability
fails with 401: access denied, invalid bearer token
when retrieving large numbers of results
#170
Comments
I agree, it sounds like the error is due to the expiration of the bearer token. I'm guessing it's because the amount of time between the check of whether or not the bearer token is expired and the finishing of the request is longer than the default amount of time (15 seconds). In v2.1.7 (the release I just published), I upped the time of that to 60 seconds. Could you retry with v2.1.7 and let me know if that solves the problem? |
Unfortunately with 2.1.7 the issue still exists. :-( I thought about a potential workaround by just getting the vulnerability IDs and pipe it to Get-FalconVulnerability: This however takes forever to finish. Maybe I could get around this by slicing the IDs to have workable batches, though I would still need to try that. |
Would it work if we greatly increased the token renewal time? Try changing this line in
to
If that doesn't solve it, maybe break it into two steps? Note that you'll likely need to mess with the output to get readable content in the resulting CSV, but I don't think
This might hint that the |
Interesting! After updating to PSFalcon 2.1.7 and increasing the expiration to 600 seconds, it still leads to the same error. Your second snippet throws an error when
When adding a I really like the "two-step" approach though as pulling everything at once is hard on memory consumption anyway, with this large set of a data set. I'll play around with it a bit and report back later. :-) Edit: Finally some good news! With the two-step approach I can get all 800k entries into a CSV. Memory usage is still high, but at least it's finishing in an acceptable time. |
I'm glad it worked for you! I'll see if I can think of a way to break up the large result sets or make them work differently than how |
Alright, great! If you want we can close the issue for now, as I have a good workaround now. If you'd like me to test anything for you, just let me know. Thanks so much for your work on this project! |
Get-FalconVulnerability
fails with 401: access denied, invalid bearer token
when retrieving large numbers of results
Streamlined looping functionality (used with '-All' parameter). Issue #170: 'Invoke-Loop' changes should eliminate token failures during retrieval of large result sets.
This issue will also manifest when using |
Closing issue--resolved in 2.2.2 release. |
Describe the bug
Hello! I'm trying to fetch a large amount of vulnerability data via Get-FalconVulnerability, enriched with facet data. The verbose output shows many Invoke-Loops, so pagination seems to work well. At one point, X-Ratelimit-Limit jumps from 6000 to 15. After that, the script fails with an error code 401, access denied, invalid bearer token. The inner exception says "results limited by API.
To Reproduce
Get-FalconVulnerability -Filter "status:!'closed'+host_info.groups:['$ID']" -Detailed -Verbose -All -Limit 1000 -Facet host_info, cve, remediation
, where$ID
is the ID of a host group.Expected behavior
Even though there's a large number of results, I'd expect it to run through, given enough time. Not sure if the error message is really correct here, as error 429 would indicate "The allowed rate limit has been reached". With 401 I assume that the bearer token expires in the meantime and is not properly refreshed?
Environment (please complete the following information):
Additional context
Trying different values for the limit param didn't help. Getting the vulnerability IDs only works. I'd have to get info about hosts, remediations, etc. too, so I thought the facet param would be a good idea. Might not be the best way to go about it, but I'm just curious about the error.
Any help or hint is appreciated. Thanks again for all your time and effort in this project! :-)
The text was updated successfully, but these errors were encountered: