Software Development

Inherited Untested Code Hides Security and Privacy Debt

An inherited frontend can pass a visual smoke test while sending identifiers to analytics, leaving credentials in browser storage, or exposing private data in error reports. As the QA engineer without a trustworthy test suite, I would make outbound data flows the first release gate, ahead of broad UI coverage. That choice may delay a feature, but a green regression suite cannot undo disclosure.

Traffic evidence should come before a patch-or-rebuild decision

Read Inherited Angular With No Tests – Patch or Build Properly? after capturing baseline traffic; its repair framing cannot tell you what the deployed application sends during a real session. A rebuild may remove risky code, but it may also preserve the same analytics configuration, error-reporting SDK, and API contract. Conversely, a small patch can stop a disclosure without settling the codebase’s longer-term future.

Start with a fresh browser profile, no consent stored, and Chrome DevTools open to Network with Preserve log enabled. Capture the first page load, sign-in, a page containing private data, sign-out, and a failed API request. Export a HAR file only into a restricted test location: HAR entries can contain URLs, headers, cookies, and response bodies. Record each unexpected destination’s origin, request method, trigger, and data category rather than attaching the raw capture to a general-purpose ticket.

Use three deliberately distinct test accounts—a new user, a returning user, and a user with restricted permissions—as an initial sampling choice, not a claim that three accounts prove safety. Compare what each account sends before and after consent. Repeat the critical paths in Firefox as well as Chromium because browser storage and tracking controls can alter the requests you observe. A missing request in one browser is not evidence that the application never sends it.

Pay particular attention to URL query strings. They propagate through browser history, copied links, reverse-proxy logs, and sometimes referrer handling, so an email address in a query parameter has more places to survive than the same value in a short-lived request body. Check Referer behavior through the browser’s request details and verify the deployed Referrer-Policy; do not assume a local development setting is present at the edge.

I would not approve a rewrite merely because the inherited Angular application has no tests: replacing templates does not establish which third parties receive data, and the migration can delay containment of a known leak. The immediate decision is narrower: can the current release be constrained and observed well enough to ship, or must the affected path be disabled?

A passing browser test can still miss the disclosure

Automate one assertion against the highest-risk path once the manual capture shows what “normal” looks like. This Playwright test checks for credential-shaped query keys sent to another origin during initial loading. Set BASE_URL to the test deployment and run it with npx playwright test after saving it as a .spec.js file:

const { test, expect } = require('@playwright/test');
const base = process.env.BASE_URL ?? 'http://localhost:3000';
test('no credential keys in cross-origin URLs', async ({ page }) => {
  const hits = [];
  page.on('request', request => {
    const url = new URL(request.url());
    if (url.origin !== new URL(base).origin &&
        /[?&](email|token|session|authorization)=/i.test(url.search))
      hits.push(url.toString());
  });
  await page.goto(base, { waitUntil: 'domcontentloaded' });
  await page.waitForTimeout(1500);
  expect(hits).toEqual([]);
});

The 1,500-millisecond wait is a tunable observation window, not a guarantee about delayed tags; lengthen it to match measured behavior on your test deployment. Playwright documents a default test timeout of 30 seconds, but that limit only bounds execution—it does not make a short observation window complete. This assertion also misses request bodies, cookies, service-worker traffic, later user actions, and sensitive values under different parameter names. Keep the HAR review and add targeted assertions for those surfaces rather than presenting this test as a privacy certificate.

The same limitation applies to error monitoring. Trigger a controlled failure with synthetic account data and inspect the event received by Sentry or the service actually in use. An SDK option that scrubs a field is useful only if the deployed event lacks that field; serialization can copy it into a breadcrumb, message, or URL first. Use OpenTelemetry spans similarly: check attribute values at the collector, because a clean browser console cannot reveal what the collector retained.

For each finding, save a redacted request example, the action that caused it, the expected recipient, and the owner who can change it. Avoid storing real credentials to prove a leak. A synthetic token with a recognizable marker is enough to establish whether the value reaches a third party, and it prevents the evidence itself from becoming another disclosure.

Consent controls and security controls impose different costs

Read Vue Security and Privacy Traps Junior Devs Find Too Late against your own capture rather than as a release checklist, because a framework-specific warning cannot verify deployed tag-manager rules. Whether a view was written in Vue or Angular matters less to this test than when GA4, Segment, or another script loads and what it receives. Check the request timeline before accepting a consent banner as evidence of consent enforcement.

For optional analytics, a proposed release threshold is zero third-party analytics requests before an affirmative choice. Treat zero as a policy value to validate with the product and privacy owners, not as a universal legal rule. The trade-off is visible: blocking early tags may reduce attribution and funnel counts, while loading them early may send identifiers before the user has chosen. Make that loss of measurement explicit rather than disguising it as a QA defect.

Security controls need a separate decision. A restrictive Content Security Policy can prevent an unauthorized script from executing, but a rushed script-src change can also break a legitimate login widget. Deploy Content-Security-Policy-Report-Only first on the affected path, inspect violations, then enforce a policy with approved sources or nonces. Report-only does not block an attack, so set a short review date and do not count its presence as remediation. Where browser support and application architecture permit it, Trusted Types can help constrain DOM injection sinks; it does not decide whether an authorized script is allowed to transmit private data.

Session handling deserves its own observation. Verify the server sets authentication cookies with Secure, HttpOnly, and an appropriate SameSite value, then test sign-out and session expiry rather than inferring safety from the flags alone. SameSite=Lax may suit a conventional top-level login flow, while SameSite=None; Secure may be required for a genuinely cross-site flow and costs more cross-site exposure to assess. Do not move an existing token into localStorage simply to make a broken flow pass: JavaScript can read that storage, so an injection flaw would gain direct access to the token.

Privacy and security can conflict during diagnosis, too. Full request logging helps identify a leak but can duplicate the leaked value in logs. Use synthetic data, restrict capture access, and propose a 48-hour retention ceiling for temporary raw captures; that ceiling is an operational value to agree with the incident owner, not a statutory period. Keep a redacted finding longer only under the team’s evidence policy.

Release gates should describe evidence, not promise coverage

Set a small gate that a reviewer can actually enforce: no known credential or private-field disclosure to an unapproved origin; no optional analytics request before the agreed consent event; a verified sign-out on the tested browsers; and a named owner plus deadline for every remaining exception. These are release conditions for the observed paths, not a statement that the untested application is secure.

Compare two options explicitly. Contain and instrument wins when a specific request, tag, or logging path can be disabled without breaking the core journey; it costs engineering time for targeted fixes and QA time for repeated captures. Freeze the affected path wins when the disclosure cannot be isolated or its recipient cannot be established; it costs availability or feature revenue while the team investigates. Shipping the path with an unexplained outbound request is not a third option, because nobody can assess its exposure without knowing the destination and payload.

Use OWASP ASVS 4.0.3 to turn findings into testable control questions, and use OWASP ZAP or mitmproxy to investigate requests that DevTools alone does not explain. Neither tool’s scan result substitutes for a recipient inventory: an allowed analytics endpoint can receive inappropriate data without looking like an attack. Where a finding involves personal data, record the minimum necessary fields and retention decision alongside the defect; GDPR Article 5’s data-minimisation and storage-limitation principles explain why collecting extra evidence can itself create risk, although the applicable legal assessment belongs with the organization’s privacy team.

A release note should say exactly what was observed: build, environment, account type, browser, actions, capture time, and unresolved paths. That precision gives the next QA engineer a baseline to challenge and gives a decision-maker a real choice between containment and a freeze.

Your first artifact should be a restricted traffic baseline

Before adding broad UI tests, create a synthetic account and capture its first load, sign-in, private-data view, and sign-out with consent unset. Put the HAR in restricted storage, redact one representative request per unexpected destination, and ask the service owner to identify each recipient. If an origin or payload remains unexplained, block that path’s release until someone can account for it.