[Bug]: herd secure requires admin on every call because the leaf certificate is added to the System keychain
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 63/100
Direzione di ricerca
Start by reading Site.php around lines 741 and 751, then trace secure() into unsecure() around lines 859–862. Reproduce the two administrator prompts on a managed macOS account and verify whether securing a new site can complete without elevation when the CA is already trusted; done means the documented expected behavior is confirmed and covered by an appropriate regression check.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Platform
macOS
Operating system version
macOS 27
System architecture
ARM64 (M1, M2, etc)
Herd Version
1.30.1
PHP Version
PHP 8.2.8 (built: Jul 7 2023)
Bug description
herd secure prompts for an administrator password every time it is run, not only the first time. The 1.11.0 changelog states the CA only needs to be trusted once, which matches the CA handling, but securing an individual site still requires elevation on every call.
This blocks managed estates where developers are not local administrators. Ours is a Cyber Essentials Plus requirement, and the developer has 116 secured sites, so every one needs IT involvement.
What we verified:
- The CA is present and correctly trusted.
security verify-cert -con the Valet CA returns "certificate verification successful". - Site certificates are signed by that CA. Across 116 secured sites, every certificate's issuer exactly matches the CA's subject.
- Site.php line 741 adds the CA to the System keychain with trustRoot. This is the one-off operation described in the changelog and it works as documented.
- Site.php line 751 additionally adds each individual site certificate to the System keychain with trustAsRoot, through sudo. This runs on every herd secure and is what forces the prompt.
Question: given each site certificate already chains to a CA installed as a trusted root at line 741, is adding the leaf certificate at line 751 necessary? If it could be skipped when the CA is already trusted, herd secure would work for a standard user with no elevation at all.
Contributing to this, secure() reaches unsecure(), which makes unconditional sudo calls to security delete-certificate at lines 859 to 862, outside the check for whether a certificate exists. Securing a brand new site with no existing certificate therefore produces two prompts rather than one.
Steps to reproduce
- On a managed Mac, have the developer account be a standard user with no sudo entitlement.
- Install Herd and authorise the privileged helper.
- Secure any site once while an administrator, so the CA is created and trusted.
- Confirm the CA is trusted:
security verify-cert -c "$HOME/Library/Application Support/Herd/config/valet/CA/LaravelValetCASelfSigned.pem"
Returns "certificate verification successful". - As the standard user, create a new empty site folder in a parked directory.
- Run herd secure in it.
Expected: the site is secured without elevation, since the CA is already trusted.
Actual: two administrator password prompts, and the command cannot complete because the account has no sudo rights.
Relevant log output
Site.php:741
sudo /usr/bin/security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain "$caPemPath"
Site.php:751
sudo /usr/bin/security add-trusted-cert -d -r trustAsRoot -k /Library/Keychains/System.keychain "$crtPath"
Site.php:859-862 (inside unsecure, called from secure)
sudo /usr/bin/security delete-certificate -c "%s" /Library/Keychains/System.keychain
sudo /usr/bin/security delete-certificate -c "*.%s" /Library/Keychains/System.keychain
sudo /usr/bin/security find-certificate -e "%[email protected]" -a -Z | ...
Certificate chain confirmation:
site cert issuer= /O=Laravel Valet CA Self Signed Organization/CN=Laravel Valet CA Self Signed CN/OU=Developers
CA subject= /O=Laravel Valet CA Self Signed Organization/CN=Laravel Valet CA Self Signed CN/OU=Developers
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 124
- Fork
- 1
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di beyondcode/herd-community
-
[Bug]: PHP 8.3 php.ini missing auto_prepend_file and herd-ext extension lines (dump() undefined)ApertamacOS
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
beyondcode/herd-community#1693 ·
-
macOS
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
beyondcode/herd-community#1602 ·
-
[Bug]: 1.30.2 creates PHP 8.2 config and ~/.zshrc lines on every start, although 8.2 isn't installedApertafixed-in-next-release macOS
Difficoltà 3/5 1-2 giorni Idoneità per principianti 56/100
beyondcode/herd-community#1763 · 2 commenti ·
-
fixed-in-next-release macOS
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
beyondcode/herd-community#1760 ·
-
macOS
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
beyondcode/herd-community#1755 ·
Tutte le issue di beyondcode/herd-community
Issue simili
-
black --check exits 0 and prints All done when a multi file run is interruptedForse già presa @jiteshgulati l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 2 giorni
-
README for cliForse già presa @Janvi-kapoor l’ha presa oggi. ApertaOSCI'26
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
GauravKarakoti/SecureFlow#1308 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug discussion
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
medialab/xan#1201 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ajeetdsouza/zoxide#1323 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
graygarbage/HermesKey#21 ·