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

Revision metadata breaks with | in commit author name #15949

Closed
dosmanak opened this issue Oct 13, 2023 · 2 comments · Fixed by #20040
Closed

Revision metadata breaks with | in commit author name #15949

dosmanak opened this issue Oct 13, 2023 · 2 comments · Fixed by #20040
Assignees
Labels
bug Something isn't working component:git Interaction with GitHub, Gitlab etc good first issue Good for newcomers

Comments

@dosmanak
Copy link
Contributor

dosmanak commented Oct 13, 2023

Hello, I put | symbol in my git user.name.
I broke the response from revision metadata api of argo server
/api/v1/applications/${reponame}/revisions/${commitid}/metadata?appNamespace=${namespace}

So that it returns

{"author":"PSy ","date":"1970-01-01T00:00:00Z","message":"1689860699|fix: do not use deploy in app label"}

This is cause by https://github.com/argoproj/argo-cd/blob/f8f9ae9accd413b417be1d188418f2b3b7c25e63/util/git/client.go#L632C38-L632C63

resp. the git show format expression --format="%an <%ae>|%at|%B" that is then split by |.

I suggest to rewrite the method without such formatting.

@dosmanak dosmanak changed the title Revision metadata borkes with | in commit author name Revision metadata breaks with | in commit author name Oct 13, 2023
dosmanak added a commit to dosmanak/argo-cd that referenced this issue Oct 13, 2023
… symbol

pipe symbol '|' could appear in username or commit message body
dosmanak added a commit to dosmanak/argo-cd that referenced this issue Oct 13, 2023
… symbol

pipe symbol '|' could appear in username or commit message body
dosmanak added a commit to dosmanak/argo-cd that referenced this issue Oct 13, 2023
… symbol

pipe symbol '|' could appear in username or commit message body

Signed-off-by: Petr Studeny <[email protected]>
dosmanak added a commit to dosmanak/argo-cd that referenced this issue Oct 16, 2023
… symbol

pipe symbol '|' could appear in username or commit message body

Signed-off-by: Petr Studeny <[email protected]>
@alexmt alexmt added good first issue Good for newcomers bug Something isn't working component:git Interaction with GitHub, Gitlab etc labels Oct 17, 2023
@dosmanak
Copy link
Contributor Author

Hello? I think my PR is simple enough to be merged into master.

@blakepettersson blakepettersson self-assigned this Sep 21, 2024
blakepettersson added a commit to blakepettersson/argo-cd that referenced this issue Sep 21, 2024
Pipe symbol | can potentially appear in the username or commit message body. Fixes argoproj#15949.

Signed-off-by: Blake Pettersson <[email protected]>
blakepettersson pushed a commit to blakepettersson/argo-cd that referenced this issue Sep 21, 2024
… symbol

pipe symbol '|' could appear in username or commit message body

Signed-off-by: Petr Studeny <[email protected]>
crenshaw-dev pushed a commit that referenced this issue Oct 8, 2024
* fix: [#15949] split git revision metadata by newline not pipe symbol

pipe symbol '|' could appear in username or commit message body

Signed-off-by: Petr Studeny <[email protected]>

* test: add test

Signed-off-by: Blake Pettersson <[email protected]>

* Update util/git/client_test.go

Co-authored-by: Petr Studeny <[email protected]>
Signed-off-by: Blake Pettersson <[email protected]>

* test: fix test

Signed-off-by: Blake Pettersson <[email protected]>

---------

Signed-off-by: Petr Studeny <[email protected]>
Signed-off-by: Blake Pettersson <[email protected]>
Co-authored-by: Petr Studeny <[email protected]>
@blakepettersson
Copy link
Member

Thank you @crenshaw-dev! And thanks @dosmanak for the PR! 🙇

ALIHAMZA99 pushed a commit to ALIHAMZA99/argo-cd that referenced this issue Oct 10, 2024
* fix: [argoproj#15949] split git revision metadata by newline not pipe symbol

pipe symbol '|' could appear in username or commit message body

Signed-off-by: Petr Studeny <[email protected]>

* test: add test

Signed-off-by: Blake Pettersson <[email protected]>

* Update util/git/client_test.go

Co-authored-by: Petr Studeny <[email protected]>
Signed-off-by: Blake Pettersson <[email protected]>

* test: fix test

Signed-off-by: Blake Pettersson <[email protected]>

---------

Signed-off-by: Petr Studeny <[email protected]>
Signed-off-by: Blake Pettersson <[email protected]>
Co-authored-by: Petr Studeny <[email protected]>
Signed-off-by: alnoor <[email protected]>
austin5219 pushed a commit to austin5219/argo-cd that referenced this issue Oct 16, 2024
* fix: [argoproj#15949] split git revision metadata by newline not pipe symbol

pipe symbol '|' could appear in username or commit message body

Signed-off-by: Petr Studeny <[email protected]>

* test: add test

Signed-off-by: Blake Pettersson <[email protected]>

* Update util/git/client_test.go

Co-authored-by: Petr Studeny <[email protected]>
Signed-off-by: Blake Pettersson <[email protected]>

* test: fix test

Signed-off-by: Blake Pettersson <[email protected]>

---------

Signed-off-by: Petr Studeny <[email protected]>
Signed-off-by: Blake Pettersson <[email protected]>
Co-authored-by: Petr Studeny <[email protected]>
Signed-off-by: austin5219 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component:git Interaction with GitHub, Gitlab etc good first issue Good for newcomers
Projects
None yet
3 participants