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

fix(ui): Fix greediness in regex for auth token replacement #5746

Merged
merged 1 commit into from
Apr 23, 2021

Conversation

mruoss
Copy link

@mruoss mruoss commented Apr 23, 2021

Checklist:

Unfortunately my last PR #5677 still has a little bug in the regular expression. The auth token we get from the cookie is sometimes wrapped by quotes (") and sometimes it is not. Therefore the regex wraps the matched token with optional quotes ("?(.*)"?). This regex matches"token" such as token. The problem is the first case ("token"). In this case the captured bit inside the parentheses would also match the second quote (token") because the part inside the parentheses ((.*)) matches all characters greedily. This can be fixed by matching lazily (.*?) as proposed in the Merge request.

Sorry for this - I guess the screenshot testing was not successful. Nevertheless here's more screenshots of the running system before and after my fix:

before:
Screenshot 2021-04-23 at 16 13 27

after:
Screenshot 2021-04-23 at 16 13 42

Signed-off-by: Michael Ruoss <michael.ruoss@ufirstgroup.com>
@codecov
Copy link

codecov bot commented Apr 23, 2021

Codecov Report

Merging #5746 (6c07870) into master (284adfe) will increase coverage by 0.07%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5746      +/-   ##
==========================================
+ Coverage   46.75%   46.83%   +0.07%     
==========================================
  Files         244      244              
  Lines       15270    15270              
==========================================
+ Hits         7139     7151      +12     
+ Misses       7227     7213      -14     
- Partials      904      906       +2     
Impacted Files Coverage Δ
cmd/argo/commands/get.go 56.31% <0.00%> (+0.64%) ⬆️
server/workflow/workflow_server.go 42.73% <0.00%> (+2.27%) ⬆️
workflow/metrics/server.go 16.66% <0.00%> (+4.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 284adfe...6c07870. Read the comment docs.

@alexec alexec merged commit 500d933 into argoproj:master Apr 23, 2021
@alexec
Copy link
Contributor

alexec commented Apr 23, 2021

Thank you!

@alexec alexec added this to the v3.1 milestone Apr 23, 2021
@sarabala1979 sarabala1979 mentioned this pull request May 4, 2021
33 tasks
sarabala1979 pushed a commit that referenced this pull request May 5, 2021
Signed-off-by: Michael Ruoss <michael.ruoss@ufirstgroup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants