-
Notifications
You must be signed in to change notification settings - Fork 0
Add security.txt auditor and harden scanner security #8
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9ccff85
feat: add security.txt audit and harden scanners
tinkthemaker adf34cf
merge: reconcile security hardening with main
tinkthemaker 788e77e
fix: address security auditor review findings
tinkthemaker 8061bac
merge: integrate dependency and network hardening
tinkthemaker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Security Policy | ||
|
|
||
| ## Defensive use only | ||
|
|
||
| Cyber Toolbox is built for authorized security testing, education, and portfolio demonstration. Do not use it to scan systems you do not own or do not have explicit permission to test. | ||
|
|
||
| The hosted tools intentionally avoid aggressive behavior. They perform bounded checks such as header inspection, TLS handshakes, CORS probes, and standards-based metadata audits. They are not vulnerability exploitation tools. | ||
|
|
||
| ## Reporting vulnerabilities | ||
|
|
||
| If you find a vulnerability in Cyber Toolbox itself, please report it privately instead of opening a public issue with exploit details. | ||
|
|
||
| Preferred contact: `tinkthemaker@proton.me` | ||
|
|
||
| Please include: | ||
|
|
||
| - A clear description of the issue | ||
| - Steps to reproduce | ||
| - Affected route or component | ||
| - Potential impact | ||
| - Any suggested remediation | ||
|
|
||
| ## Supported version | ||
|
|
||
| This is a portfolio project. The `main` branch is the supported version. | ||
|
|
||
| ## Security design notes | ||
|
|
||
| The app includes several guardrails: | ||
|
|
||
| - Server-side URL scans pass through an SSRF guard and connect only to validated public addresses. | ||
| - Redirects are followed manually and re-checked at each hop. | ||
| - Private, loopback, link-local, multicast, reserved, cloud metadata, `.local`, and `localhost` targets are blocked. | ||
| - API routes cap JSON request bodies and use a bounded per-IP in-memory rate limiter. | ||
| - The app sets static security headers through `vercel.json`. | ||
| - A per-request CSP nonce is generated in the application proxy for inline Next.js scripts. | ||
|
|
||
| These controls reduce abuse risk, but they do not make unauthorized scanning acceptable. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { NextResponse } from "next/server"; | ||
| import { clientKeyFromHeaders, rateLimit } from "@/lib/security/rate-limit"; | ||
| import { readJsonRequest } from "@/lib/security/request"; | ||
| import { runSecurityTxtAudit } from "@/lib/securitytxt/scan"; | ||
|
|
||
| export const runtime = "nodejs"; | ||
| export const dynamic = "force-dynamic"; | ||
| export const maxDuration = 15; | ||
|
|
||
| export async function POST(req: Request) { | ||
| const key = clientKeyFromHeaders(new Headers(req.headers)); | ||
| const rl = rateLimit(key); | ||
| if (!rl.ok) { | ||
| return NextResponse.json( | ||
| { error: `Rate limit exceeded. Try again in ${rl.retryAfterSec}s.` }, | ||
| { status: 429, headers: { "Retry-After": String(rl.retryAfterSec) } }, | ||
| ); | ||
| } | ||
|
|
||
| const parsed = await readJsonRequest(req); | ||
| if (!parsed.ok) { | ||
| return NextResponse.json({ error: parsed.error }, { status: parsed.status }); | ||
| } | ||
|
|
||
| const url = (parsed.value as { url?: unknown })?.url; | ||
| if (typeof url !== "string" || url.length === 0 || url.length > 2048) { | ||
| return NextResponse.json({ error: "Provide a 'url' string (max 2048 chars)." }, { status: 400 }); | ||
| } | ||
|
|
||
| const result = await runSecurityTxtAudit(url); | ||
| if (!result.ok) { | ||
| return NextResponse.json({ error: result.reason }, { status: 400 }); | ||
| } | ||
| return NextResponse.json(result.report); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.