Skip to content

fix: CxONE findings#178

Merged
cb80 merged 1 commit into
mainfrom
httpHeaders
Jun 10, 2026
Merged

fix: CxONE findings#178
cb80 merged 1 commit into
mainfrom
httpHeaders

Conversation

@cb80

@cb80 cb80 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:


Special notes for your reviewer:


Release note:


Summary by CodeRabbit

  • Security Improvements

    • Implemented enhanced HTTP security headers with Content-Security-Policy directives to prevent content injection attacks, protect against unauthorized framing, and restrict form submissions to approved sources.
  • Chores

    • Updated linting configuration.

@cb80 cb80 self-assigned this Jun 5, 2026
@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The PR adds security hardening to the HTTP server by wrapping it with a middleware that applies Content-Security-Policy headers, and updates the linter configuration to disable the gomodguard linter check.

Changes

Security Configuration and Headers

Layer / File(s) Summary
Disable module guard linter
.golangci.yaml
gomodguard is added to the linters.disable list in golangci-lint configuration.
Security headers middleware integration
internal/business/server/http_server.go
HTTP server handler is wrapped with SecurityHeadersMiddleware, configured with a restrictive Content-Security-Policy that blocks default content, prevents frame embedding, disables base tag processing, and restricts form submissions.

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description contains only template placeholders without any actual content, special notes, or release notes filled in by the author. Fill in the template sections with actual details: explain what CxONE findings were addressed, describe the security header changes, and specify the release note (or 'NONE' if not applicable).
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: CxONE findings' refers to addressing CxONE security findings, which aligns with the changes made (adding security headers middleware and updating linter config for security purposes).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch httpHeaders

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Signed-off-by: Chris Burkert <burkert.chris@gmail.com>
@cb80 cb80 marked this pull request as ready for review June 5, 2026 09:29

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.golangci.yaml:
- Line 31: Re-enable gomodguard in .golangci.yaml (remove or undo the entry that
disables "gomodguard") unless you can add a clear, documented justification for
disabling it; if you choose to keep it disabled instead, add an alternative
dependency allow/block enforcement and document it in the repo (for example: a
COMPANY_DEPENDENCY_POLICY.md describing how dependencies are approved, or a CI
check that validates an allowlist) and reference the specific dependency usage
in internal/business/server/http_server.go (middleware.SecurityHeadersMiddleware
from github.com/openkcm/common-sdk) to show why the exception is needed. Ensure
the change either re-enables "gomodguard" or commits the justification and
alternative enforcement so supply-chain dependency validation is preserved.

In `@internal/business/server/http_server.go`:
- Around line 55-57: Add unit tests that exercise the
SecurityHeadersMiddleware-wrapped handler: create a server via
createHTTPServer(context.Background(), cfg), send an httptest request to an
existing endpoint (e.g., "/health") using server.Handler.ServeHTTP, and assert
that the "Content-Security-Policy" header exists and equals "default-src 'none';
frame-ancestors 'none'; base-uri 'none'; form-action 'none';"; also assert the
original handler behavior (status code/body) is unchanged to ensure middleware
does not interfere. Use a test file (e.g., http_server_test.go) and reference
middleware.SecurityHeadersMiddleware, createHTTPServer, and server.Handler in
the test.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ed49b9d9-a64e-49ae-b8dc-53a5ba24f5c8

📥 Commits

Reviewing files that changed from the base of the PR and between 85be2c2 and fd27e2c.

📒 Files selected for processing (2)
  • .golangci.yaml
  • internal/business/server/http_server.go

Comment thread .golangci.yaml
Comment thread internal/business/server/http_server.go
@cb80 cb80 merged commit 34e2cfe into main Jun 10, 2026
10 checks passed
@cb80 cb80 deleted the httpHeaders branch June 10, 2026 09:15
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.

3 participants