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

ambex: Remove usage of md5 #5794

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wlynch
Copy link

@wlynch wlynch commented Oct 18, 2024

Description

When trying to run emissary in crypto-restricted environments (e.g. FIPS), usage of md5 can be problematic:

time="2024-10-17 19:20:29.7063" level=error msg="shut down with error error: PANIC: openssl: MD5 failed" func=github.com/emissary-ingress/emissary/v3/pkg/busy.Main file="github.com/emissary-ingress/emissary/v3/pkg/busy/busy.go:87" CMD=entrypoint PID=1

This replaces the usage with xxhash, which avoids the usage of md5 but keeps the same deterministic hash behavior. This was chosen over other stdlib hash functions that would be conformant (e.g. sha256) to minimize hash size since long hash length may be problematic for k8s name length restrictions (253 characters).

Related Issues

n/a

Testing

Updated unit tests.

Checklist

  • Does my change need to be backported to a previous release?

    • What backport versions were discussed with the Maintainers in the Issue?

    Shouldn't need backport.

  • I made sure to update CHANGELOG.md.

    Remember, the CHANGELOG needs to mention:

    • Any new features
    • Any changes to our included version of Envoy
    • Any non-backward-compatible changes
    • Any deprecations
  • This is unlikely to impact how Ambassador performs at scale.

    Remember, things that might have an impact at scale include:

    • Any significant changes in memory use that might require adjusting the memory limits
    • Any significant changes in CPU use that might require adjusting the CPU limits
    • Anything that might change how many replicas users should use
    • Changes that impact data-plane latency/scalability
  • My change is adequately tested.

    Remember when considering testing:

    • Your change needs to be specifically covered by tests.
      • Tests need to cover all the states where your change is relevant: for example, if you add a behavior that can be enabled or disabled, you'll need tests that cover the enabled case and tests that cover the disabled case. It's not sufficient just to test with the behavior enabled.
    • You also need to make sure that the entire area being changed has adequate test coverage.
      • If existing tests don't actually cover the entire area being changed, add tests.
      • This applies even for aspects of the area that you're not changing – check the test coverage, and improve it if needed!
    • We should lean on the bulk of code being covered by unit tests, but...
    • ... an end-to-end test should cover the integration points
  • I updated CONTRIBUTING.md with any special dev tricks I had to use to work on this code efficiently.

  • The changes in this PR have been reviewed for security concerns and adherence to security best practices.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Oct 18, 2024
When trying to run emissary in crypto-restricted environments (e.g.
FIPS), usage of md5 can be problematic:

```
time="2024-10-17 19:20:29.7063" level=error msg="shut down with error error: PANIC: openssl: MD5 failed" func=github.com/emissary-ingress/emissary/v3/pkg/busy.Main file="github.com/emissary-ingress/emissary/v3/pkg/busy/busy.go:87" CMD=entrypoint PID=1
```

This replaces the usage with xxhash, which should avoid usage of
unsupport crypto libraries, but keep the deterministic behavior.

Signed-off-by: Billy Lynch <[email protected]>
@dosubot dosubot bot added the go Pull requests that update Go code label Oct 18, 2024
@Alice-Lilith
Copy link
Member

Sounds good to me. @kflynn, any concerns or shall I kick-off CI for this?

@kflynn
Copy link
Member

kflynn commented Oct 18, 2024

@Alice-Lilith i think running CI sounds great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants