Skip to content

test(getClientIp-accessibility): verify Data Accessibility & Header R…#5408

Closed
realtushartyagi wants to merge 1 commit into
JhaSourav07:mainfrom
realtushartyagi:test/getClientIp-accessibility
Closed

test(getClientIp-accessibility): verify Data Accessibility & Header R…#5408
realtushartyagi wants to merge 1 commit into
JhaSourav07:mainfrom
realtushartyagi:test/getClientIp-accessibility

Conversation

@realtushartyagi

@realtushartyagi realtushartyagi commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Description

This PR Adds header resolution and IP access tests for utils/getClientIp.

Fixes #4657

Pillar

  • 🎨 Pillar 1 — New Theme Design
  • 📐 Pillar 2 — Geometric SVG Improvement
  • 🕐 Pillar 3 — Timezone Logic Optimization
  • 🛠️ Other (Bug fix, refactoring, docs)

Visual Preview

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally (localhost:3000/api/streak?user=YOUR_USERNAME).
  • I have run npm run format and npm run lint locally and resolved all errors (CI will fail otherwise).
  • My commits follow the Conventional Commits format (e.g., feat(themes): ..., fix(calculate): ...).
  • I have updated README.md if I added a new theme or URL parameter.
  • I have started the repo.
  • I have made sure that i have only one commit to merge in this PR.
  • The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts).
  • (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.

Copilot AI review requested due to automatic review settings June 12, 2026 15:16
@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

@realtushartyagi is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Hey @realtushartyagi! Thanks for your contribution! 🎉

Unfortunately, this PR has been automatically closed because it is not linked to any open issue.

To resolve this, please do the following:

  1. Link a valid open issue by editing your PR description to include a closing keyword (e.g., Fixes #<issue-number>).
  2. Reopen this PR once the link is added.

💡 You can link multiple issues if needed (e.g. Fixes #12, Closes #34).
If you're working on something that doesn't have an issue yet, please open one first and then link it here.

We look forward to reviewing your PR once an issue is linked! 🚀

@github-actions github-actions Bot closed this Jun 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a Vitest test suite to validate getClientIp behavior across common proxy/header scenarios, including spoofing detection and fallback behavior.

Changes:

  • Introduces header-resolution tests for X-Forwarded-For, cf-connecting-ip, and x-real-ip
  • Adds spoofing-detection assertion via console.warn
  • Adds coverage for default/fallback IP behavior and trusted-proxy boundary traversal

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +14 to +18
const request = new Request('https://commitpulse.com', {
headers: new Headers({
'x-forwarded-for': '203.0.113.1, 198.51.100.1, 192.0.2.1',
}),
});
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { getClientIp } from './getClientIp';

describe('getClientIp Data Accessibility & Header Resolution Tests', () => {
vi.restoreAllMocks();
});

it('1. reliably accesses the leftmost client IP in an X-Forwarded-For proxy chain when proxies are universally trusted', () => {
@realtushartyagi realtushartyagi deleted the test/getClientIp-accessibility branch June 12, 2026 15:18
@realtushartyagi realtushartyagi restored the test/getClientIp-accessibility branch June 12, 2026 15:23
@realtushartyagi realtushartyagi deleted the test/getClientIp-accessibility branch June 12, 2026 15:35
@Aamod-Dev Aamod-Dev added level:beginner Small changes Usually isolated fixes or simple UI/text updates. type:testing Adding, updating, or fixing tests quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. mentor:Aamod007 labels Jun 12, 2026
@Aamod-Dev

Copy link
Copy Markdown
Collaborator

Applying labels for scoring. \level:beginner\ because this is a single-file test suite, \ ype:testing\ since it adds coverage, and \quality:clean\ for clear, well-structured tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:beginner Small changes Usually isolated fixes or simple UI/text updates. mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:testing Adding, updating, or fixing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(getClientIp-accessibility): verify Accessibility Standards & Screen Reader Aria Compliance (Variation 4)

3 participants