Skip to content

feat(IM1): Upload a file function#66

Merged
Rowuni merged 3 commits into
developfrom
IM1-parseur-pem-cer-p12
May 22, 2026
Merged

feat(IM1): Upload a file function#66
Rowuni merged 3 commits into
developfrom
IM1-parseur-pem-cer-p12

Conversation

@Rowuni
Copy link
Copy Markdown
Owner

@Rowuni Rowuni commented May 22, 2026

Issue liée

close: #13

Description

Ajout de la fonctionnalité d'upload d'un certificat dans le backend. les types supportés sont .cer, .crt, .p12, .pem et .pfx. Un champ pour le mot de passe est aussi présent pour les clés protégées par un mot de passe.

Tests

Changements

Backend

  • Ajout de la fonctionnalité d'upload

Frontend

  • Aucun

Checklist

  • tsc --noEmit passe sans erreur
  • Le backend démarre (uvicorn main:app)
  • Pas de secret / clé / token commité
  • Les types TypeScript sont alignés sur les modèles Pydantic
  • Les changements nécéssaires à la documentation ont été faits

@Rowuni Rowuni linked an issue May 22, 2026 that may be closed by this pull request
@Rowuni Rowuni marked this pull request as ready for review May 22, 2026 08:24
@Rowuni Rowuni requested a review from Copilot May 22, 2026 08:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds backend support for manually uploading and parsing certificate files via the /import/cert API endpoint, producing persisted findings records similar to agent-generated results.

Changes:

  • Implement /import/cert as a multipart upload endpoint (file + optional password) that parses certs and persists findings.
  • Add backend/cert_parser.py to parse PEM/DER/PKCS#12 files and compute severity/risk metadata.
  • Update backend dependencies (cryptography) and adjust models by removing the old JSON payload type.

Reviewed changes

Copilot reviewed 8 out of 11 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
backend/routers/imports.py Implements the upload endpoint and persists parsed findings to the DB.
backend/cert_parser.py Adds certificate format detection + parsing and finding dict generation.
backend/requirements.txt Adds cryptography dependency needed for certificate parsing.
backend/models.py Removes the unused ImportCertPayload model (endpoint no longer accepts JSON PEM).
backend/database.py Adds a startup-time schema “migration” helper that attempts to ALTER existing tables.
agent/tests/certs/test_cert.pem Adds a PEM chain fixture for cert parsing tests/manual checks.
agent/tests/certs/test_cert.crt Adds a PEM .crt fixture for cert parsing tests/manual checks.
agent/tests/certs/README.md Documents the included certificate fixtures and their intended use.

Comment thread backend/database.py
Comment thread backend/database.py
Comment thread backend/routers/imports.py
Comment thread backend/routers/imports.py Outdated
Comment thread backend/cert_parser.py
Comment thread backend/cert_parser.py Outdated
Comment thread backend/cert_parser.py
@Rowuni Rowuni requested a review from Lutow May 22, 2026 08:54
@Rowuni Rowuni self-assigned this May 22, 2026
@Rowuni Rowuni added feature Improvements or additions to documentation Parseurs (mode import) labels May 22, 2026
Copy link
Copy Markdown
Collaborator

@Lutow Lutow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

@Rowuni Rowuni merged commit dd95969 into develop May 22, 2026
@Rowuni Rowuni deleted the IM1-parseur-pem-cer-p12 branch May 22, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Improvements or additions to documentation Parseurs (mode import)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IM1 - Parseur .pem / .cer / .p12

3 participants