Skip to content

fix: cleanup image build logs for security - #10263

Open
lilypan26 wants to merge 1 commit into
devfrom
lily/sanitize-image-build-logs
Open

lilypan26 wants to merge 1 commit into
devfrom
lily/sanitize-image-build-logs

Conversation

@lilypan26

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

@lilypan26
lilypan26 requested review from a team as code owners December 4, 2026 23:55
Copilot AI max review requested due to automatic review settings December 4, 2026 23:55
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Windows Unit Test Results

  3 files   21 suites   1m 6s ⏱️
817 tests 817 ✅ 0 💤 0 ❌
844 runs  844 ✅ 0 💤 0 ❌

Results for commit baf5180.

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
test 0% ❌
windows 27% ❌
parts_windows Package 1 74% ➖
staging_cse_windows Package 1 72% ➖
debug 0% ❌
provisioningscripts 2% ❌
Summary 40% (2077 / 7276) ❌

@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
shellspec spec 32% ❌
Summary 32% (5593 / 17340) ❌

@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
github.com/Azure/agentbaker/aks-live-patching/pkg/status 100% ✔
github.com/Azure/agentbaker/apiserver 52% ❌
github.com/Azure/agentbaker/cmd 0% ❌
github.com/Azure/agentbaker/cmd/starter 0% ❌
github.com/Azure/agentbaker/fuzz/api 0% ❌
github.com/Azure/agentbaker/hotfix/render-nodecustomdata 35% ❌
github.com/Azure/agentbaker/pkg/agent 79% ➖
github.com/Azure/agentbaker/pkg/agent/datamodel 78% ➖
github.com/Azure/agentbaker/pkg/agent/toggles 0% ❌
github.com/Azure/agentbaker/pkg/vhdbuilder/datamodel 87% ✔
github.com/Azure/agentbaker/aks-node-controller 74% ➖
github.com/Azure/agentbaker/aks-node-controller/common 100% ✔
github.com/Azure/agentbaker/aks-node-controller/config 66% ➖
github.com/Azure/agentbaker/aks-node-controller/generalize 82% ✔
github.com/Azure/agentbaker/aks-node-controller/helpers 68% ➖
github.com/Azure/agentbaker/aks-node-controller/internal/localdns 81% ✔
github.com/Azure/agentbaker/aks-node-controller/parser 89% ✔
github.com/Azure/agentbaker/aks-node-controller/pkg/gpu 100% ✔
github.com/Azure/agentbaker/aks-node-controller/pkg/nodeconfigutils 92% ✔
github.com/Azure/agentbaker/aks-node-controller/utils 0% ❌
Summary 84% (7109 / 9218) ✔

Copilot AI left a comment

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.

🟡 Changes recommended

Sanitization leaves sudo.log, warn, and localmessages behind, while unit discovery can abort generalization on journal-only images with no matching syslog units.

2 open issues
What changed in this PR

Adds security-focused log cleanup to AgentBaker’s Linux image generalization before capture, without changing node-mode behavior.

Changes:

  • Clears selected authentication/system logs, login history, and persistent journals while preventing late writes.
  • Runs cleanup after agent deprovisioning and installation, in image mode only.
  • Documents the behavior and adds cleanup, preservation, and failure-handling tests.
File Description
aks-node-controller/​README.md Documents image-mode log sanitization.
aks-node-controller/​generalize/​logs.go Implements cleanup and late-write protection.
aks-node-controller/​generalize/​generalize.go Adds the image-only cleanup step before sync.
aks-node-controller/​generalize/​generalize_test.go Tests cleanup, preserved files, and failure handling.

Review effort: Max

"secure",
"messages",
"auth.log",
"syslog",
Comment on lines +27 to +28
output, err := g.runCmd(ctx, "systemctl", "list-unit-files", "--no-legend", "--no-pager",
"rsyslog.service", "syslog-ng.service", "syslog.socket")

This branch has not been deployed

No deployments
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