Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitleaks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ title = "Gitleaks title"
[allowlist]
id = "skip class_generator/schema"
description = "ignore class_generator/schema"
paths = ['''class_generator/schema/''']
paths = ['''class_generator/schema/''', '''docs/''']
regexex = ['''^.*\.(yaml|yml)$''']
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ repos:
"--exclude-files=class_generator/schema/*",
"--exclude-files=class_generator/__k8s-openapi-.*.json",
"--exclude-files=fake_kubernetes_client/__resources-mappings.json",
"--exclude-files=docs/.*",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

1. Docs secret-scan bypass 🐞 Bug ⛨ Security

The PR broadly reduces secret-scanning coverage by excluding the entire docs/ directory from
detect-secrets and adding docs/ to the gitleaks allowlist, creating a blind spot where real
credentials pasted into documentation would not be flagged. Additionally, the gitleaks allowlist
entry’s id/description still suggests it only skips class_generator/schema, making the expanded
ignore scope easy to miss and less intentional/visible during review.
Agent Prompt
## Issue description
`docs/` is broadly excluded/allowlisted from secret scanning, which creates a blind spot where real secrets can slip through undetected, and the gitleaks allowlist entry metadata (id/description) no longer matches what it actually ignores after adding `docs/`, reducing visibility/intent.

## Issue Context
The docs are generated and include placeholder token/password-like strings, which likely motivated the exclusions to avoid false positives. However, excluding/allowlisting the entire `docs/` tree is broader than necessary, and combining unrelated ignore scopes (schema + docs) under a label that only mentions schema makes future ignore expansions easier to miss during review.

## Fix Focus Areas
- `.pre-commit-config.yaml[36-46]`
- `.gitleaks.toml[4-8]`

## Suggested fix approach
1. Replace the blanket `docs/.*` exclusion with a narrower rule (e.g., exclude only generated `*.html` and/or `docs/search-index.json`, while still scanning `*.md`), or exclude only specific known false-positive files.
2. For gitleaks, prefer allowlisting only known placeholder patterns (where supported) rather than all of `docs/`, and ensure any path-based allowlisting is as narrow as practical.
3. Update the existing gitleaks allowlist `id` and `description` to accurately reflect what it ignores, or split it into two entries (one for `class_generator/schema/`, one for `docs/`) so the purpose and scope are explicit.
4. Add a short comment explaining why the exclusions exist and what content is expected/safe in generated docs to prevent future over-expansion.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

]

- repo: https://github.com/astral-sh/ruff-pre-commit
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# openshift-python-wrapper (`wrapper`)

📖 **[Full Documentation](https://redhatqe.github.io/openshift-python-wrapper/)**

Pypi: [openshift-python-wrapper](https://pypi.org/project/openshift-python-wrapper)
A python wrapper for [kubernetes-python-client](https://github.com/kubernetes-client/python) with support for [RedHat Container Virtualization](https://www.openshift.com/learn/topics/virtualization)
Docs: [openshift-python-wrapper docs](https://openshift-python-wrapper.readthedocs.io/en/latest/)
Expand Down
Empty file added docs/.nojekyll
Empty file.
26 changes: 26 additions & 0 deletions docs/assets/callouts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
(function() {
var blockquotes = document.querySelectorAll('blockquote');
blockquotes.forEach(function(bq) {
var firstStrong = bq.querySelector('strong');
if (!firstStrong) return;

var text = firstStrong.textContent.toLowerCase().replace(':', '').trim();
var type = null;

if (text === 'note' || text === 'info') {
type = 'note';
} else if (text === 'warning' || text === 'caution') {
type = 'warning';
} else if (text === 'tip' || text === 'hint') {
type = 'tip';
} else if (text === 'danger' || text === 'error') {
type = 'danger';
} else if (text === 'important') {
type = 'important';
}

if (type) {
bq.classList.add('callout', 'callout-' + type);
}
});
})();
75 changes: 75 additions & 0 deletions docs/assets/codelabels.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
(function() {
var blocks = document.querySelectorAll('pre code');
blocks.forEach(function(code) {
var classes = code.className || '';
var match = classes.match(/language-(\w+)/);
if (!match) return;

var lang = match[1];
var labelMap = {
'python': 'Python',
'py': 'Python',
'javascript': 'JavaScript',
'js': 'JavaScript',
'typescript': 'TypeScript',
'ts': 'TypeScript',
'bash': 'Bash',
'sh': 'Shell',
'shell': 'Shell',
'json': 'JSON',
'yaml': 'YAML',
'yml': 'YAML',
'html': 'HTML',
'css': 'CSS',
'go': 'Go',
'rust': 'Rust',
'java': 'Java',
'ruby': 'Ruby',
'rb': 'Ruby',
'sql': 'SQL',
'dockerfile': 'Dockerfile',
'docker': 'Dockerfile',
'toml': 'TOML',
'xml': 'XML',
'c': 'C',
'cpp': 'C++',
'csharp': 'C#',
'cs': 'C#',
'php': 'PHP',
'swift': 'Swift',
'kotlin': 'Kotlin',
'scala': 'Scala',
'r': 'R',
'lua': 'Lua',
'perl': 'Perl',
'makefile': 'Makefile',
'graphql': 'GraphQL',
'markdown': 'Markdown',
'md': 'Markdown',
'plaintext': 'Text',
'text': 'Text',
'ini': 'INI',
'env': '.env',
};

var displayName = labelMap[lang.toLowerCase()] || lang;

var pre = code.parentElement;
if (!pre || pre.tagName !== 'PRE') return;

var label = document.createElement('span');
label.className = 'code-label';
label.textContent = displayName;

var wrapper = pre.closest('.code-block-wrapper');
if (wrapper) {
wrapper.insertBefore(label, wrapper.firstChild);
} else {
pre.style.position = 'relative';
label.style.position = 'absolute';
label.style.top = '0.5rem';
label.style.right = '0.5rem';
pre.insertBefore(label, pre.firstChild);
}
});
})();
41 changes: 41 additions & 0 deletions docs/assets/copy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
(function() {
document.querySelectorAll('pre').forEach(function(pre) {
var btn = document.createElement('button');
btn.className = 'copy-btn';
btn.textContent = 'Copy';
btn.addEventListener('click', function() {
var code = pre.querySelector('code');
var text = code ? code.textContent : pre.textContent;
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(text).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 2000);
}).catch(function() {
fallbackCopy(text, btn);
});
} else {
fallbackCopy(text, btn);
}
});
pre.style.position = 'relative';
pre.appendChild(btn);
});

function fallbackCopy(text, btn) {
var textarea = document.createElement('textarea');
textarea.value = text;
textarea.style.position = 'fixed';
textarea.style.opacity = '0';
document.body.appendChild(textarea);
textarea.select();
try {
document.execCommand('copy');
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 2000);
} catch (e) {
btn.textContent = 'Failed';
setTimeout(function() { btn.textContent = 'Copy'; }, 2000);
}
document.body.removeChild(textarea);
}
})();
38 changes: 38 additions & 0 deletions docs/assets/github.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
(function() {
var link = document.getElementById('github-link');
if (!link) return;

var repoUrl = link.getAttribute('data-repo-url');
if (!repoUrl) return;

// Extract owner/repo from GitHub URL
var match = repoUrl.match(/github\.com[/:]([^/]+)\/([^/.]+)/);
if (!match) return;

var owner = match[1];
var repo = match[2];

var starsEl = document.getElementById('github-stars');
if (!starsEl) return;

fetch('https://api.github.com/repos/' + owner + '/' + repo)
.then(function(response) {
if (!response.ok) return null;
return response.json();
})
.then(function(data) {
if (!data || typeof data.stargazers_count === 'undefined') return;
var count = data.stargazers_count;
var display;
if (count >= 1000) {
display = (count / 1000).toFixed(1).replace(/\.0$/, '') + 'k';
} else {
display = count.toString();
}
starsEl.textContent = '★ ' + display;
starsEl.title = count.toLocaleString() + ' stars';
})
.catch(function() {
// Silently fail - star count is a nice-to-have
});
})();
49 changes: 49 additions & 0 deletions docs/assets/scrollspy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
(function() {
var tocLinks = document.querySelectorAll('.toc-container a');
if (tocLinks.length === 0) return;

var headings = [];
tocLinks.forEach(function(link) {
var href = link.getAttribute('href');
if (href && href.startsWith('#')) {
var target = document.getElementById(href.substring(1));
if (target) {
headings.push({ element: target, link: link });
}
}
});

if (headings.length === 0) return;

function updateActive() {
var scrollPos = window.scrollY + 100;
var current = null;

for (var i = 0; i < headings.length; i++) {
if (headings[i].element.offsetTop <= scrollPos) {
current = headings[i];
}
}

tocLinks.forEach(function(link) {
link.classList.remove('active');
});

if (current) {
current.link.classList.add('active');
}
}

var ticking = false;
window.addEventListener('scroll', function() {
if (!ticking) {
window.requestAnimationFrame(function() {
updateActive();
ticking = false;
});
ticking = true;
}
});

updateActive();
})();
125 changes: 125 additions & 0 deletions docs/assets/search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
(function() {
// Create modal HTML
var overlay = document.createElement('div');
overlay.className = 'search-modal-overlay';
overlay.innerHTML = '<div class="search-modal">' +
'<input type="text" class="search-modal-input" placeholder="Search documentation..." autofocus />' +
'<div class="search-modal-results"></div>' +
'<div class="search-modal-footer"><kbd>Esc</kbd> to close &nbsp; <kbd>&#x2191;&#x2193;</kbd> to navigate &nbsp; <kbd>Enter</kbd> to open</div>' +
'</div>';
document.body.appendChild(overlay);

var input = overlay.querySelector('.search-modal-input');
var results = overlay.querySelector('.search-modal-results');
var index = [];
var selectedIdx = -1;

// Load index
fetch('search-index.json').then(function(r) { return r.json(); })
.then(function(data) { index = data; }).catch(function() {});

// Open/close
function openModal() {
overlay.classList.add('active');
input.value = '';
results.innerHTML = '';
selectedIdx = -1;
setTimeout(function() { input.focus(); }, 50);
}

function closeModal() {
overlay.classList.remove('active');
}

// Keyboard shortcut
document.addEventListener('keydown', function(e) {
if ((e.metaKey || e.ctrlKey) && e.key === 'k') {
e.preventDefault();
openModal();
}
if (e.key === 'Escape') closeModal();
});

// Click overlay to close
overlay.addEventListener('click', function(e) {
if (e.target === overlay) closeModal();
});

// Search trigger button in sidebar
var sidebarSearch = document.getElementById('search-input');
if (sidebarSearch) {
sidebarSearch.addEventListener('focus', function(e) {
e.preventDefault();
this.blur();
openModal();
});
}

// Search trigger button in top bar
var topBarSearch = document.getElementById('search-trigger');
if (topBarSearch) {
topBarSearch.addEventListener('click', function(e) {
e.preventDefault();
openModal();
});
}

// Search logic
input.addEventListener('input', function() {
var q = this.value.toLowerCase().trim();
results.innerHTML = '';
selectedIdx = -1;
if (!q) return;

var matches = index.filter(function(item) {
return item.title.toLowerCase().includes(q) || item.content.toLowerCase().includes(q);
}).slice(0, 10);

matches.forEach(function(m, i) {
var div = document.createElement('a');
div.href = m.slug + '.html';
div.className = 'search-result-item';

var title = document.createElement('span');
title.className = 'search-result-title';
title.textContent = m.title;
div.appendChild(title);

// Content preview
var preview = document.createElement('span');
preview.className = 'search-result-preview';
var contentIdx = m.content.toLowerCase().indexOf(q);
if (contentIdx >= 0) {
var start = Math.max(0, contentIdx - 40);
var end = Math.min(m.content.length, contentIdx + q.length + 60);
var snippet = (start > 0 ? '...' : '') + m.content.substring(start, end) + (end < m.content.length ? '...' : '');
preview.textContent = snippet;
}
div.appendChild(preview);
results.appendChild(div);
});

if (matches.length === 0) {
var empty = document.createElement('div');
empty.className = 'search-no-results';
empty.textContent = 'No results found';
results.appendChild(empty);
}
});

// Keyboard navigation
input.addEventListener('keydown', function(e) {
var items = results.querySelectorAll('.search-result-item');
if (e.key === 'ArrowDown') {
e.preventDefault();
selectedIdx = Math.min(selectedIdx + 1, items.length - 1);
items.forEach(function(item, i) { item.classList.toggle('selected', i === selectedIdx); });
} else if (e.key === 'ArrowUp') {
e.preventDefault();
selectedIdx = Math.max(selectedIdx - 1, 0);
items.forEach(function(item, i) { item.classList.toggle('selected', i === selectedIdx); });
} else if (e.key === 'Enter' && selectedIdx >= 0 && items[selectedIdx]) {
window.location.href = items[selectedIdx].href;
}
});
})();
Loading