-
Notifications
You must be signed in to change notification settings - Fork 13
feature: consolidate capability toggles under wave.capabilities.* #1098
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| # Configuration for locked-down / regulated Wave deployments. | ||
| # | ||
| # Enable this profile by setting MICRONAUT_ENVIRONMENTS=strict | ||
| # | ||
| # It disables all optional Wave capabilities so that the service cannot serve | ||
| # images directly, broker registry credentials, or expose the HTML view pages. | ||
| # In this mode containers must be provisioned via "freeze" mode (actual image | ||
| # builds) and pulls are expected to use the caller's own registry credentials. | ||
| # | ||
| wave: | ||
| capabilities: | ||
| # disallow anonymous (unauthenticated) access to the Wave server | ||
| anonymous-access: false | ||
| # disable the ephemeral container pull/augmentation path; requests must use "freeze" mode | ||
| ephemeral-token: false | ||
| # do not broker registry credentials on the proxy pull path; use the caller's own credentials | ||
| credentials-federation: false | ||
| # disable the HTML view pages under /view/** (return 404) | ||
| web-views: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/test/groovy/io/seqera/wave/controller/AnonymousAccessLegacyAliasTest.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| /* | ||
| * Wave, containers provisioning service | ||
| * Copyright (c) 2023-2026, Seqera Labs | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| package io.seqera.wave.controller | ||
|
|
||
| import spock.lang.Specification | ||
|
|
||
| import io.micronaut.context.ApplicationContext | ||
|
|
||
| /** | ||
| * Verify the legacy 'wave.allowAnonymous' key still drives the | ||
| * 'wave.capabilities.anonymous-access' capability for backward compatibility. | ||
| */ | ||
| class AnonymousAccessLegacyAliasTest extends Specification { | ||
|
|
||
| def 'legacy wave.allowAnonymous=#legacy resolves anonymous-access=#expected'() { | ||
| given: | ||
| def ctx = ApplicationContext.run(props) | ||
|
|
||
| expect: | ||
| ctx.getRequiredProperty('wave.capabilities.anonymous-access', Boolean) == expected | ||
|
|
||
| cleanup: | ||
| ctx.close() | ||
|
|
||
| where: | ||
| legacy | props | expected | ||
| 'unset' | [:] | true // shipped default | ||
| 'false' | ['wave.allowAnonymous': false] | false // legacy override honored | ||
| 'true' | ['wave.allowAnonymous': true] | true | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/test/groovy/io/seqera/wave/controller/ViewControllerDisabledTest.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| /* | ||
| * Wave, containers provisioning service | ||
| * Copyright (c) 2023-2026, Seqera Labs | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| package io.seqera.wave.controller | ||
|
|
||
| import spock.lang.Specification | ||
|
|
||
| import io.micronaut.context.ApplicationContext | ||
| import io.micronaut.context.annotation.Property | ||
| import io.micronaut.http.HttpRequest | ||
| import io.micronaut.http.HttpStatus | ||
| import io.micronaut.http.client.HttpClient | ||
| import io.micronaut.http.client.annotation.Client | ||
| import io.micronaut.http.client.exceptions.HttpClientResponseException | ||
| import io.micronaut.test.extensions.spock.annotation.MicronautTest | ||
| import jakarta.inject.Inject | ||
|
|
||
| /** | ||
| * Verify that the /view/** pages are disabled when 'wave.capabilities.web-views' is false. | ||
| * | ||
| * @author Gavin Elder | ||
| */ | ||
| @Property(name = 'wave.server.url', value = 'http://foo.com') | ||
| @Property(name = 'wave.capabilities.web-views', value = 'false') | ||
| @MicronautTest | ||
| class ViewControllerDisabledTest extends Specification { | ||
|
|
||
| @Inject | ||
| @Client("/") | ||
| HttpClient client | ||
|
|
||
| @Inject | ||
| ApplicationContext applicationContext | ||
|
|
||
| def 'should not load the view controller when views are disabled'() { | ||
| expect: | ||
| !applicationContext.containsBean(ViewController) | ||
| } | ||
|
|
||
| def 'should return not found for view pages when views are disabled'() { | ||
| when: | ||
| client.toBlocking().exchange(HttpRequest.GET(uri)) | ||
|
|
||
| then: | ||
| def e = thrown(HttpClientResponseException) | ||
| e.status == HttpStatus.NOT_FOUND | ||
|
|
||
| where: | ||
| uri << [ | ||
| '/view/builds/bd-12345', | ||
| '/view/mirrors/mr-12345', | ||
| '/view/scans/sc-12345', | ||
| '/view/containers/1234567890ab', | ||
| ] | ||
| } | ||
|
|
||
| } |
46 changes: 46 additions & 0 deletions
46
src/test/groovy/io/seqera/wave/controller/ViewControllerEnabledTest.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| * Wave, containers provisioning service | ||
| * Copyright (c) 2023-2026, Seqera Labs | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| package io.seqera.wave.controller | ||
|
|
||
| import spock.lang.Specification | ||
|
|
||
| import io.micronaut.context.ApplicationContext | ||
| import io.micronaut.context.annotation.Property | ||
| import io.micronaut.test.extensions.spock.annotation.MicronautTest | ||
| import jakarta.inject.Inject | ||
|
|
||
| /** | ||
| * Verify that the /view/** pages are served when 'wave.capabilities.web-views' is true. | ||
| * | ||
| * @author Gavin Elder | ||
| */ | ||
| @Property(name = 'wave.server.url', value = 'http://foo.com') | ||
| @Property(name = 'wave.capabilities.web-views', value = 'true') | ||
| @MicronautTest | ||
| class ViewControllerEnabledTest extends Specification { | ||
|
|
||
| @Inject | ||
| ApplicationContext applicationContext | ||
|
|
||
| def 'should load the view controller when views are enabled'() { | ||
| expect: | ||
| applicationContext.containsBean(ViewController) | ||
| } | ||
|
|
||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.