Skip to content

Conversation

@JustinBeckwith
Copy link
Owner

Summary

Adds a new --allow-insecure-certs flag that allows linkinator to ignore SSL/TLS certificate validation errors. This is useful for local development environments with self-signed or untrusted certificates.

Fixes #618

Changes

  • ✅ Added allowInsecureCerts option to CheckOptions interface
  • ✅ Added --allow-insecure-certs CLI flag with help documentation
  • ✅ Updated makeRequest() to use undici Agent with rejectUnauthorized: false when flag is enabled
  • ✅ Moved undici from devDependencies to dependencies (needed at runtime)
  • ✅ Added comprehensive test coverage for certificate validation scenarios
  • ✅ All 145 tests pass (including 4 new tests)

Usage

CLI

linkinator https://localhost:3000 --allow-insecure-certs

Programmatic API

import { check } from 'linkinator';

const result = await check({
  path: 'https://localhost:3000',
  allowInsecureCerts: true
});

Test Plan

Security Considerations

The flag is secure by default (requires explicit opt-in) and follows the existing pattern of other security-related flags like --require-https. Users must explicitly enable it, preventing accidental bypass of certificate validation.

🤖 Generated with Claude Code

…certificates

Adds a new `--allow-insecure-certs` flag that allows linkinator to ignore
SSL/TLS certificate validation errors, useful for local development with
self-signed or untrusted certificates.

Changes:
- Added `allowInsecureCerts` option to CheckOptions interface
- Added `--allow-insecure-certs` CLI flag with help documentation
- Modified makeRequest() to use undici Agent with rejectUnauthorized: false
- Moved undici from devDependencies to dependencies for runtime use
- Added comprehensive test coverage for certificate validation scenarios

Fixes #618

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Fixes CodeQL security findings by replacing unsafe `.includes()` substring
matching with proper URL parsing using the URL API. This prevents potential
URL manipulation attacks where a malicious domain could include the target
domain in its path or query string.

Changes:
- Replace `link.url.includes('domain.com')` with proper URL hostname checking
- Use `new URL(link.url).hostname === 'domain.com'` for exact matching
- Add try-catch to handle invalid URLs gracefully

Security impact: Fixes 4 High severity findings (Incomplete URL substring sanitization)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@JustinBeckwith JustinBeckwith merged commit 6aa769c into main Oct 20, 2025
8 checks passed
@JustinBeckwith JustinBeckwith deleted the feat/allow-insecure-certs branch October 20, 2025 21:39
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.

Option to Ignore untrusted certificates on HTTPS

2 participants