Repository navigation
Conversation
…rors - New php-censor.ssh.type option (ed25519 by default, or rsa); RSA keys are 3072 bits by default. - The key pair is generated in a private temporary directory, removed even on failure. - Arguments are escaped, the type is checked against an allowlist. - ssh-keygen failures throw: a key rejected by ssh-keygen is told apart from ssh-keygen not being able to run (not installed, proc_open() disabled, open_basedir, no writable temporary directory). - Public key derived from a private key, SHA256 fingerprint, private key line endings normalized. - %PROJECT_TITLE% and %HOSTNAME% variables in the key comment (default: %PROJECT_TITLE%@php-censor). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The key file and ssh wrapper are removed in a finally block, even when the clone throws.
- The git/svn ssh wrapper forwards its arguments as they are ("$@" instead of $*) and quotes the
key file path (-i); Mercurial keeps its own ssh command (and its host key checking), with the key
file path quoted.
- The key file is written with the line endings ssh expects.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…or remove the key - The add and edit forms have an "SSH key" choice: keep (or no key), generate a new key pair (on save, the default for a new project), or remove. A pasted private key wins over the choice. - The private key is no longer pre-filled (add) nor sent back (edit): a blank field keeps the key. - The public key is derived from the private key on the server; the hidden public key field is gone. An invalid or passphrase-protected key is rejected with a clear message. - Generating or removing a key asks for a confirmation, as it breaks builds until the deploy key is updated. - Key fields are read from the request body only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ic key The public key is only shown when the project has a private key (a public key left alone by the former form is no longer displayed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Contribution type
Bug fix, feature, UI
Description of change
Reworks how project SSH deploy keys are generated, stored and used: it fixes several issues and adds a way to regenerate a key from the UI.
Key generation (
Helper\SshKey)php-censor.ssh.typeoption:ed25519(new default) orrsa. RSA keys are 3072 bits by default (was 2048), andstrengthonly applies to RSA./tmpevery time the "Add project" page was opened.ssh-keygenis told apart fromssh-keygennot being able to run (not installed,proc_open()disabled,open_basedir, no writable temporary directory).%PROJECT_TITLE%and%HOSTNAME%variables inphp-censor.ssh.comment, so that the deploy keys of projects and instances can be told apart. The default comment is now%PROJECT_TITLE%@php-censor. Spaces in the variable values become-.Project add and edit forms
ssh-keygen -y), instead of coming from a hidden form field. It can no longer differ from the private key, for example after pasting another private key. An invalid or passphrase-protected key is rejected with a clear message.Project page
Builds
finallyblock, even when the clone throws."$@"instead of$*) and quotes the key file path.Behaviour changes
php-censor.ssh.type: rsa; this is described indocs/en/upgrades/UPGRADE_3.0.md.Tests
SshKeyTest, covering:ssh-keygen -l);ssh-keygen;open_basedirwithout/dev;SshCloneTest: temporary files are removed when the clone throws (git, hg and svn), the Mercurial command, wrapper argument forwarding, key normalization.ProjectServiceTest: updating a project without key options keeps its keys.ProjectTest:Project::hasSshPrivateKey().