Repository navigation
release: v5.0.3 security fixes and verified deployment #800
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
+895
−163
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d0a0700
fix: reject control characters in FTP command arguments
klboke 91b4638
fix: confine upload writes and folder creation to demo storage
klboke 93931f6
fix: validate every preview source before applying trust policies
klboke 84369c0
fix: constrain preview page and agent parameters to safe scalar values
klboke 8530c0a
fix: render archive trees only within authorized previews
klboke e7e3284
fix: expose only aggregate health information by default
klboke 0ff214d
test: verify existing archive traversal protection
klboke 7d311ee
release: prepare v5.0.3 security fixes and verified deployment
klboke 3c73d8e
fix: harden every shipped config and isolate archive storage tests
klboke 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 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,42 @@ | ||
| $ErrorActionPreference = 'Stop' | ||
| $Tokens = $null | ||
| $ParseErrors = $null | ||
| $ScriptPath = Join-Path $PSScriptRoot 'remote_windows_deploy.ps1' | ||
| $Ast = [System.Management.Automation.Language.Parser]::ParseFile($ScriptPath, [ref]$Tokens, [ref]$ParseErrors) | ||
| if ($ParseErrors.Count -gt 0) { throw ($ParseErrors | Out-String) } | ||
| foreach ($Name in @('Resolve-ActiveConfigPath', 'Set-SecureActuatorDefaults')) { | ||
| $FunctionAst = $Ast.Find({ param($Node) $Node -is [System.Management.Automation.Language.FunctionDefinitionAst] -and $Node.Name -eq $Name }, $true) | ||
| if (-not $FunctionAst) { throw "Missing function: $Name" } | ||
| . ([scriptblock]::Create($FunctionAst.Extent.Text)) | ||
| } | ||
|
|
||
| $TempRoot = Join-Path ([System.IO.Path]::GetTempPath()) ('kkfileview-deploy-test-' + [guid]::NewGuid().ToString('N')) | ||
| try { | ||
| $Bin = New-Item -ItemType Directory -Path (Join-Path $TempRoot 'bin') | ||
| $Config = New-Item -ItemType Directory -Path (Join-Path $TempRoot 'config') | ||
| $ActiveFile = Join-Path $Config.FullName 'test.properties' | ||
| $Utf8 = New-Object System.Text.UTF8Encoding($false) | ||
| $Original = "# Preserve Unicode: 中文`r`ncustom.value = unchanged`r`nmanagement.endpoints.web.exposure.include = health,info,metrics`r`nmanagement.endpoint.health.show-details = always`r`n" | ||
| [System.IO.File]::WriteAllText($ActiveFile, $Original, $Utf8) | ||
| $Resolved = Resolve-ActiveConfigPath -CommandLines @('java -Dspring.config.location=..\config\test.properties -jar kkFileView-5.0.jar') -WorkingDirectory $Bin.FullName | ||
| if ($Resolved -ne $ActiveFile) { throw 'Did not resolve the runtime configuration override' } | ||
| Set-SecureActuatorDefaults -ConfigPath $Resolved | ||
| $Expected = $Original.Replace('health,info,metrics', 'health').Replace('show-details = always', 'show-details = never') | ||
| $Actual = [System.IO.File]::ReadAllText($Resolved, $Utf8) | ||
| if ($Actual -cne $Expected) { throw 'Migration altered unrelated configuration or missed a security default' } | ||
| Set-SecureActuatorDefaults -ConfigPath $Resolved | ||
| if ([System.IO.File]::ReadAllText($Resolved, $Utf8) -cne $Expected) { throw 'Migration is not idempotent' } | ||
|
|
||
| [System.IO.File]::WriteAllText($ActiveFile, 'custom.value = unchanged', $Utf8) | ||
| Set-SecureActuatorDefaults -ConfigPath $ActiveFile | ||
| $Actual = [System.IO.File]::ReadAllText($ActiveFile, $Utf8) | ||
| if ($Actual -notmatch 'management.endpoints.web.exposure.include = health' -or $Actual -notmatch 'management.endpoint.health.show-details = never') { | ||
| throw 'Missing properties were not added' | ||
| } | ||
| $Rejected = $false | ||
| try { Resolve-ActiveConfigPath -CommandLines @('java -jar app.jar') -WorkingDirectory $Bin.FullName } catch { $Rejected = $true } | ||
| if (-not $Rejected) { throw 'Unknown active configuration must fail closed' } | ||
| Write-Host 'Windows deployment syntax and configuration migration tests passed' | ||
| } finally { | ||
| if (Test-Path $TempRoot) { Remove-Item -LiteralPath $TempRoot -Recurse -Force } | ||
| } |
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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| FROM keking/kkfileview-base:5.0.0 | ||
| ADD server/target/kkFileView-*.tar.gz /opt/ | ||
| ENV KKFILEVIEW_BIN_FOLDER=/opt/kkFileView-5.0.2/bin | ||
| ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dspring.config.location=/opt/kkFileView-5.0.2/config/application.properties","-jar","/opt/kkFileView-5.0.2/bin/kkFileView-5.0.2.jar"] | ||
| ENV KKFILEVIEW_BIN_FOLDER=/opt/kkFileView-5.0.3/bin | ||
| ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dspring.config.location=/opt/kkFileView-5.0.3/config/application.properties","-jar","/opt/kkFileView-5.0.3/bin/kkFileView-5.0.3.jar"] |
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
KK_DEPLOY_HEALTH_URLnames an application context without a trailing slash, such ashttp://host/kkfileview, the relativeSystem.Uriconstruction replaceskkfileviewand probeshttp://host/actuator/...instead. The ordinary health check can succeed at the configured URL, but aharden_actuatordeployment then fails verification and rolls back despite correctly securing the application; normalize the base URL as a directory or construct these endpoints from its context path explicitly.Useful? React with 👍 / 👎.