feat(IM1): Upload a file function#66
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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/certas a multipart upload endpoint (file + optional password) that parses certs and persists findings. - Add
backend/cert_parser.pyto 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. |
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.
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
Frontend
Checklist
tsc --noEmitpasse sans erreuruvicorn main:app)