Skip to content

fix: address GLM-5.1 code review findings - #22

Merged
pavelanni merged 2 commits into
mainfrom
fix/oci-review-findings
Apr 14, 2026
Merged

pavelanni merged 2 commits into
mainfrom
fix/oci-review-findings

Conversation

@pavelanni

@pavelanni pavelanni commented Apr 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Address findings from an independent code review using GLM-5.1 (ZhipuAI) on PR #21.

Security fixes

  • Apply permission mask on tar extraction (0o644 files, 0o755 dirs) — prevents malicious archives setting 0777
  • Add 4 security tests: path traversal, absolute paths, symlink escape, permission mask
  • Inspect: handle image-mode artifacts by extracting skill.yaml from content layer

Bug fixes

UX improvements

Style

Test plan

  • make test — 22 tests, all passing (4 new security tests)
  • make lint — zero errors

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added HTML presentation deck for skill distribution information.
    • Added Kubernetes Pod manifest examples for agent deployment scenarios.
  • Bug Fixes

    • Fixed file permission masking during artifact extraction.
    • Improved skill card parsing from archive payloads.
  • Improvements

    • Enhanced signature verification warnings when keys are missing.
    • Better credential resolution logging and fallback messaging.
    • Simplified skill metadata validation checks.

Security fixes:
- Apply permission mask on tar extraction (0644 files, 0755 dirs)
- Add 4 security tests: path traversal, absolute paths, permission mask
- Inspect: handle image-mode artifacts by extracting skill.yaml from
  content layer
- Pull: accept both artifact and image-mode layer media types

Bug fixes:
- Fix regex recompilation: use strings.Contains for consecutive hyphen
  check instead of regexp.MustCompile on every Validate call
- Fix skipNames matching: use relative path from skill dir root instead
  of bare filename to avoid false matches on legitimate subdirs
- Fix skillConfig duplication: use map[string]any instead of a separate
  struct that mirrors SkillCard fields
- Fix file handle: close immediately after io.Copy, not deferred
- Fix string concat: use filepath.Join for OCI layout path

UX improvements:
- Log warnings for malformed SKILL.md and skill.yaml during discovery
- Print stderr warning when --verify is used without --key
- Log debug message when Docker/Podman credentials not found

Style:
- Standardize octal literals to 0o prefix (Go 1.13+)

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
@pavelanni
pavelanni marked this pull request as ready for review April 14, 2026 16:16
@pavelanni

Copy link
Copy Markdown
Collaborator Author

@coderabbitai check

@coderabbitai

coderabbitai Bot commented Apr 14, 2026

Copy link
Copy Markdown

@pavelanni Sure! I'll kick off a review of PR #22 right away.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@pavelanni has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 22 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 3 minutes and 22 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0c640f21-4220-443d-b2d7-764827720cec

📥 Commits

Reviewing files that changed from the base of the PR and between 1d859c5 and 28d3765.

📒 Files selected for processing (5)
  • examples/openshift/agent-pod-image.yaml
  • examples/openshift/agent-pod-pull.yaml
  • internal/oci/extract_test.go
  • internal/oci/inspect.go
  • internal/oci/pull.go
📝 Walkthrough

Walkthrough

This pull request adds a presentation deck and Kubernetes examples, updates core OCI operations (inspection, packing, pulling) with improved fallback logic and permission handling, refines skill verification modes, and enhances error reporting with structured logging across multiple packages.

Changes

Cohort / File(s) Summary
Documentation & Examples
docs/slides/oci-skill-distribution-deck.html, examples/openshift/agent-pod-image.yaml, examples/openshift/agent-pod-pull.yaml
New 13-slide dark-mode HTML presentation deck with CSS animations and JavaScript navigation; two new Kubernetes Pod manifests demonstrating image-backed volumes and init containers for skill management.
OCI Inspection & Extraction
internal/oci/inspect.go, internal/oci/extract_test.go
Refactored Inspect to immediately fetch and parse SkillCard layers; added fallback to extract skill.yaml from tar+gzip content layers; new comprehensive unit tests for tar extraction with path traversal and permission validation.
OCI Packing & Path Handling
internal/oci/pack.go, internal/oci/pack_test.go, internal/cmd/skill_pack.go
Removed skillConfig struct, replaced with generic map config including explicit schema version and conditional fields; refined skip logic to exclude only top-level oci-layout directory; updated path construction to use filepath.Join; normalized file permission literals.
Security & Permissions
internal/oci/pull.go
Masked filesystem permission bits during tar extraction using 0o755 for directories and 0o644 for files to prevent unintended execute/write permissions.
Verification & Logging
internal/cmd/skill_pull.go, internal/oci/push.go, pkg/skills/loader.go
Changed default verification mode to ModeEnforce with fallback warning when --key is absent; added debug logging for credential resolution in push operations; added structured logging for skill.yaml and frontmatter parse failures.
Validation Optimization
pkg/skills/card/parse.go
Replaced regex-based consecutive-hyphen detection with strings.Contains substring check for improved efficiency.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: address GLM-5.1 code review findings' accurately describes the overall intent of the changeset, which consists of multiple security fixes, bug fixes, and UX improvements addressing code review findings from GLM-5.1.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/oci-review-findings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 8

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/oci/pull.go (1)

164-166: ⚠️ Potential issue | 🟡 Minor

Potential path prefix false-match in symlink escape check.

Line 164 uses filepath.Clean(resolvedDest) without a trailing separator, while the similar check at line 144 uses destPrefix which includes the separator. This inconsistency could cause false negatives if a sibling directory shares a common prefix (e.g., resolvedDest="/tmp/skills" would incorrectly allow resolvedParent="/tmp/skillsmalicious").

Suggested fix
-			if !strings.HasPrefix(resolvedParent, filepath.Clean(resolvedDest)) {
+			if !strings.HasPrefix(resolvedParent+string(os.PathSeparator), destPrefix) {

Or alternatively, reuse destPrefix which is already defined at line 117:

-			if !strings.HasPrefix(resolvedParent, filepath.Clean(resolvedDest)) {
+			if !strings.HasPrefix(resolvedParent, destPrefix) && resolvedParent != filepath.Clean(resolvedDest) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/oci/pull.go` around lines 164 - 166, The symlink escape check uses
filepath.Clean(resolvedDest) which can false-match sibling paths; change the
comparison to use the already-prepared destPrefix (or otherwise append the OS
path separator to resolvedDest) so you check strings.HasPrefix(resolvedParent,
destPrefix) instead of strings.HasPrefix(resolvedParent,
filepath.Clean(resolvedDest)); update the condition that returns the fmt.Errorf
referencing targetPath to use this corrected prefix check.
🧹 Nitpick comments (1)
internal/oci/extract_test.go (1)

68-104: Consider strengthening the absolute path test assertion.

The test checks /etc/passwd.test (line 99) but the archive entry is /etc/passwd. The current test passes because Go's filepath.Join neutralizes absolute paths (joining dest + /etc/passwd yields dest/etc/passwd), making the file safely land inside dest. The comment acknowledges both outcomes are acceptable, but a more precise assertion would verify the file exists at the expected safe location.

Suggested improvement
 	err := extractTarGzip(gzBuf.Bytes(), dest)
 	if err == nil {
-		// Check that the file wasn't written outside dest
-		if _, statErr := os.Stat("/etc/passwd.test"); statErr == nil {
-			t.Fatal("file written outside destination")
+		// Verify file was safely written inside dest
+		safePath := filepath.Join(dest, "etc", "passwd")
+		if _, statErr := os.Stat(safePath); statErr != nil {
+			t.Logf("absolute path neutralized, file at: %s", safePath)
 		}
 	}
-	// Either an error or the file is safely inside dest — both acceptable
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/oci/extract_test.go` around lines 68 - 104, Update
TestExtractRejectsAbsolutePath to assert the safe, expected path inside dest
instead of checking /etc/passwd.test: after calling
extractTarGzip(gzBuf.Bytes(), dest) verify that either an error was returned or
the file was created at filepath.Join(dest, "etc", "passwd") (or
filepath.Join(dest, "etc/passwd") depending on how you normalize the header
Name) and ensure no file was written outside dest; use the test helper functions
already in scope (TestExtractRejectsAbsolutePath and extractTarGzip) to locate
the created file and fail if the file is missing from the intended safe
destination.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/slides/oci-skill-distribution-deck.html`:
- Around line 785-810: The initContainer example claims signature verification
but only uses --verify and an unpinned image; update the init container named
skill-puller to use a pinned docsclaw image (replace docsclaw:latest with a
specific tag) and include the verification key flag in the command (add --key
<path/to/public/key> alongside --verify and keep -o /skills and the
quay.io/docsclaw/skill-resume-screener:1.0.0 reference) so the docsclaw skill
pull invocation actually performs cosign verification.
- Around line 764-770: The rendered YAML splits the image reference into two
spans with a <br>, causing copied values like the "reference" for the image to
be broken; locate the YAML block that renders the image reference (the <span
class="key">reference:</span> followed by two separate <span class="val">
entries showing "quay.io/docsclaw/" and "skill-resume-screener:1.0.0") and
replace them with a single contiguous value span containing the full image
string (e.g., "quay.io/docsclaw/skill-resume-screener:1.0.0") and remove the
intervening <br> so the rendered line is one continuous, copy-pasteable string;
apply the same consolidation to the other identical occurrence later in the
document.
- Around line 759-761: Replace the misleading list item text "No emptyDir, no
node storage consumed" with wording that clarifies the image is cached and does
consume node image store space but avoids an extra writable volume; locate the
<li> whose inner text is exactly "No emptyDir, no node storage consumed" and
update it to something like "Avoids extra writable volume (no emptyDir) — image
is cached in the node's container image store and does consume node storage."
Ensure the replacement keeps the same styling (img and span) and only changes
the span text.
- Around line 35-55: The CSS currently forces fixed viewport heights and hides
overflow on body and .slide causing clipped content on small screens; update the
rules for body and .slide (and if needed .deck) to use min-height: 100vh instead
of height: 100vh and replace overflow: hidden with overflow-y: auto (or
overflow: auto) so slides can grow beyond the viewport and scroll vertically at
responsive breakpoints; ensure .slide still uses display:flex and its padding
stays intact so layout doesn’t shift.
- Around line 428-433: The notes panel is only moved offscreen and remains
tabbable and in the accessibility tree; update the implementation so the panel
is truly hidden when not visible: modify the HTML to toggle hidden and
aria-hidden on the .notes-panel element (set hidden/aria-hidden=true when not
visible, remove when visible) and adjust the CSS for
.notes-panel/.notes-panel.visible to ensure it is non-interactive when hidden
(e.g., remove pointer events/visibility or use display:none via the hidden
attribute). In the global keydown handler and touchend handler, early-return if
the event target is inside .notes-panel or is an interactive element (links,
buttons, inputs, textareas, selects, [tabindex] elements) so shortcuts and
gestures do not act when focus is within the notes panel, and add the missing
e.preventDefault() call in the ArrowLeft branch of the keydown handler to
prevent page scrolling/side effects.

In `@examples/openshift/agent-pod-image.yaml`:
- Around line 5-17: Add Pod security hardening to the docsclaw container spec:
set securityContext.runAsNonRoot: true (and optionally runAsUser if known) and
set securityContext.allowPrivilegeEscalation: false for the container named
"docsclaw", and ensure the pod-level securityContext doesn't conflict; update
the spec under the "containers" entry (container name docsclaw) to include these
securityContext fields so the example meets the Restricted Pod Security
Standard.

In `@examples/openshift/agent-pod-pull.yaml`:
- Around line 6-25: The manifest's initContainers (name: skill-puller) and
containers (name: docsclaw) lack securityContext; add a securityContext block
for each container that sets runAsNonRoot: true and
securityContext.capabilities.drop: ["ALL"] or allowPrivilegeEscalation: false
(or both) as required by your policy; locate the init container "skill-puller"
and main container "docsclaw" and add a securityContext section under each
container spec to enforce non-root execution and disable privilege escalation.

In `@internal/oci/inspect.go`:
- Around line 109-110: The current tar entry check in Inspect (the
header.Typeflag == tar.TypeReg condition) matches any trailing "/skill.yaml",
which can return nested copies; change the filename match to only accept either
exactly "skill.yaml" or a single-leading-directory form "<dir>/skill.yaml"
(i.e., ensure header.Name has no additional '/' characters besides an optional
single leading one) so nested paths like "examples/foo/skill.yaml" are ignored.
Update the matching logic in Inspect/inspect.go (where header.Name is checked)
to validate there is at most one '/' and that the suffix equals "skill.yaml".
Add a regression test that builds a tar with both "skill.yaml" at the root and
another "examples/skill.yaml" (or deeper nested) and assert Inspect returns the
root or single-dir canonical card only.

---

Outside diff comments:
In `@internal/oci/pull.go`:
- Around line 164-166: The symlink escape check uses
filepath.Clean(resolvedDest) which can false-match sibling paths; change the
comparison to use the already-prepared destPrefix (or otherwise append the OS
path separator to resolvedDest) so you check strings.HasPrefix(resolvedParent,
destPrefix) instead of strings.HasPrefix(resolvedParent,
filepath.Clean(resolvedDest)); update the condition that returns the fmt.Errorf
referencing targetPath to use this corrected prefix check.

---

Nitpick comments:
In `@internal/oci/extract_test.go`:
- Around line 68-104: Update TestExtractRejectsAbsolutePath to assert the safe,
expected path inside dest instead of checking /etc/passwd.test: after calling
extractTarGzip(gzBuf.Bytes(), dest) verify that either an error was returned or
the file was created at filepath.Join(dest, "etc", "passwd") (or
filepath.Join(dest, "etc/passwd") depending on how you normalize the header
Name) and ensure no file was written outside dest; use the test helper functions
already in scope (TestExtractRejectsAbsolutePath and extractTarGzip) to locate
the created file and fail if the file is missing from the intended safe
destination.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6e2717dc-d05d-4a6f-860d-7e96a832efe7

📥 Commits

Reviewing files that changed from the base of the PR and between ea1de23 and 1d859c5.

📒 Files selected for processing (13)
  • docs/slides/oci-skill-distribution-deck.html
  • examples/openshift/agent-pod-image.yaml
  • examples/openshift/agent-pod-pull.yaml
  • internal/cmd/skill_pack.go
  • internal/cmd/skill_pull.go
  • internal/oci/extract_test.go
  • internal/oci/inspect.go
  • internal/oci/pack.go
  • internal/oci/pack_test.go
  • internal/oci/pull.go
  • internal/oci/push.go
  • pkg/skills/card/parse.go
  • pkg/skills/loader.go

Comment on lines +35 to +55
body {
font-family: var(--font-body);
background: var(--bg-primary);
color: var(--text-primary);
overflow: hidden;
height: 100vh;
width: 100vw;
}

/* === SLIDE CONTAINER === */
.deck { position: relative; width: 100%; height: 100vh; }
.slide {
display: none;
flex-direction: column;
justify-content: center;
width: 100%;
height: 100vh;
padding: var(--rh-space-4xl, 80px) var(--rh-space-3xl, 64px);
position: relative;
overflow: hidden;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Check if file exists and get basic info
ls -la docs/slides/oci-skill-distribution-deck.html
wc -l docs/slides/oci-skill-distribution-deck.html

Repository: redhat-et/docsclaw

Length of output: 205


🏁 Script executed:

# Read lines 35-55 to verify the body and .slide styles
sed -n '35,55p' docs/slides/oci-skill-distribution-deck.html

Repository: redhat-et/docsclaw

Length of output: 607


🏁 Script executed:

# Read lines 475-485 to check the responsive breakpoint
sed -n '475,485p' docs/slides/oci-skill-distribution-deck.html

Repository: redhat-et/docsclaw

Length of output: 530


Enable vertical scrolling when slides exceed viewport height at responsive breakpoints.

Lines 35-54 use height: 100vh and overflow: hidden on both body and .slide. The responsive breakpoint at line 475 collapses multi-column layouts to single-column without removing the fixed-height constraint. On mobile and smaller windows, content exceeds the viewport with no way to scroll to hidden portions. Use min-height and enable overflow-y: auto to allow content expansion and scrolling on affected viewports.

Suggested fix
     body {
       font-family: var(--font-body);
       background: var(--bg-primary);
       color: var(--text-primary);
-      overflow: hidden;
-      height: 100vh;
+      overflow-x: hidden;
+      min-height: 100dvh;
       width: 100vw;
     }
...
     .slide {
       display: none;
       flex-direction: column;
       justify-content: center;
       width: 100%;
-      height: 100vh;
+      min-height: 100dvh;
       padding: var(--rh-space-4xl, 80px) var(--rh-space-3xl, 64px);
       position: relative;
-      overflow: hidden;
+      overflow-y: auto;
     }
...
     `@media` (max-width: 768px) {
       .slide { padding: var(--rh-space-xl, 32px) var(--rh-space-lg, 24px); justify-content: flex-start; }
       h1 { font-size: 2rem; }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
body {
font-family: var(--font-body);
background: var(--bg-primary);
color: var(--text-primary);
overflow: hidden;
height: 100vh;
width: 100vw;
}
/* === SLIDE CONTAINER === */
.deck { position: relative; width: 100%; height: 100vh; }
.slide {
display: none;
flex-direction: column;
justify-content: center;
width: 100%;
height: 100vh;
padding: var(--rh-space-4xl, 80px) var(--rh-space-3xl, 64px);
position: relative;
overflow: hidden;
}
body {
font-family: var(--font-body);
background: var(--bg-primary);
color: var(--text-primary);
overflow-x: hidden;
min-height: 100dvh;
width: 100vw;
}
/* === SLIDE CONTAINER === */
.deck { position: relative; width: 100%; height: 100vh; }
.slide {
display: none;
flex-direction: column;
justify-content: center;
width: 100%;
min-height: 100dvh;
padding: var(--rh-space-4xl, 80px) var(--rh-space-3xl, 64px);
position: relative;
overflow-y: auto;
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/slides/oci-skill-distribution-deck.html` around lines 35 - 55, The CSS
currently forces fixed viewport heights and hides overflow on body and .slide
causing clipped content on small screens; update the rules for body and .slide
(and if needed .deck) to use min-height: 100vh instead of height: 100vh and
replace overflow: hidden with overflow-y: auto (or overflow: auto) so slides can
grow beyond the viewport and scroll vertically at responsive breakpoints; ensure
.slide still uses display:flex and its padding stays intact so layout doesn’t
shift.

Comment on lines +428 to +433
transform: translateX(100%);
transition: transform 0.3s ease;
z-index: 200;
font-family: var(--font-body);
}
.notes-panel.visible { transform: translateX(0); }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's check if the file exists and get its line count
wc -l docs/slides/oci-skill-distribution-deck.html

Repository: redhat-et/docsclaw

Length of output: 110


🏁 Script executed:

# Read the CSS section around lines 428-433
sed -n '425,435p' docs/slides/oci-skill-distribution-deck.html

Repository: redhat-et/docsclaw

Length of output: 389


🏁 Script executed:

# Read the HTML section around lines 898-898 and 935-965
sed -n '895,905p' docs/slides/oci-skill-distribution-deck.html

Repository: redhat-et/docsclaw

Length of output: 397


🏁 Script executed:

# Read the event handler section around lines 935-965
sed -n '930,970p' docs/slides/oci-skill-distribution-deck.html

Repository: redhat-et/docsclaw

Length of output: 1576


Hide speaker notes semantically and exempt them from deck-wide shortcuts.

The notes panel is moved offscreen with transform: translateX(100%) but the HTML element remains in the DOM without hidden or aria-hidden attributes. This leaves off-screen links tabbable and in the accessibility tree. The keydown handler consumes Space/Arrow keys without checking the event source, so gestures from focused elements within .notes-panel trigger deck navigation. The touchend handler similarly lacks filtering for the notes panel. Update the CSS to hide the panel when not visible, set hidden and aria-hidden attributes in the HTML, and filter both keydown and touchend handlers to ignore events from .notes-panel and interactive elements within it. Also add missing e.preventDefault() for the ArrowLeft handler.

Suggested fix
+    .notes-panel[hidden] { display: none; }
     .notes-panel.visible { transform: translateX(0); }
-  <div class="notes-panel"></div>
+  <div class="notes-panel" hidden aria-hidden="true"></div>
      document.addEventListener('keydown', (e) => {
+        if (e.target.closest('.notes-panel, a, button, input, textarea, select')) return;
         if (e.key === 'ArrowRight' || e.key === ' ') { e.preventDefault(); next(); }
-        if (e.key === 'ArrowLeft') { prev(); }
+        if (e.key === 'ArrowLeft') { e.preventDefault(); prev(); }
         if (e.key === 'n' || e.key === 'N') {
           notesVisible = !notesVisible;
-          if (notesPanel) notesPanel.classList.toggle('visible', notesVisible);
+          if (notesPanel) {
+            notesPanel.classList.toggle('visible', notesVisible);
+            notesPanel.hidden = !notesVisible;
+            notesPanel.setAttribute('aria-hidden', String(!notesVisible));
+          }
           show(idx);
         }
       });
       document.addEventListener('touchend', (e) => {
+        if (e.target.closest('.notes-panel')) return;
         const diff = e.changedTouches[0].clientX - touchStartX;
         if (Math.abs(diff) > 50) { diff < 0 ? next() : prev(); }
       });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/slides/oci-skill-distribution-deck.html` around lines 428 - 433, The
notes panel is only moved offscreen and remains tabbable and in the
accessibility tree; update the implementation so the panel is truly hidden when
not visible: modify the HTML to toggle hidden and aria-hidden on the
.notes-panel element (set hidden/aria-hidden=true when not visible, remove when
visible) and adjust the CSS for .notes-panel/.notes-panel.visible to ensure it
is non-interactive when hidden (e.g., remove pointer events/visibility or use
display:none via the hidden attribute). In the global keydown handler and
touchend handler, early-return if the event target is inside .notes-panel or is
an interactive element (links, buttons, inputs, textareas, selects, [tabindex]
elements) so shortcuts and gestures do not act when focus is within the notes
panel, and add the missing e.preventDefault() call in the ArrowLeft branch of
the keydown handler to prevent page scrolling/side effects.

Comment on lines +759 to +761
<li><img class="rh-icon small accent" src="https://cdn.jsdelivr.net/npm/@rhds/[email protected]/standard/container-image.svg" alt=""> <span>Kubelet pulls and caches skill images</span></li>
<li><img class="rh-icon small accent" src="https://cdn.jsdelivr.net/npm/@rhds/[email protected]/standard/padlock-locked.svg" alt=""> <span>Read-only mount &mdash; immutable at runtime</span></li>
<li><img class="rh-icon small accent" src="https://cdn.jsdelivr.net/npm/@rhds/[email protected]/standard/scalable.svg" alt=""> <span>No emptyDir, no node storage consumed</span></li>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cat -n docs/slides/oci-skill-distribution-deck.html | sed -n '750,765p'

Repository: redhat-et/docsclaw

Length of output: 2205


Clarify storage consumption claim on line 761.

Line 761 contradicts the explanation in line 752's notes: the image is indeed cached in the node's container image store. The current wording misleads about node storage consumption. The actual benefit is avoiding an extra writable skill volume (emptyDir), not zero storage use.

Suggested fix
-            <li><img class="rh-icon small accent" src="https://cdn.jsdelivr.net/npm/@rhds/[email protected]/standard/scalable.svg" alt=""> <span>No emptyDir, no node storage consumed</span></li>
+            <li><img class="rh-icon small accent" src="https://cdn.jsdelivr.net/npm/@rhds/[email protected]/standard/scalable.svg" alt=""> <span>No emptyDir and no extra writable skill volume; layers are still cached in the node image store</span></li>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<li><img class="rh-icon small accent" src="https://cdn.jsdelivr.net/npm/@rhds/[email protected]/standard/container-image.svg" alt=""> <span>Kubelet pulls and caches skill images</span></li>
<li><img class="rh-icon small accent" src="https://cdn.jsdelivr.net/npm/@rhds/[email protected]/standard/padlock-locked.svg" alt=""> <span>Read-only mount &mdash; immutable at runtime</span></li>
<li><img class="rh-icon small accent" src="https://cdn.jsdelivr.net/npm/@rhds/[email protected]/standard/scalable.svg" alt=""> <span>No emptyDir, no node storage consumed</span></li>
<li><img class="rh-icon small accent" src="https://cdn.jsdelivr.net/npm/@rhds/[email protected]/standard/container-image.svg" alt=""> <span>Kubelet pulls and caches skill images</span></li>
<li><img class="rh-icon small accent" src="https://cdn.jsdelivr.net/npm/@rhds/[email protected]/standard/padlock-locked.svg" alt=""> <span>Read-only mount &mdash; immutable at runtime</span></li>
<li><img class="rh-icon small accent" src="https://cdn.jsdelivr.net/npm/@rhds/[email protected]/standard/scalable.svg" alt=""> <span>No emptyDir and no extra writable skill volume; layers are still cached in the node image store</span></li>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/slides/oci-skill-distribution-deck.html` around lines 759 - 761, Replace
the misleading list item text "No emptyDir, no node storage consumed" with
wording that clarifies the image is cached and does consume node image store
space but avoids an extra writable volume; locate the <li> whose inner text is
exactly "No emptyDir, no node storage consumed" and update it to something like
"Avoids extra writable volume (no emptyDir) — image is cached in the node's
container image store and does consume node storage." Ensure the replacement
keeps the same styling (img and span) and only changes the span text.

Comment on lines +764 to +770
<div class="yaml-block">
<span class="key">volumes:</span><br>
&ensp;&ensp;- <span class="key">name:</span> <span class="val">skill-resume-screener</span><br>
&ensp;&ensp;&ensp;&ensp;<span class="key">image:</span><br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;<span class="key">reference:</span> <span class="val" style="color: var(--accent-light);">quay.io/docsclaw/</span><br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;<span class="val" style="color: var(--accent-light);">skill-resume-screener:1.0.0</span><br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;<span class="key">pullPolicy:</span> <span class="val">IfNotPresent</span><br>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, check if the file exists and get its line count
wc -l docs/slides/oci-skill-distribution-deck.html

Repository: redhat-et/docsclaw

Length of output: 110


🏁 Script executed:

# Read the specified lines to verify the issue
sed -n '764,770p' docs/slides/oci-skill-distribution-deck.html

Repository: redhat-et/docsclaw

Length of output: 759


🏁 Script executed:

# Also check lines 809-810 mentioned as having the same issue
sed -n '809,810p' docs/slides/oci-skill-distribution-deck.html

Repository: redhat-et/docsclaw

Length of output: 339


🏁 Script executed:

# Get a bit more context around line 809 to see the full structure
sed -n '805,815p' docs/slides/oci-skill-distribution-deck.html

Repository: redhat-et/docsclaw

Length of output: 794


Keep the skill image references copy-pasteable.

Lines 768-769 and 809-810 split the image reference quay.io/docsclaw/skill-resume-screener:1.0.0 across multiple rendered lines with <br> tags. When users copy this YAML from the rendered HTML, they get broken values with line breaks instead of a continuous string. Consolidate each full reference on a single rendered line to make the documentation code examples directly usable.

Suggested fix
-          &ensp;&ensp;&ensp;&ensp;&ensp;&ensp;<span class="key">reference:</span> <span class="val" style="color: var(--accent-light);">quay.io/docsclaw/</span><br>
-          &ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;<span class="val" style="color: var(--accent-light);">skill-resume-screener:1.0.0</span><br>
+          &ensp;&ensp;&ensp;&ensp;&ensp;&ensp;<span class="key">reference:</span> <span class="val" style="color: var(--accent-light);">quay.io/docsclaw/skill-resume-screener:1.0.0</span><br>
...
-          &ensp;&ensp;&ensp;&ensp;&ensp;&ensp;- <span class="val" style="color: var(--accent-light);">quay.io/docsclaw/</span><br>
-          &ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;<span class="val" style="color: var(--accent-light);">skill-resume-screener:1.0.0</span>
+          &ensp;&ensp;&ensp;&ensp;&ensp;&ensp;- <span class="val" style="color: var(--accent-light);">quay.io/docsclaw/skill-resume-screener:1.0.0</span>

Also applies to: 809-810

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/slides/oci-skill-distribution-deck.html` around lines 764 - 770, The
rendered YAML splits the image reference into two spans with a <br>, causing
copied values like the "reference" for the image to be broken; locate the YAML
block that renders the image reference (the <span class="key">reference:</span>
followed by two separate <span class="val"> entries showing "quay.io/docsclaw/"
and "skill-resume-screener:1.0.0") and replace them with a single contiguous
value span containing the full image string (e.g.,
"quay.io/docsclaw/skill-resume-screener:1.0.0") and remove the intervening <br>
so the rendered line is one continuous, copy-pasteable string; apply the same
consolidation to the other identical occurrence later in the document.

Comment on lines +785 to +810
<div class="slide" data-notes="For older clusters, the init container approach uses docsclaw itself to pull skills from the registry before the main container starts. Use a PVC (not emptyDir) to persist the skill cache across pod restarts and avoid filling node ephemeral storage.<br><br>Signature verification happens at pull time: --verify + --key flags enforce cosign verification before extracting the skill.">
<div class="slide-label animate-in"><img class="rh-icon small" src="https://cdn.jsdelivr.net/npm/@rhds/[email protected]/standard/server-stack.svg" alt=""> Universal Fallback</div>
<h2 class="animate-in">Init Container for <span class="accent">Older Clusters</span></h2>
<div class="two-col animate-in">
<div>
<p class="body-text">For Kubernetes &lt; 1.33 or OpenShift &lt; 4.20, use DocsClaw itself as an init container to pull skills before the agent starts.</p>
<ul class="feature-list" style="margin-top: 24px;">
<li><img class="rh-icon small" src="https://cdn.jsdelivr.net/npm/@rhds/[email protected]/standard/download.svg" alt=""> <span>Pull at pod startup, verify signatures</span></li>
<li><img class="rh-icon small" src="https://cdn.jsdelivr.net/npm/@rhds/[email protected]/standard/storage.svg" alt=""> <span>Cache on a PVC across restarts</span></li>
<li><img class="rh-icon small" src="https://cdn.jsdelivr.net/npm/@rhds/[email protected]/standard/share.svg" alt=""> <span>Share the volume with the main container</span></li>
</ul>
</div>
<div class="yaml-block">
<span class="key">initContainers:</span><br>
&ensp;&ensp;- <span class="key">name:</span> <span class="val">skill-puller</span><br>
&ensp;&ensp;&ensp;&ensp;<span class="key">image:</span> <span class="val">ghcr.io/redhat-et/</span><br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;<span class="val">docsclaw:latest</span><br>
&ensp;&ensp;&ensp;&ensp;<span class="key">command:</span><br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;- <span class="val">"docsclaw"</span><br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;- <span class="val">"skill"</span><br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;- <span class="val">"pull"</span><br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;- <span class="val">"--verify"</span><br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;- <span class="val">"-o"</span><br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;- <span class="val">"/skills"</span><br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;- <span class="val" style="color: var(--accent-light);">quay.io/docsclaw/</span><br>
&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;<span class="val" style="color: var(--accent-light);">skill-resume-screener:1.0.0</span>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Make the init-container example actually verifiable.

Line 785 says signature verification is --verify + --key, but Lines 806-810 only pass --verify. That example now advertises a flow that this PR itself warns about. It also uses docsclaw:latest, which weakens the reproducibility story from the earlier slides. Please pin the init image and either add --key or remove the verification claim.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/slides/oci-skill-distribution-deck.html` around lines 785 - 810, The
initContainer example claims signature verification but only uses --verify and
an unpinned image; update the init container named skill-puller to use a pinned
docsclaw image (replace docsclaw:latest with a specific tag) and include the
verification key flag in the command (add --key <path/to/public/key> alongside
--verify and keep -o /skills and the
quay.io/docsclaw/skill-resume-screener:1.0.0 reference) so the docsclaw skill
pull invocation actually performs cosign verification.

Comment thread examples/openshift/agent-pod-image.yaml Resolved
Comment thread examples/openshift/agent-pod-pull.yaml Resolved
Comment thread internal/oci/inspect.go Outdated
Comment on lines +109 to +110
// Match skill.yaml at any depth (e.g., "skill.yaml" or "resume-screener/skill.yaml").
if header.Typeflag == tar.TypeReg && (header.Name == "skill.yaml" || len(header.Name) > 11 && header.Name[len(header.Name)-11:] == "/skill.yaml") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Only match the root skill.yaml.

Pack only writes the canonical card as ./skill.yaml (image mode) or <skill-name>/skill.yaml (artifact mode). Matching any */skill.yaml here means a nested example/test file can be returned first, so Inspect can report the wrong card for a valid archive that contains more than one skill.yaml. Please restrict this to the archive root / a single leading directory component and add a regression test for an archive with both root and nested skill.yaml.

💡 Suggested change
 import (
 	"archive/tar"
 	"bytes"
 	"compress/gzip"
 	"context"
 	"encoding/json"
 	"fmt"
 	"io"
+	"path"
+	"strings"
-		// Match skill.yaml at any depth (e.g., "skill.yaml" or "resume-screener/skill.yaml").
-		if header.Typeflag == tar.TypeReg && (header.Name == "skill.yaml" || len(header.Name) > 11 && header.Name[len(header.Name)-11:] == "/skill.yaml") {
+		cleanName := path.Clean(header.Name)
+		isRootSkillCard := !path.IsAbs(cleanName) &&
+			!strings.HasPrefix(cleanName, "../") &&
+			path.Base(cleanName) == "skill.yaml" &&
+			strings.Count(cleanName, "/") <= 1
+		if header.Typeflag == tar.TypeReg && isRootSkillCard {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Match skill.yaml at any depth (e.g., "skill.yaml" or "resume-screener/skill.yaml").
if header.Typeflag == tar.TypeReg && (header.Name == "skill.yaml" || len(header.Name) > 11 && header.Name[len(header.Name)-11:] == "/skill.yaml") {
import (
"archive/tar"
"bytes"
"compress/gzip"
"context"
"encoding/json"
"fmt"
"io"
"path"
"strings"
)
// ... other code ...
cleanName := path.Clean(header.Name)
isRootSkillCard := !path.IsAbs(cleanName) &&
!strings.HasPrefix(cleanName, "../") &&
path.Base(cleanName) == "skill.yaml" &&
strings.Count(cleanName, "/") <= 1
if header.Typeflag == tar.TypeReg && isRootSkillCard {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/oci/inspect.go` around lines 109 - 110, The current tar entry check
in Inspect (the header.Typeflag == tar.TypeReg condition) matches any trailing
"/skill.yaml", which can return nested copies; change the filename match to only
accept either exactly "skill.yaml" or a single-leading-directory form
"<dir>/skill.yaml" (i.e., ensure header.Name has no additional '/' characters
besides an optional single leading one) so nested paths like
"examples/foo/skill.yaml" are ignored. Update the matching logic in
Inspect/inspect.go (where header.Name is checked) to validate there is at most
one '/' and that the suffix equals "skill.yaml". Add a regression test that
builds a tar with both "skill.yaml" at the root and another
"examples/skill.yaml" (or deeper nested) and assert Inspect returns the root or
single-dir canonical card only.

Security:
- Add securityContext to both example pod manifests (runAsNonRoot,
  allowPrivilegeEscalation: false, drop ALL capabilities)
- Tighten skill.yaml matching in Inspect to accept only root or
  single-dir depth, rejecting deeply nested matches
- Fix symlink escape check to use destPrefix with separator instead
  of filepath.Clean which can false-match sibling paths

Tests:
- Improve absolute path test to verify safe extraction location

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
@pavelanni
pavelanni merged commit da37a20 into main Apr 14, 2026
2 checks passed
@pavelanni
pavelanni deleted the fix/oci-review-findings branch April 14, 2026 17:14
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.

1 participant