Skip to content

feat: Custom lint rules#9920

Draft
fiosman wants to merge 59 commits into
developfrom
feat/custom-lint-rules
Draft

feat: Custom lint rules#9920
fiosman wants to merge 59 commits into
developfrom
feat/custom-lint-rules

Conversation

@fiosman
Copy link
Copy Markdown
Contributor

@fiosman fiosman commented May 14, 2026

Adding tests

fiosman and others added 30 commits May 4, 2026 13:19
…ruleset file [INS-2338]

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
…ects

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Comment on lines +57 to +66
export function isPrivateOrLoopbackHost(hostname: string): boolean {
if (hostname === 'localhost' || hostname.endsWith('.localhost')) {
return true;
}
const host = hostname.startsWith('[') && hostname.endsWith(']') ? hostname.slice(1, -1) : hostname;
if (!ipaddr.isValid(host)) {
return false;
}
return ipaddr.process(host).range() !== 'unicast';
}
Copy link
Copy Markdown
Contributor

@kwburns-kong kwburns-kong May 15, 2026

Choose a reason for hiding this comment

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

Confirmed this can be circumventable during domain resolution to hit localhost. If the domain resolves to 127.0.0.1 it's possible to interact with internal services. You can URL https://app.localtest.me/rules.yaml to verify.

const SAFE_URL_SCHEMES = ['https:'];

// Check if path is absolute file path (e.g. /foo/bar.yaml, C:\foo\bar.yaml, \\server\share\file.yaml)
function isAbsoluteFilePath(value: string): boolean {
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.

Any way to use insecureReadFile() to limit this based on what users grant access to within settings?


// Check if path is absolute file path (e.g. /foo/bar.yaml, C:\foo\bar.yaml, \\server\share\file.yaml)
function isAbsoluteFilePath(value: string): boolean {
return value.startsWith('/') || value.startsWith('\\\\') || /^[A-Za-z]:[\\/]/.test(value);
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.

Haven't found a way to leverage this into anything, but came up anyway. Depending on OS thevalue.startsWith('\\\\') || /^[A-Za-z]:[\\/]/.test(value); will resolve as a relative path. Any way to do a conditional check of OS to prevent that?

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.

2 participants