Skip to content

feat: switch bootstrap to 'None' authentication provider#7331

Draft
okurz wants to merge 4 commits intoos-autoinst:masterfrom
okurz:feature/084_none_auth_bootstrap
Draft

feat: switch bootstrap to 'None' authentication provider#7331
okurz wants to merge 4 commits intoos-autoinst:masterfrom
okurz:feature/084_none_auth_bootstrap

Conversation

@okurz
Copy link
Copy Markdown
Member

@okurz okurz commented Apr 27, 2026

Motivation:
The single-instance container setup was using the 'Fake' authentication method,
which is less ideal for modern development/testing than the newer 'None' method.
'None' provides better defaults and doesn't require manual API key injection or
explicit login.

Design Choices:

  • Updated script/openqa-bootstrap to configure method = None.
  • Removed manual database injection and random key generation since None handles
    this automatically.
  • Updated documentation to reflect these changes and promote None over Fake.

Benefits:
Simplified bootstrap process, better alignment with recommended development and
testing practices.

Related issue: #7297

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 27, 2026

Great PR! Please pay attention to the following items before merging:

Files matching docs/*.md:

This is an automatically generated QA checklist based on modified files.

Copy link
Copy Markdown
Contributor

@Martchus Martchus left a comment

Choose a reason for hiding this comment

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

The PR description mentions that this is motivated by improving the single instance container but the change itself it changing the bootstrap script. And it does it in a way that makes it less secure. If this is the work of AI, I really suggest you review these changes yourself before creating a PR.

Comment thread script/openqa-bootstrap
Comment on lines -185 to -186
API_KEY=$(hexdump -n 8 -e '2/4 "%08X" 1 "\n"' /dev/random)
API_SECRET=$(hexdump -n 8 -e '2/4 "%08X" 1 "\n"' /dev/random)
Copy link
Copy Markdown
Contributor

@Martchus Martchus Apr 27, 2026

Choose a reason for hiding this comment

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

This generated a new, random key and configured it. So one ended up with a more secure setup than with with your change. The only missing step to make it secure would be switching the auth method for the web UI.

So I'm not sure whether that's a change for the better.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I kind of agree. On the other hand changing the method away from None/Fake is necessary anyway?

Comment thread script/openqa-bootstrap Outdated
Comment on lines +186 to +187
key = ${OPENQA_AUTH_NONE_KEY:-DEADBEEFDEADBEEF}
secret = ${OPENQA_AUTH_NONE_SECRET:-DEADBEEFDEADBEEF}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is a bit weird that we need this file at all with the None provider. Shouldn't None also mean that no API key/secret are required when using openqa-cli?

@okurz
Copy link
Copy Markdown
Member Author

okurz commented Apr 27, 2026

The PR description mentions that this is motivated by improving the single instance container but the change itself it changing the bootstrap script. And it does it in a way that makes it less secure. If this is the work of AI, I really suggest you review these changes yourself before creating a PR.

No, I got completely tunnel sighted and have forgot that we use openqa-bootstrap outside the single instance container :D

@okurz okurz marked this pull request as draft April 27, 2026 17:43
@okurz
Copy link
Copy Markdown
Member Author

okurz commented Apr 27, 2026

The PR description mentions that this is motivated by improving the single instance container but the change itself it changing the bootstrap script. And it does it in a way that makes it less secure.

Actually, can you comment what you mean is making this less secure? In before we used the fake authentication means everyone is an admin. How is it less secure now?

@Martchus
Copy link
Copy Markdown
Contributor

The PR description mentions that this is motivated by improving the single instance container but the change itself it changing the bootstrap script. And it does it in a way that makes it less secure.

Actually, can you comment what you mean is making this less secure? In before we used the fake authentication means everyone is an admin. How is it less secure now?

Read #7331 (comment). Before one was only one step away from a secure setup (changing the auth provider). Now one also needs to generate a new key/secret.

@okurz
Copy link
Copy Markdown
Member Author

okurz commented Apr 28, 2026

The PR description mentions that this is motivated by improving the single instance container but the change itself it changing the bootstrap script. And it does it in a way that makes it less secure.

Actually, can you comment what you mean is making this less secure? In before we used the fake authentication means everyone is an admin. How is it less secure now?

Read #7331 (comment). Before one was only one step away from a secure setup (changing the auth provider). Now one also needs to generate a new key/secret.

But reusing a key that was previously openly available is also a bad idea

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

❌ Patch coverage is 96.22642% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.99%. Comparing base (590397c) to head (1b1d5c3).
⚠️ Report is 21 commits behind head on master.

Files with missing lines Patch % Lines
lib/OpenQA/Shared/Controller/Auth.pm 50.00% 2 Missing ⚠️

❌ Your project check has failed because the head coverage (99.99%) is below the target coverage (100.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##            master    #7331      +/-   ##
===========================================
- Coverage   100.00%   99.99%   -0.01%     
===========================================
  Files          419      419              
  Lines        44529    44556      +27     
===========================================
+ Hits         44529    44554      +25     
- Misses           0        2       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@Martchus Martchus left a comment

Choose a reason for hiding this comment

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

Looks generally good with supplying no key at all.

Comment thread lib/OpenQA/Shared/Controller/Auth.pm Outdated
@okurz okurz force-pushed the feature/084_none_auth_bootstrap branch from 3216e4b to 29f59d1 Compare April 30, 2026 21:26
okurz added 4 commits May 5, 2026 06:33
Motivation:
The single-instance container setup was using the 'Fake' authentication method,
which is less ideal for modern development/testing than the newer 'None' method.
'None' provides better defaults and doesn't require manual API key injection or
explicit login.

Design Choices:
- Updated script/openqa-bootstrap to configure method = None.
- Removed manual database injection and random key generation since None handles
this automatically.
- Updated documentation to reflect these changes and promote None over Fake.

Benefits:
Simplified bootstrap process, better alignment with recommended development and
testing practices.

Related issue: os-autoinst#7297
Motivation:
Consistent use of a constant instead of a literal string for the default
admin username simplifies maintenance and potential future changes.

Benefits:
Better code maintainability and reduced risk of string-based errors.
Motivation:
The HMAC calculation in the replay attack subtest was incorrect: it was
calling hmac_sha1_sum with only one argument and concatenating the
timestamp to the result, instead of hashing the concatenated string.

Design Choices:
Properly concatenate the path query and timestamp before hashing, and
pass the secret as the second argument to hmac_sha1_sum.
@okurz okurz force-pushed the feature/084_none_auth_bootstrap branch from 29f59d1 to 1b1d5c3 Compare May 5, 2026 04:33
@kalikiana
Copy link
Copy Markdown
Member

kalikiana commented May 5, 2026

Read #7331 (comment). Before one was only one step away from a secure setup (changing the auth provider). Now one also needs to generate a new key/secret.

But reusing a key that was previously openly available is also a bad idea

This is exactly the discussion we already had drafting None authentication. Fake is not secure. The login route can be used even after a key is present.

The only difference here is explicitly using a provider that consistently disabling authentication. Security by obscurity is not helping us imho (my only remark above was about documentation in that regard)

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