The Lawfare Academy

Lawfare Group → Knowledge Institute → Lawfare Academy

← Back to program

← Computer Science: Algorithms, Systems and Software

Weeks 13–16

Networks, applications and responsible computing

Learning objectives

  • Explain the mechanisms and distinctions in networks, applications and responsible computing.
  • Apply the assigned concepts to the supplied fictional record and justify each inference.
  • Revise a conclusion when evidence, assumptions or constraints change.

Develop the concepts

A networked application depends on messages crossing boundaries among clients, services and storage. Requests can be delayed, duplicated or fail after one side has already acted. Distinguish a timeout from proof that an operation did not happen. Idempotent designs make repeated requests have the intended single logical effect when repetition is possible.

Authentication establishes an identity or credential relationship; authorization determines what an actor may do. Hiding a button is a presentation choice, not an access-control mechanism. Enforce permissions where protected data or actions are served. Apply least privilege, validate inputs and minimize the data collected. Encryption protects certain communication or storage properties but does not correct an application that authorizes the wrong person.

Responsible computing also examines accessibility, privacy, reliability and the effects of automated decisions. A technically accurate model can still be unsuitable for a purpose when the data, error costs or institutional process are inappropriate. Document intended use, important limitations and correction pathways. Evaluate security through plausible threats and trust boundaries rather than a checklist of impressive tools. A cumulative design explains how a request is processed, how identity and state are maintained, what can fail and how users recover.

Worked record

A fictional learning service records a completion after a request, but the response is lost. The learner retries. Without a uniqueness rule, two completion rows are created for the same learner, course version and lesson.

Reason through the record

The retry is reasonable because the client cannot tell whether the first request succeeded. The service should represent completion as a logical fact keyed by learner, course version and lesson rather than as an unrestricted append operation. An idempotent operation or a matching uniqueness constraint prevents double counting while allowing retries. Verify authorization separately so that a caller cannot mark another learner’s record. A success indicator should reflect the stored result, and recovery should tolerate lost responses. This is a distributed-state problem, not evidence that the learner intentionally duplicated work.

Deeper explanation: Networks, ambiguous failures and permission-scoped AI

A network timeout describes the caller's observation. It does not prove whether the remote operation committed. The server may have written successfully and lost the response. Retrying blindly can duplicate a charge, message or file. Design a request identifier and a reconciliation operation so a caller can discover the established state. Retry policies also need limits and backoff; multiplying load during an outage can make recovery harder.

Authentication establishes a verified identity under an explicit trust mechanism. Authorization decides what that identity may do to a particular object. A client-supplied tenant field is not proof of membership. Derive the tenant or access scope from verified server-side identity, and apply that restriction to every relevant database query. Checking the overview page while leaving the detail endpoint unrestricted does not protect the underlying data.

A retrieval-augmented AI feature adds another boundary. Documents admitted to a model's context must already satisfy the caller's permissions. Filtering the generated answer afterward cannot undo disclosure to an unauthorized model context. Retrieved text is data, not a privileged instruction channel. A document that says ignore policy must not gain authority to change permissions, invoke tools or disclose unrelated records. An answer with a well-formed citation may still fail to support its claim; source identity and claim entailment are separate tests.

Evaluation should include positive and negative cases. A system that always abstains may avoid false assertions while being useless. A system that always answers may look helpful while ignoring evidence. Keep a fixed fixture with supported, unsupported, contradictory, stale and unauthorized documents. Count errors by category and inspect the permitted context. If a feature can perform an external action, validate arguments and authorization independently of generated prose, and require the application's intended confirmation policy at that action boundary.

Fully worked investigation

A write with request ID R commits, but its response is lost. The client times out. A safe retry reuses R and the same contents; the server recognizes the committed event and returns its result. A new ID R2 would instead mean a new operation. Separately, a learner from tenant A asks for a summary while a tenant B document has the best textual match. The permitted search must exclude B before ranking or assembling context. A high similarity score cannot authorize access.

Independent transfer problem

Create five synthetic retrieval records: authorized support, authorized contradiction, stale support, unauthorized support and an instruction to reveal secrets. Specify the allowed context and answer state for a query with no current authorized support. Then explain how an exact write retry differs from a new request ID.

Reasoning and limitations

No current authorized supporting document means abstention or a clear unsupported state. Stale and unauthorized records cannot supply hidden support; malicious instructions remain untrusted document content. Contradictory authorized evidence requires an explicit conflict state rather than silent cherry-picking. An exact retry uses the original operation identity; a new ID can create another action.

Unit 4: networked applications, architecture and responsible operation

Layers provide different promises

A network connects endpoints through communication links and intermediate systems. Link-level communication moves frames over a particular local technology; Internet Protocol supports addressing and routing of packets across networks. A transport protocol adds its own service model between endpoints. Application protocols describe exchanges meaningful to a service. These layers separate responsibilities, but an application still experiences their combined delays and failures. An IP address is not automatically a person's verified identity, and a reachable machine does not thereby authorize access to its data.

TCP supplies an ordered byte stream with mechanisms for loss detection and retransmission. The application must still determine where one logical message ends and another begins; a single send need not correspond to a single receive. TCP delivery also does not establish that a business operation committed. UDP supplies datagrams without TCP's ordered-stream and retransmission contract; applications using it need to account for the behaviors their own purpose requires. A reliable application cannot simply infer successful remote work from the name of its transport.

DNS associates names with resource records through resolvers and name servers in a distributed hierarchy. Cached answers have lifetimes, so changing an authoritative record does not mean every client immediately observes the replacement. Successful name resolution supplies information for reaching a service, rather than proving that the service is healthy or its content current. Separate a DNS failure, connection failure, certificate failure and application error in diagnosis; they imply different next observations. A longer timeout does not repair a name that resolves to the wrong intended endpoint.

A browser request crosses several boundaries

A browser identifies a resource using a URL, resolves the relevant host as needed and establishes an appropriate connection. HTTPS adds transport security and authenticated endpoint checks under its trust model. The browser sends an HTTP request describing a method, target, fields and any content; a server sends a response with a status, fields and optional content. A proxy, cache or load balancer can participate between them. HTTP semantics persist across protocol versions, although their wire representations differ.

A GET is intended for retrieval rather than requesting a state-changing business action. POST can submit processing to a resource; its meaning depends on the service contract. An idempotent method has the same intended effect when an identical request is repeated, although responses or logging can differ. Application-level operation identifiers can also make a particular action safely recognizable as a retry. Do not infer that any arbitrary POST can be repeated without duplicate effects. The retained native ambiguous-response investigation develops the required identity and reconciliation reasoning.

HTML describes document structure, CSS contributes presentation, and JavaScript can add interaction. A server-rendered page can remain readable when client controls fail, but that fallback must accurately communicate its limits. Receiving an HTTP 200 with an application error document is not a successful user operation. Similarly, a visible disabled or hidden button is not a substitute for authorization at the protected request boundary. Validate what the API actually serves rather than only what one interface displays.

State, sessions and distributed work

Application state can reside in the browser, a service process, persistent storage or a remote provider. These locations have different lifetimes and trust properties. A session identifier can link requests to authenticated context, but a submitted role or organization field is still untrusted input unless checked against that context. Authorization should apply to the specific operation and object. Collect only data needed for a defined purpose, restrict access and plan retention and correction rather than treating every available field as useful analytics.

An asynchronous queue separates accepting work from finishing it. An acknowledged enqueue can mean only that a job was accepted into a particular queue, not that its downstream effect occurred. A worker can fail after performing an external action but before recording local completion. Retries then require operation identity and reconciliation across that boundary. A database transaction on one service does not atomically commit another provider's state. A protocol needs explicit states such as pending, committed, failed and unknown, with evidence for transitions.

Architecture is a tradeoff, not a product label

A single deployable application can keep several responsibilities in one process while preserving modular interfaces internally. Separating services can support independent scaling or ownership, but introduces more network contracts, deployment coordination and partial failure cases. A load balancer can distribute requests among replicas; replicas cannot safely rely on unshared process memory for durable shared truth. Cache invalidation, version compatibility and state ownership belong in the design before adding more instances.

Cloud computing describes a service model with properties such as on-demand access, resource pooling, elasticity and measured use. Infrastructure, platform and software services assign different responsibilities between provider and customer. Public, private and hybrid deployment arrangements describe organization and use, not automatic security levels. A virtual machine, a container and a managed service expose different boundaries; a container image packages an execution environment but does not by itself supply backups, correct authorization or a recovery plan. Using more than one cloud can reduce some dependencies while increasing identity, networking, consistency and operational complexity.

Enterprise architecture connects a technical system to organizational processes, ownership and constraints. A capability map asks what the organization needs to do; a data-flow view asks what information crosses which boundaries; a deployment view asks where components run and what fails together. A useful architecture decision records alternatives, evidence, costs, responsibilities and a reason to revisit the choice. 'Cloud-native' is not an explanation for why a particular dependency failure is tolerable.

Operation, accessibility and evidence

Logs describe selected events; metrics summarize quantities over a defined population and interval; traces can connect steps across a request path. None is a complete account of reality. A success metric must specify whether it counts accepted jobs, completed jobs, distinct operations or returned responses. Avoid putting private writing, credentials or unnecessary personal data in diagnostic records. Alert thresholds should support a defined response rather than merely generate activity.

Backups require restoration evidence: a file that exists is not automatically a usable recovery point. A release plan should identify the version, compatibility requirements, verification and reversal or repair strategy. Rolling back executable code can be unsafe when data structures have changed incompatibly, so code and data evolution must be considered together. Observe both the changed behavior and a preserved important flow after release, and report which boundary was actually tested.

Accessibility considers whether people with varied abilities can perceive, operate and understand the service. Semantic headings and labels support navigation; keyboard access should expose meaningful focus and operation; information should not depend solely on color. Accessibility, privacy and security are related design responsibilities but not interchangeable claims. A technically fluent AI answer can still be unsupported or unauthorized. The retained native retrieval model demonstrates why permissions must constrain the admitted evidence before generation, and why cited material still needs to support the particular claim.

Original distributed-work record and full model

Harbor's fictional dispatch service accepts operation K9 and returns an acceptance identifier. A worker asks a simulated provider to reserve one asset. The provider stores reservation P41 for K9, but the response is lost. The local worker marks K9=unknown. A second worker sees the unknown state. The correct next step is not to assume failure and reserve again with a new operation ID. Reconcile the provider by K9 or retry according to a provider contract that recognizes that same operation and identical validated content. Only after checking evidence should the service mark a single committed reservation.

Changed facts: the provider offers neither operation-ID lookup nor an idempotent request mechanism. The local database still cannot make the external effect exactly once through its own transaction alone. Preserve the uncertainty and use an explicit reconciliation or human review path under the application's policy. A UI that says 'failed' without evidence can induce a duplicate action; a UI that says 'complete' without evidence can induce reliance on an absent reservation. Bounded retry and honest unknown states are part of correctness.

Optional measurement practice with complete model

Question: a fictional service reports 100 accepted job requests, 90 completed unique jobs and 12 timeout responses. Can the three values describe one interval without contradiction? Can you infer that 22 jobs failed?

Model: they can coexist because acceptance, completed operations and responses count different events, and the record does not establish a one-to-one mapping. A request may time out after its job completed, and a retry may produce another response for the same operation. Subtracting 90 and 12 from 100 mixes categories without establishing their overlap. Measure operation IDs and states at a declared cutoff, distinguish retries from new work and reconcile completion evidence. Changed facts: the record explicitly states 100 distinct accepted IDs, 90 committed IDs, 7 terminal failures and 3 unknown states at the cutoff. Those categories now partition 100, but the 3 unknown cannot honestly be labeled failed or successful without additional evidence. The 12 timeout responses remain a separate observation.

Complete original cumulative application and rubric: https://www.lawfaregroup.com/knowledge/academy/developed-studies/computing-contracts-machines-and-evidence.html#cumulative

Apply the idea

A fictional learning service records a completion after a request, but the response is lost. The learner retries. Without a uniqueness rule, two completion rows are created for the same learner, course version and lesson.

The completion button is hidden from unauthorized users, but the API accepts their requests. What must change?

Additional worked record — a separate fictional scenario: A write with request ID R commits, but its response is lost. The client times out. A safe retry reuses R and the same contents; the server recognizes the committed event and returns its result. A new ID R2 would instead mean a new operation. Separately, a learner from tenant A asks for a summary while a tenant B document has the best textual match. The permitted search must exclude B before ranking or assembling context. A high similarity score cannot authorize access.

Progressive transfer problem: Create five synthetic retrieval records: authorized support, authorized contradiction, stale support, unauthorized support and an instruction to reveal secrets. Specify the allowed context and answer state for a query with no current authorized support. Then explain how an exact write retry differs from a new request ID.

Read the worked reasoning

Enforce authorization in the API using trusted identity and permission checks. The browser interface can improve usability, but it must not be the security boundary. Test direct requests and cross-user access.

Transfer reasoning: No current authorized supporting document means abstention or a clear unsupported state. Stale and unauthorized records cannot supply hidden support; malicious instructions remain untrusted document content. Contradictory authorized evidence requires an explicit conflict state rather than silent cherry-picking. An exact retry uses the original operation identity; a new ID can create another action.

Check understanding

When must document authorization be enforced for a retrieval-based model?

  1. Only after an answer has been generated
    Feedback

    Incorrect. Post-generation filtering cannot undo disclosure of an unauthorized document to the model context.

  2. Only when the document contains a password
    Feedback

    Incorrect. Permissions apply to the protected object, not merely to obvious secrets inside its text.

  3. Before the document enters the model context
    Feedback

    Correct. Establish permitted context first. Ranking quality and fluent answers do not create access rights.

Further reading

Study the complete native lesson and matching original on-site reader unit with the preserved quantitative investigation, then the complete Harbor cumulative case and rubric. All practice, local laboratory execution and publisher chapters are optional; no external learning departure is required.

My learning →