Core: `SecurityUtils.createMtlsKeyStore` should use a fixed algorithm for creating the `PrivateKey`

Aperta
#1,675 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
java
Ambito
security

Direzione di ricerca

Inizia da SecurityUtils.createMtlsKeyStore ed esamina la gestione attuale di IllegalArgumentException relativa alla chiamata a KeyFactory mostrata nell'issue. Esamina le indicazioni di Error Prone su InsecureCipherMode e l'API di InvalidAlgorithmParameterException, quindi esegui la build con Error Prone abilitato. Il lavoro è completato quando gli algoritmi di chiave non sicuri o non supportati vengono gestiti come specificato e l'avviso viene risolto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

priority: p3

Callers of SecurityUtils.createMtlsKeyStore can direct the use of insecure algorithms in the construction of the mTLS connection. In general, we attempt to affix the algorithm used to inhibit use of algorithms with known vulnerabilities.

Personally, I would be fine with denying provided certs whose cert.getPublicKey().getAlgorithm() was DH or DSA, but in lieu of blocklisting known bad algorithms, perhaps it'd be more security affirmative to allowlist currently-OK algorithms, so we only ever use good versions, and suffer toil later if we have to retrofit additional entries.

My suggestion is to create a case statement just below where the method currently throws IllegalArgumentException for various cases, and add the set of known good algorithms, and throw an InvalidAlgorithmParameterException if it is not one of those. In addition, special case DH and DSA to give references to their vulnerabilities as described in InsecureCypherMode.identifyDiffieHellmanAndDsaVulnerabilities.

/cc @sophieschmieg, as her guidance/requirements will be canonical for importing whatever changes are made here into the monorepo.

Environment details
  1. API: Core
  2. OS type and version: 5.17.6-1rodete1-amd64
  3. Java version: OpenJDK Runtime Environment (build 11.0.13+8-google-release-451398016) OpenJDK 64-Bit Server VM (build 11.0.13+8-google-release-451398016, mixed mode, sharing)
  4. version(s): ~head (with local patches)
Steps to reproduce
  1. Add errorprone warnings to the build
  2. Build.

SecurityUtils.createMtlsKeyStore will generate an InsecureCipherMode warning.

Code example
    PrivateKey key =
        KeyFactory.getInstance(cert.getPublicKey().getAlgorithm()).generatePrivate(keySpecPKCS8);
Lingua principale
Java
Stelle
1.4k
Fork
476
Merge medio
10h 47m
PR unite (30g)
3

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di googleapis/google-http-java-client

Tutte le issue di googleapis/google-http-java-client

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.