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: fix ps rule error for waf aligned aks - avm/res/container-service/managed-cluster #3228

Merged
merged 16 commits into from
Oct 12, 2024

Conversation

PixelRobots
Copy link
Contributor

@PixelRobots PixelRobots commented Sep 8, 2024

Description

Fixes issue with ps rule for WAF. For some reason it still complains about default, But I don't think the ps rule should be running on the default test as it is not required.

I am unsure how to change that. Happy to do so with some guidance.

Pipeline Reference

Pipeline
avm.res.container-service.managed-cluster

Type of Change

  • Update to CI Environment or utilities (Non-module affecting changes)
  • Azure Verified Module updates:
    • Bugfix containing backwards-compatible bug fixes, and I have NOT bumped the MAJOR or MINOR version in version.json:
      • Someone has opened a bug report issue, and I have included "Closes #{bug_report_issue_number}" in the PR description.
      • The bug was found by the module author, and no one has opened an issue to report it yet.
    • Feature update backwards compatible feature updates, and I have bumped the MINOR version in version.json.
    • Breaking changes and I have bumped the MAJOR version in version.json.
    • Update to documentation

Checklist

  • I'm sure there are no other open Pull Requests for the same update/change
  • I have run Set-AVMModule locally to generate the supporting module files.
  • My corresponding pipelines / checks run clean and green without any errors or warnings

Signed-off-by: PixelRobots <[email protected]>
Signed-off-by: PixelRobots <[email protected]>
Signed-off-by: PixelRobots <[email protected]>
Signed-off-by: PixelRobots <[email protected]>
Signed-off-by: PixelRobots <[email protected]>
Signed-off-by: PixelRobots <[email protected]>
Signed-off-by: PixelRobots <[email protected]>
@PixelRobots PixelRobots requested review from a team as code owners September 8, 2024 15:45
@avm-team-linter avm-team-linter bot added the Needs: Module Owner 📣 This module needs an owner to develop or maintain it label Sep 8, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue Needs: Triage 🔍 Maintainers need to triage still labels Sep 8, 2024
Copy link
Contributor

@AlexanderSehr AlexanderSehr left a comment

Choose a reason for hiding this comment

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

Hey @PixelRobots,
some background regarding the defaults test - naturally, we want also the defaults of a module to be WAF-compliant. Either this can be done by providing a waf-compliant default in the module, or by setting it in the test. However, as some settings (e.g., private endpoints) require a user input (in this case a subnet), and because the defaults test should only contain required (or at most conditional) values, there is the option to disable the rule in the min-suppress.Rule.yaml file (with a comment as to why).

No before we go ahead and disable the rule, I have to ask the qeustion if it would make sense to provide a default in the module or not. The input does, afterall, not require a user value. Then again, we'd need to assume somebody would want to run their maintenance work on e.g., a Sunday. What's your take on this?

eriqua
eriqua previously requested changes Sep 9, 2024
Copy link
Contributor

@eriqua eriqua left a comment

Choose a reason for hiding this comment

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

Hey @PixelRobots,

Thanks a lot for this fix. You are right, PSRule reliability is enforced on both WAF-aligned and defaults test.

The reason is security by default.
Since defaults tests should only use required input parameters and rely on default values for the remaining inputs, enforcing PSRule on defaults tests helps us understand if by only using default values the module is secure.

To fix this blocker we have 2 alternatives:

  • Make the corresponding parameter a required value, so that it can be used by defaults tests. If relevant, we can still allow disabling the additional feature. The idea behind that is to make it more difficult, rather than easier, to deploy a module not secure by default.
  • If the PSRule check is involving external dependencies (like when asking for private endpoints) or in general if there is a good reason for that, this check can be skipped for the defaults test only. To do that, the rule name can be listed in this file, with a comment specifying the reason why that rule is not applied.
    I suggest discussing the best option with module owners.
    Cc @ilhaan @JPEasier

@PixelRobots
Copy link
Contributor Author

As the maintenance windows can be fully customised for the end user needs I would suggest we skip this test. But will wait for the module owners to confirm what they feel is best.

@AlexanderSehr
Copy link
Contributor

As the maintenance windows can be fully customised for the end user needs I would suggest we skip this test. But will wait for the module owners to confirm what they feel is best.

Sounds reasonable to me. There's not obvious 'right' window afterall.
@ilhaan & @JPEasier, curious to hear your thoughts 😏

@PixelRobots
Copy link
Contributor Author

Any update on this?

@matebarabas matebarabas changed the title feat: fix ps rule error for waf aligned aks feat: fix ps rule error for waf aligned aks - avm/res/container-service/managed-cluster Sep 18, 2024
@PixelRobots
Copy link
Contributor Author

Just wondering if there is any update on this yet?

@ilhaan
Copy link
Member

ilhaan commented Sep 26, 2024

I agree with this and think we should skip this test. @JPEasier what do you think?

As the maintenance windows can be fully customised for the end user needs I would suggest we skip this test. But will wait for the module owners to confirm what they feel is best.

@PixelRobots
Copy link
Contributor Author

Just checking in to see if a decision has been made on this one.

@eriqua
Copy link
Contributor

eriqua commented Oct 1, 2024

Just checking in to see if a decision has been made on this one.

@PixelRobots let me bring this up with the core team. Since security is one of our priorities, I want to make sure that skipping the test for defaults test is acceptable, or if having it as a required parameter would fit better.

@eriqua eriqua added Needs: Core Team 🧞 This item needs the AVM Core Team to review it Type: Question/Feedback 🙋 Further information is requested or just some feedback Class: Resource Module 📦 This is a resource module and removed Needs: Triage 🔍 Maintainers need to triage still labels Oct 1, 2024
@AlexanderSehr
Copy link
Contributor

I'd suggest to exclude the requirement from the default test via the min-suppresion rules, set the maintainence window in the WAF test and call it a day. Similar to the PSRule requirement for e.g., always deploying an MSI, I'd argue we can make this judgement call as the maintenanceWindows is so user-specific

@PixelRobots
Copy link
Contributor Author

Would you like me to make the change and push to this pull request? Or is there another process to follow?

@ReneHezser
Copy link
Contributor

ReneHezser commented Oct 4, 2024

@PixelRobots
We have added examples for Bicep parameter files to the Readme. This has been applied to all published modules but needs to be done for PRs as well. Can you please update your branch and run the Set-AVMModule utility as detailed here. It is required for the validation pipeline to succeed and the contribution to be published.

Please reach out if any support is needed.

@PixelRobots PixelRobots requested a review from a team as a code owner October 6, 2024 13:06
@PixelRobots
Copy link
Contributor Author

All updated and action ran again. all passing. Should be good for merging now.

@jtracey93
Copy link
Contributor

related too Azure/Azure-Verified-Modules#1360

@jtracey93 jtracey93 dismissed stale reviews from eriqua and AlexanderSehr October 10, 2024 15:29

Core team agreement

@JPEasier
Copy link
Contributor

JPEasier commented Oct 11, 2024

@PixelRobots please see the two suggestions from @eriqua

Looks good so far :)

@PixelRobots
Copy link
Contributor Author

Thanks I will try and take a look this weekend or first thing Monday.

@PixelRobots
Copy link
Contributor Author

All updates should be completed now. Fingers crossed this is ready for merging.

Copy link
Contributor

@AlexanderSehr AlexanderSehr left a comment

Choose a reason for hiding this comment

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

Off we go 💪

@AlexanderSehr AlexanderSehr merged commit 016b727 into Azure:main Oct 12, 2024
4 checks passed
@PixelRobots PixelRobots deleted the fix-ps-rule-error-aks-rh branch October 12, 2024 20:43
AlexanderSehr added a commit that referenced this pull request Oct 14, 2024
## Description

- Aligned AKS interface to AVM specs 
- Added UDT & mapping for primary agent pool

Depending on #3228 

## Pipeline Reference

<!-- Insert your Pipeline Status Badge below -->

| Pipeline |
| -------- |
|
[![avm.res.container-service.managed-cluster](https://github.com/Azure/bicep-registry-modules/actions/workflows/avm.res.container-service.managed-cluster.yml/badge.svg?branch=users%2Falsehr%2FcontainerServiceInterfaceFix&event=workflow_dispatch)](https://github.com/Azure/bicep-registry-modules/actions/workflows/avm.res.container-service.managed-cluster.yml)
|

## Type of Change

<!-- Use the checkboxes [x] on the options that are relevant. -->

- [ ] Update to CI Environment or utilities (Non-module affecting
changes)
- [ ] Azure Verified Module updates:
- [x] Bugfix containing backwards-compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [ ] Someone has opened a bug report issue, and I have included "Closes
#{bug_report_issue_number}" in the PR description.
- [ ] The bug was found by the module author, and no one has opened an
issue to report it yet.
- [ ] Feature update backwards compatible feature updates, and I have
bumped the MINOR version in `version.json`.
- [ ] Breaking changes and I have bumped the MAJOR version in
`version.json`.
  - [ ] Update to documentation
AlexanderSehr added a commit that referenced this pull request Oct 14, 2024
## Description

- Updates the API versions of referenced modules to trigger publishing

Dependend on #3228

## Pipeline Reference

<!-- Insert your Pipeline Status Badge below -->

| Pipeline |
| -------- |
|
[![avm.ptn.azd.aks](https://github.com/Azure/bicep-registry-modules/actions/workflows/avm.ptn.azd.aks.yml/badge.svg?branch=users%2Falsehr%2FazdAKSPublishing&event=workflow_dispatch)](https://github.com/Azure/bicep-registry-modules/actions/workflows/avm.ptn.azd.aks.yml)
|

## Type of Change

<!-- Use the checkboxes [x] on the options that are relevant. -->

- [ ] Update to CI Environment or utilities (Non-module affecting
changes)
- [x] Azure Verified Module updates:
- [ ] Bugfix containing backwards-compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [ ] Someone has opened a bug report issue, and I have included "Closes
#{bug_report_issue_number}" in the PR description.
- [ ] The bug was found by the module author, and no one has opened an
issue to report it yet.
- [ ] Feature update backwards compatible feature updates, and I have
bumped the MINOR version in `version.json`.
- [ ] Breaking changes and I have bumped the MAJOR version in
`version.json`.
  - [ ] Update to documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Class: Resource Module 📦 This is a resource module Needs: Core Team 🧞 This item needs the AVM Core Team to review it Needs: Module Owner 📣 This module needs an owner to develop or maintain it Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue Type: Question/Feedback 🙋 Further information is requested or just some feedback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants