Secure development

Implementing useful and privacy-conscious application logging

Trusted records: terminal, document, eye arranged to illustrate implementing useful and privacy-conscious application logging.

Implementing useful and privacy-conscious application logging connects a security requirement to the behaviour of a real feature. The relevant controls need to remain effective across custom code, integrations and the production configuration. Understanding useful and privacy-conscious application logging helps establish which security property the feature needs and where that property is actually enforced.

What does this involve?

Privacy controls need an accurate account of what information is collected, where it goes and how long it remains useful. Interface choices and declarations should match the behaviour of the actual release, including third-party components and background processing.

Many systems enable network device, operating system, web server, mail server and database server logging, but often custom application event logging is missing, disabled or poorly configured. It provides much greater insight than infrastructure logging alone. Web application (e.g. web site or web service) logging is much more than having web server logs enabled (e.g. using Extended Log File Format).

Application logging should be consistent within the application, consistent across an organisation's application portfolio and use industry standards where relevant, so the logged event data can be consumed, correlated, analysed and managed by a wide variety of systems.

Why it matters

Consider a realistic failure: an incident review finds large volumes of logs but cannot identify who changed a protected record.

Unexpected collection or ineffective user controls can expose personal information and undermine trust in the service. Technical testing should establish observable data handling and the effect of user choices without promising that a single check proves legal compliance.

Implementation guidance should be applied to a real feature and its deployment. Framework defaults, custom handlers and integrated services all influence whether the intended protection remains effective.

How penetration testers check for it

Trace the relevant feature from its entry point to the data or operation it protects, including custom code and alternate paths.

  • Observe collection and sharing during representative user journeys.
  • Compare actual behaviour with settings and declarations.
  • Test refusal, withdrawal, deletion and account transitions.
  • Review integrated components and retained copies.

How to fix it

Use the appropriate maintained mechanisms and verify the result in the actual production configuration.

  • Assisting non-repudiation controls (note that the trait non-repudiation is hard to achieve for logs because their trustworthiness is often just based on the logging party being audited properly while mechanisms like digital signatures are hard to utilize here).
  • When using the file system, it is preferable to use a separate partition than those used by the operating system, other application files and user generated content.
  • For file-based logs, apply strict permissions concerning which users can access the directories, and the permissions of files within the directories.
  • In web applications, the logs should not be exposed in web-accessible locations, and if done so, should have restricted access and be configured with a plain text MIME type (not HTML).
  • Enforce current user choices across relevant data flows.
  • Keep the data inventory and public descriptions aligned with releases.

Privacy notices and technical controls work together. Accurate wording cannot fix unnecessary collection, and a configuration flag does not prove that every data recipient follows it.

Recheck the changed behaviour against the original failure conditions and the legitimate user journey. Keep enough evidence to show which release and configuration were verified, and include related entry points that depend on the same security decision.

Read about our methodology or contact pentested.com to discuss secure development and code review.

See your first test report this week.

Book a 30 minute demo. We will verify one of your targets with you and run a test against it, so you can judge the results on your own systems.

Book a demo