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

Change CA generation in tests to avoid using SHA1 #4361

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

michel-laterman
Copy link
Contributor

What is the problem this PR solves?

Tests ran with GODEBUG=fips140=only will panic due to CA SubjectKeyId generation using SHA1 by default.

How does this PR solve the problem?

Populate SubjectKeyId with value generated by other algorithm; copied implementation from elastic/elastic-agent-libs#263

How to test this PR locally

GODEBUG=fips140=only gotip test ./...

Design Checklist

  • I have ensured my design is stateless and will work when multiple fleet-server instances are behind a load balancer.
  • I have or intend to scale test my changes, ensuring it will work reliably with 100K+ agents connected.
  • I have included fail safe mechanisms to limit the load on fleet-server: rate limiting, circuit breakers, caching, load shedding, etc.

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool

@michel-laterman michel-laterman added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team tech debt backport-8.x Automated backport to the 8.x branch with mergify labels Jan 28, 2025
@michel-laterman michel-laterman requested a review from a team as a code owner January 28, 2025 19:01
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

switch publicKey := pub.(type) {
case *rsa.PublicKey:
publicKeyBytes = x509.MarshalPKCS1PublicKey(publicKey)
case *ecdsa.PublicKey:
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: I think we can avoid this case since the key is always an rsa key. WDYT ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don' think there's a downside to keeping both; this is just to fix test code

@michel-laterman michel-laterman merged commit 8909668 into elastic:main Jan 30, 2025
10 checks passed
@michel-laterman michel-laterman deleted the test-ca-fips-fix branch January 30, 2025 18:17
mergify bot pushed a commit that referenced this pull request Jan 30, 2025
michel-laterman added a commit that referenced this pull request Feb 10, 2025
(cherry picked from commit 8909668)

Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
@michel-laterman michel-laterman added the backport-9.0 Automated backport to the 9.0 branch label Mar 19, 2025
mergify bot pushed a commit that referenced this pull request Mar 19, 2025
michel-laterman added a commit that referenced this pull request Mar 19, 2025
(cherry picked from commit 8909668)

Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify backport-9.0 Automated backport to the 9.0 branch Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team tech debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants