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

feat(config): sync hook and mfa config to remote #2861

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

sweatybridge
Copy link
Contributor

@sweatybridge sweatybridge commented Nov 8, 2024

What kind of change does this PR introduce?

feature

What is the new behavior?

Sync hook, mfa, and sessions config to remote.

Additional context

Add any other context or screenshots.

@coveralls
Copy link

coveralls commented Nov 8, 2024

Pull Request Test Coverage Report for Build 11741050509

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 5 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.03%) to 59.788%

Files with Coverage Reduction New Missed Lines %
internal/gen/keys/keys.go 5 12.9%
Totals Coverage Status
Change from base Build 11739597993: -0.03%
Covered Lines: 6383
Relevant Lines: 10676

💛 - Coveralls

@sweatybridge sweatybridge changed the title feat(config): sync hook config to remote feat(config): sync hook and mfa config to remote Nov 8, 2024
Comment on lines +61 to +70
assert.Contains(t, string(diff), `[hook.mfa_verification_attempt]`)
assert.Contains(t, string(diff), `-enabled = true`)
assert.Contains(t, string(diff), `+enabled = false`)
assert.Contains(t, string(diff), `uri = ""`)
assert.Contains(t, string(diff), `secrets = ""`)

assert.Contains(t, string(diff), `[hook.custom_access_token]`)
assert.Contains(t, string(diff), `-enabled = false`)
assert.Contains(t, string(diff), `+enabled = true`)
assert.Contains(t, string(diff), `uri = ""`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question

Is there an equivalent to toMatchInlineSnapshot in Go ? That could maybe be useful instead of repeating the contains for every line as it would also test for the lines order.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I'm aware of. But I'm interested as well.

A low hanging fruit is to write the expected diff output to a file under testdata for comparison.

Comment on lines +187 to +192
[auth.mfa.phone]
enroll_enabled = false
verify_enabled = false
otp_length = 6
template = "Your code is {{ `{{ .Code }}` }}"
max_frequency = "5s"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question

Will it cause any issue if it stay commented instead of being explicitly set to false ? Wondering about retro-compatibility with existing config.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One problem is if user sets verify_enabled = true without uncommenting the other fields, the update code would sync zero values to the api. I think that's rarely desired because it would override platform defaults like otp_length.

We can of course handle zero values in code, by treating it as null and not sending to api. But 0 is actually a valid config value according to auth team.

So I think it's cleaner to set non-zero default values for these fields to match our platform. If we want to support nullable fields in the future, we can also change them into pointers.

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.

3 participants