Skip to content

Conversation

@w1ll-i-code
Copy link

Hi, as discussed with @lippserd, we improved the CSP header and added the ability to whitelist certain trusted domains for the image sources. This closes #5333.

@cla-bot cla-bot bot added the cla/signed label Mar 20, 2025
@lippserd
Copy link
Member

Hi, as discussed with @lippserd, we improved the CSP header and added the ability to whitelist certain trusted domains for the image sources. This closes #5333.

For reference: We discussed a use case where an Icinga Web module depends on features from an external provider, such as OpenStreetMap. Without the ability to modify the CSP header, every user of the module would need to adjust or override the web server configuration. A more effective approach we considered is to implement specific functionality in Icinga Web to modify only certain parts of the header. Additionally, I think such functionality would also be necessary for https://github.com/nbuchwitz/icingaweb2-module-map for example.

@w1ll-i-code w1ll-i-code force-pushed the 5333-allow-customization-of-the-csp branch 3 times, most recently from 168628c to 43c748e Compare March 20, 2025 11:13
@lippserd lippserd requested a review from nilmerg May 13, 2025 14:30
Copy link
Member

@nilmerg nilmerg left a comment

Choose a reason for hiding this comment

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

There are some style issues as well. Please rebase with main and the actions will run and point this out.

@w1ll-i-code w1ll-i-code force-pushed the 5333-allow-customization-of-the-csp branch 3 times, most recently from 4ffe492 to d31bc33 Compare May 13, 2025 16:12
@nilmerg
Copy link
Member

nilmerg commented May 14, 2025

I just noticed this breaks our own font loading, so all our icons are invisible since font-src: 'self' prohibits them. You can notice this in the menu pretty well for example.

In addition, I've already talked about this with you in person, I'd rather like to make this an automatic whitelisting. With the recent security release, we sandboxed iframes and automatically open them up in case a user configures a navigation item or dashboard with an external link. I'm thinking about the same with img-src and frame-src. So there could be a hook or something similar that would allow your module to announce that it requires images from a specific non-origin host and that gets automatically whitelisted using the desired policy.

So, I'm afraid, we need to re-think that. I also fear complications with child-src and connect-src. I'll promise we figure that out before the next major, so 2.13 will include something to resolve this.

@w1ll-i-code w1ll-i-code force-pushed the 5333-allow-customization-of-the-csp branch from d31bc33 to bbf35b5 Compare May 15, 2025 10:10
@w1ll-i-code w1ll-i-code force-pushed the 5333-allow-customization-of-the-csp branch from bbf35b5 to 2a9adc0 Compare May 15, 2025 10:12
@w1ll-i-code w1ll-i-code requested a review from nilmerg May 15, 2025 11:51
Copy link
Member

@nilmerg nilmerg left a comment

Choose a reason for hiding this comment

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

Thanks for keeping at it!

I didn't look at it entirely yet. Only one thing for now:

The way you load navigation items is not correct yet. You forgot dashlets and you only load shared items the user is an owner of.

Take a look at \Icinga\Web\Navigation\Navigation::load for example. Though, please note that for dashlets a more complex solution is needed. Dashlets by modules can be loaded there (and should! Also modules may provide external URLs this way), but not user dashlets. This is done by \Icinga\Web\Widget\Dashboard::load instead.

Also, please remember that there are additional types of navigation items. A module can provide its own as well using \Icinga\Application\Modules\Module::provideNavigationItem. Monitoring's and Icinga DB Web's host and service actions are an example which may also result in an iframe.

So please restore the NavigationController and think about an alternative to the NavigationItemHelper.

@cla-bot
Copy link

cla-bot bot commented Aug 6, 2025

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Davide Zeni.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@cla-bot cla-bot bot removed the cla/signed label Aug 6, 2025
@cla-bot
Copy link

cla-bot bot commented Aug 6, 2025

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Davide Zeni.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@zenosaaur zenosaaur force-pushed the 5333-allow-customization-of-the-csp branch from 3e68e02 to 47c9736 Compare August 6, 2025 15:48
@cla-bot
Copy link

cla-bot bot commented Aug 6, 2025

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Davide Zeni.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@zenosaaur zenosaaur force-pushed the 5333-allow-customization-of-the-csp branch from 47c9736 to 78bfc90 Compare August 6, 2025 16:06
@cla-bot
Copy link

cla-bot bot commented Aug 6, 2025

Thank you for your pull request. Before we can look at it, you'll need to sign a Contributor License Agreement (CLA).

Please follow instructions at https://icinga.com/company/contributor-agreement to sign the CLA.

After that, please reply here with a comment and we'll verify.

Contributors that have not signed yet: @zenosaaur

  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Please contact us if you think this is the case.

  • If you signed the CLA as a corporation, your GitHub username may not have been submitted to us. Please reach out to the responsible person in your organization.

@gianlucapiccolo
Copy link
Contributor

hello @nilmerg can you please give us a feedback on the changes we made? Thanks!!

@cla-bot
Copy link

cla-bot bot commented Aug 25, 2025

Thank you for your pull request. Before we can look at it, you'll need to sign a Contributor License Agreement (CLA).

Please follow instructions at https://icinga.com/company/contributor-agreement to sign the CLA.

After that, please reply here with a comment and we'll verify.

Contributors that have not signed yet: @zenosaaur

  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Please contact us if you think this is the case.

  • If you signed the CLA as a corporation, your GitHub username may not have been submitted to us. Please reach out to the responsible person in your organization.

@cla-bot
Copy link

cla-bot bot commented Sep 2, 2025

Thank you for your pull request. Before we can look at it, you'll need to sign a Contributor License Agreement (CLA).

Please follow instructions at https://icinga.com/company/contributor-agreement to sign the CLA.

After that, please reply here with a comment and we'll verify.

Contributors that have not signed yet: @zenosaaur

  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Please contact us if you think this is the case.

  • If you signed the CLA as a corporation, your GitHub username may not have been submitted to us. Please reach out to the responsible person in your organization.

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.

Allow customization of the CSP

5 participants