Secure coding and development guidelines for AEM 6.5

Organizations developing web applications on Adobe Experience Manager (AEM) 6.5 need clear secure coding standards and development guidelines to reduce security risks throughout the development lifecycle. Relevant guidance is distributed across multiple Adobe documents. To address this, apply the following application-level security practices during design, implementation, code review, and testing.

Description description

Environment

  • Adobe Experience Manager 6.5
  • All platforms
  • AEM application development

Issue/Symptoms

  • Development teams need clear secure coding standards and best practices for AEM application development.
  • Development teams need practical checklists for secure design, implementation, and code review.
  • Development teams need guidance for identifying and avoiding insecure coding patterns specific to AEM.

Cause

Secure coding guidance for AEM 6.5 is distributed across multiple Adobe documents instead of being available in a single consolidated development checklist.

Resolution resolution

Follow these secure coding standards and development guidelines for AEM 6.5 application development:

  1. Identify and document the security requirements for every feature during the design phase.
  2. Apply the principle of least privilege to all user roles and permissions.
  3. Plan input validation and output encoding for all user-facing features.
  4. Do not expose sensitive information in URLs, logs, or error messages.
  5. Use AEM HTML Template Language (HTL) to render output and benefit from automatic context-aware escaping and reduce XSS risks.
  6. Validate and sanitize all user input on both the client side and the server side.
  7. Use AEM XSSAPI for dynamic content output in servlets, models, or Java code.
  8. Do not use deprecated APIs or direct scriptlets in JSP files.
  9. Implement secure logging, and do not log sensitive data such as passwords or tokens.
  10. Handle errors without exposing stack traces or internal details to users.
  11. Use HTTPS for all client-server communication.
  12. Review the code for compliance with secure coding standards and best practices.
  13. Verify the correct use of HTL and XSSAPI for all output rendering.
  14. Verify that all input validation and output encoding are implemented correctly.
  15. Remove hardcoded credentials, secrets, and sensitive data from the code.
  16. Verify that permissions and access controls are enforced as designed.
  17. Identify and remove insecure anti-patterns, including direct repository access without permission checks and the use of unsafe APIs.
  18. Use the Sling Resource API and JCR APIs with the appropriate permission checks.
  19. Use AEM built-in validation for dialogs and forms.
  20. Separate business logic from presentation by using HTL and the Use-API.
  21. Regularly update dependencies and third-party libraries to address known vulnerabilities.
  22. Review the official Adobe documentation for foundational security guidance and best practices.
  23. After implementing these practices, perform security testing, including code scanning and penetration testing, to verify that common vulnerabilities are addressed.
recommendation-more-help
experience-cloud-kcs-help-kbarticles