Skip to content

Build v1.11.2 #3

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Build v1.11.2 #3

wants to merge 2 commits into from

Conversation

lllamnyp
Copy link
Member

@lllamnyp lllamnyp commented Mar 28, 2025

Summary by CodeRabbit

  • Chores
    • Excluded temporary files from version control.
    • Streamlined the container build process with improved file copying and patch application.
  • New Features
    • Introduced a dynamic NGINX configuration template that supports flexible server management and enhanced security.
    • Added a provenance record detailing the build of the NGINX Ingress controller.
  • Bug Fixes
    • Improved TLS message handling for more robust connections.
    • Strengthened password file path validation to prevent potential vulnerabilities.

Copy link

coderabbitai bot commented Mar 28, 2025

Walkthrough

The changes update multiple components of the project. The .gitignore now excludes the tmp directory. The Dockerfile has been modified to adopt a two-step patch application process and adjust file copying for NGINX configuration, with an added image label. A new dynamic NGINX configuration template using Go templating syntax has been introduced, while a legacy template has been removed. Additionally, the TCP proxy’s TLS handling was enhanced with new constants and improved error handling, and the auth package now validates password file paths to prevent path traversal.

Changes

File(s) Change Summary
.gitignore Added an entry to ignore the tmp directory.
images/controller/Dockerfile Modified patch application: now copies files from the patches directory and applies all .diff files; updated copying of NGINX configuration with explicit ownership; added a new image label.
images/controller/etc/nginx/template/nginx.tmpl
chroot/etc/nginx/template/nginx.tmpl
Introduced a dynamic NGINX configuration template with Go templating and various settings; removed an obsolete legacy template.
images/controller/patches/11843.diff Enhanced TCP proxy’s Handle method by defining tlsHeaderLength and tlsMaxMessageLength, ensuring robust TLS ClientHello reading with improved error handling.
images/controller/patches/13068.diff Improved auth package by updating the password file path construction and validation to prevent path traversal; adjusted proxy directive formatting and commented out insecure test code.
images/controller/PROVENANCE.md Introduced a new markdown file documenting the build provenance of the NGINX Ingress controller, detailing versioning and sources.
images/controller/patches/nginx-tmpl.patch Deleted the legacy nginx.tmpl configuration template that contained directives for server setup and request handling.

Sequence Diagram(s)

sequenceDiagram
    participant Build as Build Process
    participant DF as Dockerfile Script
    participant PD as Patches Directory
    participant GA as Git Apply
    participant EC as NGINX Config Copier

    Build->>DF: Start build
    DF->>PD: Copy files from ./patches
    DF->>GA: Apply all *.diff files in current context
    DF->>EC: Copy ./etc/nginx to /etc/nginx (set ownership www-data)
    DF->>Build: Build complete with new label
Loading
sequenceDiagram
    participant TP as TCPProxy (Handle Method)
    participant Conn as Connection
    participant Log as Logger

    TP->>Conn: Read minimum of 5 bytes (TLS header)
    Conn-->>TP: Return header data
    TP->>Conn: Calculate expected ClientHello size and read full message
    Conn-->>TP: Return complete TLS message or error
    alt Successful Read
        TP->>TP: Process ClientHello message
    else Error Occurs
        TP->>Log: Log error with context
    end
Loading
sequenceDiagram
    participant Auth as Auth Module
    participant VF as File Path Validator
    participant Err as Error Handler

    Auth->>VF: Construct password file path
    VF-->>Auth: Return validation result (check for traversal characters)
    alt Valid Path
        Auth->>Auth: Continue processing auth configuration
    else Invalid Path
        Auth->>Err: Return error for invalid file path
    end
Loading

Poem

Oh, what a code-day, full of hops and tweaks,
A rabbit’s delight in each change that speaks.
Git ignores tmp, so no clutter to see,
Patches and templates dance in harmony.
TLS and auth now secure the flow—
Hopping through commits with a carrot’s glow.
🥕🐰 Coding magic on the go!


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (6)
images/controller/Dockerfile (1)

33-33: Include version locking for third-party libraries

Installing lua-iconv 7-3 is fine, but consider specifying explicit pinned versions or adding checks to confirm compatibility with the rest of the system. This helps avoid unexpected breaks when new releases appear.

images/controller/patches/13068.diff (1)

53-73: Temporarily disabling template testing

Commenting out the template test prevents potential security issues. However, consider tracking the re-enablement in a follow-up task or issue to ensure future thorough testing in a sandboxed environment.

images/controller/patches/11843.diff (2)

38-40: Ensure proper handling of non-TLS connections.

Allocating a buffer of size tlsHeaderLength + tlsMaxMessageLength is sufficient for valid TLS records, but consider rejecting or handling connections that do not meet the expected handshake content type in data[0]. This helps avoid misinterpretation when the incoming traffic is not actually TLS.


46-48: Validate content type before reading additional bytes.

Currently, the code infers the ClientHello length from data[3] and data[4], but does not check whether data[0] equals a valid TLS record type (e.g., 22 for handshake). Including a sanity check on data[0] may improve security by rejecting unexpected record types early.

images/controller/etc/nginx/template/nginx.tmpl (2)

153-168: Use caution with ModSecurity performance overhead.

Enabling modsecurity on; globally is powerful for security, but can introduce substantial performance overhead. Employ tight rules sets, confirm your rules are up to date, and consider excluding paths that do not require inspection to avoid performance bottlenecks.


1115-1120: Handle trailing slashes in rewrite logic.

The snippet that trims a trailing slash (lines 646-649) before redirecting can create edge cases for routes expecting a trailing slash (e.g., linting tools, older internal references). Consider appending the slash if it’s semantically required by the service.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e8e1cee and 4127d81.

📒 Files selected for processing (6)
  • .gitignore (1 hunks)
  • images/controller/Dockerfile (2 hunks)
  • images/controller/etc/nginx/template/nginx.tmpl (1 hunks)
  • images/controller/patches/11843.diff (1 hunks)
  • images/controller/patches/13068.diff (1 hunks)
  • images/controller/patches/nginx-tmpl.patch (0 hunks)
💤 Files with no reviewable changes (1)
  • images/controller/patches/nginx-tmpl.patch
🔇 Additional comments (12)
.gitignore (1)

1-2: Looks Good!

Adding tmp to .gitignore is a standard practice to avoid clutter from temporary files.

images/controller/Dockerfile (3)

8-9: Comprehensive patch application strategy

Copying patches into the build context and applying all .diff files simplifies the build process, but ensure the patch files won't unintentionally overwrite each other or conflict. This approach looks good given the existing environment.


38-39: File copying changes

Copying the controller binary and the entire etc/nginx directory is straightforward. Just confirm that no sensitive files in etc/nginx are accidentally exposed or overwritten.

Please ensure that only safe, necessary config files are included in etc/nginx. If you want me to verify by script, let me know.


41-41: Metadata enhancement

Adding the org.opencontainers.image.source label is a great step for traceability and maintainability.

images/controller/patches/13068.diff (2)

1-53: Secure password file naming

The updated logic using filepath.Join and validating normalized path components prevents path traversal attacks, which is crucial for security. Ensure logging calls in case of errors do not leak any sensitive filename details.


74-92: Refined quote handling in directives

Removing quotes and using strconv.Quote ensures correct quoting behavior. Double check that no special characters in the upstream hosts or URIs cause injection-like issues.

images/controller/patches/11843.diff (2)

9-12: Good addition of constants for clarity.

Defining tlsHeaderLength and tlsMaxMessageLength as named constants improves readability and encapsulates critical TLS record parameters in a single location.


40-45: Draw attention to partial reads and incomplete headers.

Using io.ReadAtLeast(conn, data, tlsHeaderLength) ensures that the TLS header bytes are read before proceeding. However, make sure to handle scenarios where partial data is received or the TLS header is malformed (e.g., truncated, zero-length, etc.). Consider adding more robust validation of the received header fields to avoid potential index errors later.

images/controller/etc/nginx/template/nginx.tmpl (4)

309-317: Validate performance impact with AIO and threaded I/O.

Using aio threads; and enabling tcp_nopush on; tcp_nodelay on; can significantly impact performance, especially under heavy load. Verify that these settings match your intended workload profile and hardware resources.


449-456: Confirm upgrade logic for WebSocket connections.

Mapping $http_upgrade to $connection_upgrade is standard for WebSocket traffic. However, ensure that ancillary protocols (e.g., HTTP/2 or HTTP/3 upgrades) are not hindered by these settings. In particular, confirm there's no conflict with other modules or used protocols.


621-673: Examine redirect logic for downstream invariants.

The per-server redirect (lines 622-673) sets up a 302 to $redirect.To. Confirm that rewriting paths and ports aligns with any custom logic in your environment (e.g., SSO logins, path-based routing). Mismatched or static port mappings may break behind proxies that override ports.


1539-1547: Consider upstream fallback logic.

Using proxy_intercept_errors on; combined with custom error pages is powerful. However, confirm that a mismatch in error handling from the upstream does not inadvertently mask legitimate client or upstream errors. Regularly test your custom error pages for correctness and user experience.

Comment on lines +49 to +55
+ bLength, err := io.ReadAtLeast(conn, data[length:], tlsHeaderLength+clientHelloLength-length)
+ if err != nil {
+ klog.V(4).ErrorS(err, fmt.Sprintf("Error reading ClientHello of length %d from the connection", clientHelloLength))
+ return
+ }
+ length += bLength
+
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Check correctness of subsequent read length.

clientHelloLength might be smaller than the actual handshake message if a malicious client spoofs an intentionally small length in the TLS record. Safely handling any mismatch in the second read (e.g., returning an error if fewer bytes arrive than expected) helps harden the handshake process.

Comment on lines +1121 to +1244
}

proxy_cache auth_cache;

{{- range $dur := $externalAuth.AuthCacheDuration }}
proxy_cache_valid {{ $dur }};
{{- end }}

proxy_cache_key "$cache_key";
{{ end }}

# ngx_auth_request module overrides variables in the parent request,
# therefore we have to explicitly set this variable again so that when the parent request
# resumes it has the correct value set for this variable so that Lua can pick backend correctly
set $proxy_upstream_name {{ buildUpstreamName $location | quote }};

proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Forwarded-Proto "";
proxy_set_header X-Request-ID $req_id;

{{ if $externalAuth.Method }}
proxy_method {{ $externalAuth.Method }};
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Scheme $pass_access_scheme;
{{ end }}

proxy_set_header Host {{ $externalAuth.Host }};
proxy_set_header X-Original-URL $scheme://$http_host$request_uri;
proxy_set_header X-Original-Method $request_method;
proxy_set_header X-Sent-From "nginx-ingress-controller";
proxy_set_header X-Real-IP $remote_addr;
{{ if and $all.Cfg.UseForwardedHeaders $all.Cfg.ComputeFullForwardedFor }}
proxy_set_header X-Forwarded-For $full_x_forwarded_for;
{{ else }}
proxy_set_header X-Forwarded-For $remote_addr;
{{ end }}

{{ if $externalAuth.RequestRedirect }}
proxy_set_header X-Auth-Request-Redirect {{ $externalAuth.RequestRedirect }};
{{ else }}
proxy_set_header X-Auth-Request-Redirect $request_uri;
{{ end }}

{{ if not (contains $externalAuth.AuthSnippet "proxy_connect_timeout") }}
proxy_connect_timeout 15s;
{{ end }}

{{ if $externalAuth.AuthCacheKey }}
proxy_buffering "on";
{{ else }}
proxy_buffering {{ $location.Proxy.ProxyBuffering }};
{{ end }}
proxy_buffer_size {{ $location.Proxy.BufferSize }};
proxy_buffers {{ $location.Proxy.BuffersNumber }} {{ $location.Proxy.BufferSize }};
proxy_request_buffering {{ $location.Proxy.RequestBuffering }};

proxy_ssl_server_name on;
proxy_pass_request_headers on;
{{ if isValidByteSize $location.Proxy.BodySize true }}
client_max_body_size {{ $location.Proxy.BodySize }};
{{ end }}
{{ if isValidByteSize $location.ClientBodyBufferSize false }}
client_body_buffer_size {{ $location.ClientBodyBufferSize }};
{{ end }}

# Pass the extracted client certificate to the auth provider
{{ if not (empty $server.CertificateAuth.CAFileName) }}
{{ if $server.CertificateAuth.PassCertToUpstream }}
proxy_set_header ssl-client-cert $ssl_client_escaped_cert;
{{ end }}
proxy_set_header ssl-client-verify $ssl_client_verify;
proxy_set_header ssl-client-subject-dn $ssl_client_s_dn;
proxy_set_header ssl-client-issuer-dn $ssl_client_i_dn;
{{ end }}

{{- range $line := buildAuthProxySetHeaders $externalAuth.ProxySetHeaders}}
{{ $line }}
{{- end }}

{{ if not (empty $externalAuth.AuthSnippet) }}
{{ $externalAuth.AuthSnippet }}
{{ end }}

{{ if and (eq $applyAuthUpstream true) (eq $applyGlobalAuth false) }}
{{ $authUpstreamName := buildAuthUpstreamName $location $server.Hostname }}
# The target is an upstream with HTTP keepalive, that is why the
# Connection header is cleared and the HTTP version is set to 1.1 as
# the Nginx documentation suggests:
# http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive
proxy_http_version 1.1;
proxy_set_header Connection "";
set $target {{ changeHostPort $externalAuth.URL $authUpstreamName }};
{{ else }}
proxy_http_version {{ $location.Proxy.ProxyHTTPVersion }};
set $target {{ $externalAuth.URL | quote }};
{{ end }}
proxy_pass $target;
}
{{ end }}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Check for potential double-escape or injection with external auth.

When sending $request_uri and passing X-Original-Method, X-Original-URL, and other headers to the external auth endpoint, carefully ensure they are sanitized or validated. This helps prevent header smuggling or injection attacks if the external auth system does not sanitize inputs.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
images/controller/etc/nginx/template/nginx.tmpl (2)

203-252: Consolidate duplicated GeoIP2 City database configurations

Similar to the Country database configurations, there's duplication between GeoLite2-City and GeoIP2-City databases with identical variable declarations.

Consider consolidating these duplicated blocks:

- {{ if eq $file "GeoLite2-City.mmdb" }}
- geoip2 /etc/ingress-controller/geoip/GeoLite2-City.mmdb {
-     {{ if (gt $cfg.GeoIP2AutoReloadMinutes 0) }}
-     auto_reload {{ $cfg.GeoIP2AutoReloadMinutes }}m;
-     {{ end }}
-     $geoip2_city_country_code source=$remote_addr country iso_code;
-     # ... rest of variables
- }
- {{ end }}
-
- {{ if eq $file "GeoIP2-City.mmdb" }}
- geoip2 /etc/ingress-controller/geoip/GeoIP2-City.mmdb {
-     {{ if (gt $cfg.GeoIP2AutoReloadMinutes 0) }}
-     auto_reload {{ $cfg.GeoIP2AutoReloadMinutes }}m;
-     {{ end }}
-     $geoip2_city_country_code source=$remote_addr country iso_code;
-     # ... rest of variables
- }
- {{ end }}
+ {{ if or (eq $file "GeoLite2-City.mmdb") (eq $file "GeoIP2-City.mmdb") }}
+ geoip2 /etc/ingress-controller/geoip/{{ $file }} {
+     {{ if (gt $cfg.GeoIP2AutoReloadMinutes 0) }}
+     auto_reload {{ $cfg.GeoIP2AutoReloadMinutes }}m;
+     {{ end }}
+     $geoip2_city_country_code source=$remote_addr country iso_code;
+     # ... rest of variables
+ }
+ {{ end }}

255-272: Consolidate duplicated GeoIP2 ASN database configurations

There's duplication between GeoLite2-ASN and GeoIP2-ASN database configurations with identical variable declarations.

Consider consolidating these duplicated blocks:

- {{ if eq $file "GeoLite2-ASN.mmdb" }}
- geoip2 /etc/ingress-controller/geoip/GeoLite2-ASN.mmdb {
-     {{ if (gt $cfg.GeoIP2AutoReloadMinutes 0) }}
-     auto_reload {{ $cfg.GeoIP2AutoReloadMinutes }}m;
-     {{ end }}
-     $geoip2_asn source=$remote_addr autonomous_system_number;
-     $geoip2_org source=$remote_addr autonomous_system_organization;
- }
- {{ end }}
-
- {{ if eq $file "GeoIP2-ASN.mmdb" }}
- geoip2 /etc/ingress-controller/geoip/GeoIP2-ASN.mmdb {
-     {{ if (gt $cfg.GeoIP2AutoReloadMinutes 0) }}
-     auto_reload {{ $cfg.GeoIP2AutoReloadMinutes }}m;
-     {{ end }}
-     $geoip2_asn source=$remote_addr autonomous_system_number;
-     $geoip2_org source=$remote_addr autonomous_system_organization;
- }
- {{ end }}
+ {{ if or (eq $file "GeoLite2-ASN.mmdb") (eq $file "GeoIP2-ASN.mmdb") }}
+ geoip2 /etc/ingress-controller/geoip/{{ $file }} {
+     {{ if (gt $cfg.GeoIP2AutoReloadMinutes 0) }}
+     auto_reload {{ $cfg.GeoIP2AutoReloadMinutes }}m;
+     {{ end }}
+     $geoip2_asn source=$remote_addr autonomous_system_number;
+     $geoip2_org source=$remote_addr autonomous_system_organization;
+ }
+ {{ end }}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4127d81 and 0942240.

📒 Files selected for processing (5)
  • images/controller/Dockerfile (2 hunks)
  • images/controller/PROVENANCE.md (1 hunks)
  • images/controller/etc/nginx/template/nginx.tmpl (1 hunks)
  • images/controller/patches/13068.diff (1 hunks)
  • images/controller/patches/nginx-tmpl.patch (0 hunks)
💤 Files with no reviewable changes (1)
  • images/controller/patches/nginx-tmpl.patch
✅ Files skipped from review due to trivial changes (1)
  • images/controller/PROVENANCE.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • images/controller/patches/13068.diff
  • images/controller/Dockerfile
🔇 Additional comments (7)
images/controller/etc/nginx/template/nginx.tmpl (7)

174-200: Consolidate repeated GeoIP database configurations

This code contains nearly identical blocks for "GeoLite2-Country.mmdb" and "GeoIP2-Country.mmdb" databases with the same variable declarations. Similar duplications exist for City and ASN database configurations as well.

Consider consolidating these duplicated blocks to improve maintainability:

- {{ if eq $file "GeoLite2-Country.mmdb" }}
- geoip2 /etc/ingress-controller/geoip/GeoLite2-Country.mmdb {
-     {{ if (gt $cfg.GeoIP2AutoReloadMinutes 0) }}
-     auto_reload {{ $cfg.GeoIP2AutoReloadMinutes }}m;
-     {{ end }}
-     $geoip2_country_code source=$remote_addr country iso_code;
-     $geoip2_country_name source=$remote_addr country names en;
-     $geoip2_country_geoname_id source=$remote_addr country geoname_id;
-     $geoip2_continent_code source=$remote_addr continent code;
-     $geoip2_continent_name source=$remote_addr continent names en;
-     $geoip2_continent_geoname_id source=$remote_addr continent geoname_id;
- }
- {{ end }}
-
- {{ if eq $file "GeoIP2-Country.mmdb" }}
- geoip2 /etc/ingress-controller/geoip/GeoIP2-Country.mmdb {
-     {{ if (gt $cfg.GeoIP2AutoReloadMinutes 0) }}
-     auto_reload {{ $cfg.GeoIP2AutoReloadMinutes }}m;
-     {{ end }}
-     $geoip2_country_code source=$remote_addr country iso_code;
-     $geoip2_country_name source=$remote_addr country names en;
-     $geoip2_country_geoname_id source=$remote_addr country geoname_id;
-     $geoip2_continent_code source=$remote_addr continent code;
-     $geoip2_continent_name source=$remote_addr continent names en;
-     $geoip2_continent_geoname_id source=$remote_addr continent geoname_id;
- }
- {{ end }}
+ {{ if or (eq $file "GeoLite2-Country.mmdb") (eq $file "GeoIP2-Country.mmdb") }}
+ geoip2 /etc/ingress-controller/geoip/{{ $file }} {
+     {{ if (gt $cfg.GeoIP2AutoReloadMinutes 0) }}
+     auto_reload {{ $cfg.GeoIP2AutoReloadMinutes }}m;
+     {{ end }}
+     $geoip2_country_code source=$remote_addr country iso_code;
+     $geoip2_country_name source=$remote_addr country names en;
+     $geoip2_country_geoname_id source=$remote_addr country geoname_id;
+     $geoip2_continent_code source=$remote_addr continent code;
+     $geoip2_continent_name source=$remote_addr continent names en;
+     $geoip2_continent_geoname_id source=$remote_addr continent geoname_id;
+ }
+ {{ end }}

Apply similar consolidation for the City and ASN database configurations as well.


1121-1244: Check for potential double-escape or injection with external auth.

When sending $request_uri and passing X-Original-Method, X-Original-URL, and other headers to the external auth endpoint, carefully ensure they are sanitized or validated. This helps prevent header smuggling or injection attacks if the external auth system does not sanitize inputs.


1-13: LGTM - Variable declarations and basic configuration

The variable declarations at the top of the template and the basic NGINX configuration settings (checksum, pid, pcre_jit) are well-structured.


18-37: LGTM - Conditional module loading

The conditional module loading based on configuration flags is a good practice for optimizing resource usage - only loading modules when they are needed.


39-63: LGTM - Worker and event configuration

The worker process configuration and events block are well-configured with appropriate parameters for tuning performance.


74-139: LGTM - Lua initialization with proper error handling

The Lua initialization block has proper error handling using pcall and comprehensive error reporting.


549-573: LGTM - Dynamic upstream balancer configuration

The upstream balancer configuration with Lua integration is well-designed for dynamic backend management.

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.

Update ingress-nginx chart to mitigate CVE-2025-1974
1 participant