Skip to content
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

Improve error management when scanning chunks #395

Open
pierrelalanne opened this issue Oct 19, 2022 · 2 comments
Open

Improve error management when scanning chunks #395

pierrelalanne opened this issue Oct 19, 2022 · 2 comments
Labels
type:feature Feature request

Comments

@pierrelalanne
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

Following issue #391 : I realized that the error message was not perfectly accurate.
GGshield displays a network error occurred. This is kind of true as this happens while interacting with the API, but on the other hand, the user might think of a lower level network error.

Describe the solution you'd like

When sending a filename that is too long to the API, we get a status_code 400 with a code max_length. We could adapt the output of ggshield for this case, and perhaps for other ones ?

Additional context

Also, I am a bit puzzled by why the status_code is None at that point.

@pierrelalanne pierrelalanne added the type:feature Feature request label Oct 19, 2022
@agateau-gg
Copy link
Collaborator

agateau-gg commented Oct 25, 2022

When sending a filename that is too long to the API, we get a status_code 400 with a code max_length. We could adapt the output of ggshield for this case, and perhaps for other ones ?

The problem is the field is called "filename" but what we put in it is not a filename. When we scan paths or commits, it is the absolute path of the document, which can be longer than 256 characters. When we scan docker images, it's the concatenation of the layer UUID and the absolute path of the document inside the layer.

We need more than a filename to point the user to the secret location. In my opinion what we should do is remove the 256 characters limitation on the server side.

Also, I am a bit puzzled by why the status_code is None at that point.

It happens when an exception is raised before calling the API. In this case, the Detail instance is created from the exception only, here: https://github.com/GitGuardian/ggshield/blob/main/ggshield/scan/scannable.py#L382, and status_code is not set.

@agateau-gg
Copy link
Collaborator

Revisiting this issue: ggshield used to rely on the filename to match a scan with its result, but it's no longer the case since #435, so we should be able to only set a filename in this field, as initially intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature Feature request
Projects
None yet
Development

No branches or pull requests

2 participants