os-nginx: add X-Frame-Options, Permissions-Policy and Server header removal
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
調査の方向性
Start by locating the os-nginx Security Header model and its template, then inspect the HTTP settings model and template where server_tokens off; is rendered. Check the existing field validation and header rendering patterns, and run the relevant plugin tests or configuration checks. Done means the requested validated header options and Server header removal are persisted in configuration and render into the intended nginx contexts.
索引モデルが issue の本文から書いたものです。
説明
Important notices
- I have read the contributing guide
- I have searched for existing issues
Is your feature request related to a problem? Please describe.
The Security Header object in os-nginx currently supports Referrer, XSS Protection,
Don't Sniff Content Type, HSTS, HPKP and CSP. Three common hardening measures
recommended by the OWASP Secure Headers Project and flagged by scanners are missing:
X-Frame-OptionsPermissions-Policy- removing the
Serverresponse header (server_tokens offonly hides the version;
nginx still sendsServer: nginx)
The only way to achieve this today is custom files in /usr/local/etc/nginx/http_post/.
That has two drawbacks:
add_headerathttplevel is not inherited by server blocks that define their own
add_header– which every server does as soon as a Security Header object is
assigned. The workaround therefore needsmore_set_headers/more_clear_headers
(headers-more module), which is not obvious to most users.- The files are not part of
config.xml, so they are not included in configuration
backups, are not synchronised to an HA peer, and are lost on reinstall.
Describe the solution you like
Constrained, validated fields only – no free-form config:
-
X-Frame-Options –
OptionFieldin the Security Header model
Values: (not set),DENY,SAMEORIGIN
Rendered as:
proxy_hide_header X-Frame-Options;
add_header X-Frame-Options "" always; -
Permissions-Policy –
TextFieldwith strict mask validation in the Security
Header model
Onlydirective=allowlistpairs separated by commas, e.g.
camera=(self), microphone=(self), geolocation=(), payment=()
Suggested mask (rejects;,{,}, quotes outside origins and newlines):
/^[a-z-]+=(*|((\s*(self|"https?://[^"\s;{}]+")\s*)))(\s,\s*[a-z-]+=(*|((\s*(self|"https?://[^"\s;{}]+")\s*))))$/
Rendered as:
proxy_hide_header Permissions-Policy;
add_header Permissions-Policy "" always; -
Remove
Serverresponse header – global checkbox in the HTTP settings
(next to the existing option that rendersserver_tokens off;)
Since the plugin already loadsngx_http_headers_more_filter_module, this could be
rendered in thehttpblock as:
more_clear_headers Server;
Items 1 and 2 follow the existing behaviour of the Security Header object ("if you set
a setting here, it will override what the webserver sets").
Optional, if in scope: Cross-Origin-Opener-Policy and Cross-Origin-Resource-Policy
as OptionFields with their standard values.
Describe alternatives you considered
- Custom files in
http_post/(more_set_headers/more_clear_headers) – works, but
not persisted inconfig.xml(see above). - Patching the model/template locally – overwritten on every plugin update.
- A generic free-text field – I understand this has been declined before because broken
input can take down nginx; the proposal above deliberately avoids that by using
validated fields only.
Additional context
- OPNsense 26.10.0p1-amd64, os-nginx 1.36_5, nginx 1.36_5
- Side note, possibly a separate issue: browsers have dropped HPKP, and current guidance
forX-XSS-Protectionis0or omitting it. The help texts could mention this.
- 主要言語
- PHP
- スター
- 1.2k
- フォーク
- 926
- 平均マージ
- 1日 10時間
- マージ済み PR(30日)
- 25
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
opnsense/plugins のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
opnsense/plugins#5976 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
net/haproxy: IPv6 literal in real server "Source address" generates an invalid `source` directiveオープンincomplete
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
opnsense/plugins#5973 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[dns/ddclient] Support hiding unused standard fields per service (optional_hiding)対応中かも @bringha1 が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
q-feeds-connector: "error in configd communication" every update when the Unbound DNSBL rebuild takes longer than 120s対応中かも @mhatipog が 9 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
opnsense/plugins の issue をすべて見る
似ている issue
-
15.0
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
open-telemetry/opentelemetry-php-distro#176 ·
メンテナーはふだん 2 日以内に返信
-
No Code Attached Yet
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
joomla/joomla-cms#48941 ·
メンテナーはふだん 1 日以内に返信
-
needs-triage Platform(Default)
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
bug new
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
moodle-an-hochschulen/moodle-theme_boost_union#1500 ·
メンテナーはふだん 1 日以内に返信