Security
This document serves as a guide for the Security in govgr, part of the technical documentation for developers implementing solutions within the gov.gr ecosystem. It outlines the basic principles of secure implementation and best practices for applications that interact with gov.gr platforms and handle sensitive or personal data.
Token Storage & Session Management
- Do not store
access tokensinlocalStorageorsessionStorage. - Use HTTP-only
secure cookiesforsessionmanagement. - Implement
refresh flowsfor renewingtokensand use short-livedaccess tokens(≤ 1 hour).
Protection Against Token Injection in URLs
- Never send
tokensvia URLparameters(query params). access_tokenandrefresh_tokenmust be transmitted via a secure channel (bodyorheaders).
Secure Communication (HTTPS)
- All
APIcalls andredirect URIsmust use HTTPS. SSL/TLScertificates must be valid and up to date.
Audit Logs & Logging
- All calls to public services
(e.g., SOE, EMEP)must include anauditRecord. - Your
logsmust not containtokensor personally identifiable information (PII). - Log both successes and failures in a secure
loggingsystem.
Access Restriction with Roles
- Apply
RBAC(Role-Based Access Control) where possible. - Confirm
scopesandrolesfrom thedecoded tokenbefore performing sensitive actions.
Personal Data – GDPR
- Do not store users’ personal data without their consent.
- Support users’ right to delete and port their data.
- Data (
e.g., AFM, name, email) must be accessible only to authorizedservices.
Security Headers & CORS Policies
- Add
security headers(e.g.,Content-Security-Policy,X-Content-Type-Options, etc.). - Configure
CORSto allow requests only from approvedorigins.
Common Mistakes and How to Avoid Them
-
- Mistake: Storing
tokensinlocalStorage. - Recommended: Use
secure cookiesinstead.
- Mistake: Storing
-
- Mistake:
Loggingpersonal details - Recommended: Anonymize or hide them.
- Mistake:
-
- Mistake: Using the same
credentialsfortest&prod - Recommended: Separate
credentialsfor eachenvironment.
- Mistake: Using the same
