Question 130
A web app directly trusts a user-supplied role string such as 'admin' before calling tools. What is the security flaw?
- A role string typed by the user grants database permissions when included in a prompt.
- TLS encryption establishes that the user holds the administrator role.
- Authorization must derive from verified server-side identity, not client-controlled fields.
- The model can authorize sensitive tools if it explains the action clearly.
Explanation
Correct Answer
C:Untrusted request payloads can be altered; tools require authoritative permission checks independently of what the model or client claims.
Incorrect Answers
A:Self-asserted text is not a verified identity claim and cannot justify privileged downstream data access. The downstream tool must make the role decision itself.
B:TLS secures the connection, but role-based authorization still requires identity verification and server policy.
D:A plausible narrative does not replace backend identity, role, target, and action checks. An audit log of prose does not grant any of those permissions.
Question 131
A scheduled worker has ten thousand independent tasks but creates ten thousand active HTTP requests at once. What implementation discipline is missing?
- Use a bounded worker queue with backpressure and rate-limit awareness.
- Invalidate the exposed key and move credential loading to a secret manager or environment.
- Examine status and content type before attempting JSON decoding.
- Apply asynchronous I/O and enforce concurrency limits on external requests.
Explanation
Correct Answer
A:Concurrency improves throughput only until it overwhelms quotas or dependencies; queueing provides controlled resource use.
Incorrect Answers
B:Deleting a commit does not invalidate a leaked credential; rotation and an external secret source are needed to contain the exposure; the consequence is improved exposed source-controlled credential, not verified scalable request queueing.
C:Assumed JSON parsing can obscure the real transport failure; protocol metadata must be validated first; this targets defensive HTTP content parsing, while the system must demonstrate scalable request queueing.
D:Network calls can overlap without tying up a worker for each wait; bounded parallelism avoids saturating dependencies; when the goal is scalable request queueing, optimizing nonblocking service I/O misses that operational boundary.
Question 132
A programmer wants a minimal reproducible bug for a tool calling error. What information should the reproduction include?
- Make mandatory schema diffs and contract tests for the affected tool boundary.
- Check the payload against the application's expected response contract.
- Preserve the relevant request schema, content block sequence, and observed response metadata.
- Set model, prompt, tool schema, and application configuration under change control.
Explanation
Correct Answer
C:Exact protocol inputs and stop conditions distinguish integration bugs from variations in model wording. Include a minimal tool schema and paired request-response trace with credentials removed to make the failure reproducible safely.
Incorrect Answers
A:Reviewers need to see both the field changes and their behavioral impact on model-proposed arguments and downstream execution; even if reviewable tool schema changes succeeds, reproducible tool-call bug report still needs separate verification.
B:Transport success confirms delivery, not data shape; schema checks catch incompatible or incomplete integration output before it reaches consumers; it follows response contract validation constraints but leaves reproducible tool-call bug report unspecified.
D:Reproducibility depends on all behavior-shaping inputs, not only the application binary; for this request, reproducible tool-call bug report is the missing piece, not reproducible inference configuration.
Question 133
A TypeScript client casts an unknown API response to a trusted interface without validation. What is the consequence?
- A TypeScript type assertion dynamically rejects malformed JSON fields.
- The compiler automatically populates all fields missing from API responses.
- Compile-time types cannot verify data received from the network at runtime.
- A successful HTTP status guarantees that the payload implements the declared interface.
- The SDK's type definitions eliminate the need to inspect unexpected server data.
Explanation
Correct Answer
C:A type assertion changes static checking, not external payloads; runtime schema validation is needed before acting on fields.
Incorrect Answers
A:Type assertions are erased during compilation and cannot inspect network response values at runtime. A separate runtime parser or validator has to inspect the object.
B:Types describe expectations but do not add missing response properties or defaults to untrusted payloads. The calling code still needs to handle absent properties explicitly.
D:Transport success cannot guarantee field types, nested structure, or semantic validity. The caller must independently inspect each required field after decoding.
E:Declarations improve editor checking but runtime schema validation is still necessary at untrusted boundaries.
Question 134
An LLM extraction service must emit valid JSON and guarantee that extracted account IDs exist. Which TWO controls address these different requirements? Choose TWO.
- Use a larger context window as the only safeguard.
- Only say “output JSON” several times in the prompt.
- Constrain response generation with a supported JSON schema.
- Skip validation when an HTTP request succeeds.
- Check returned account IDs against an authoritative customer service.
Explanation
Correct Answers
C:Structured output controls can enforce parseable fields and types for the generation path. The client must still account for refusal or truncated generations that can bypass an otherwise constrained success path.
E:Referential integrity is a business fact that JSON shape alone cannot establish. Lookups should be authorized for the current tenant and report missing or forbidden accounts before any write.
Incorrect Answers
A:Context size does not ensure proper formatting or that a referenced account exists. More prompt capacity changes how much information can be supplied, not whether identity references exist.
B:Prompt repetition offers no protocol-level schema guarantee and cannot verify identifiers. Repeating an instruction cannot guarantee a constrained parser contract or validate references to external records.
D:Transport status does not prove correct data shape or referential integrity. Even a parseable response can contain an account ID that is malformed for the domain or absent from the database.
Question 135
A service returns raw low-level API exceptions directly to end users. What should its public error contract do?
- Confirm the payload against the application's expected response contract.
- At the application layer, assert task-level invariants and structured fields rather than exact prose.
- Preserve Claude calls in a server-side service and expose a restricted application API.
- Map internal failures into safe, stable, actionable client error categories.
Explanation
Correct Answer
D:Exposing internals leaks implementation details and produces brittle clients; a boundary can preserve detailed logs while presenting safe errors.
Incorrect Answers
A:Transport success confirms delivery, not data shape; schema checks catch incompatible or incomplete integration output before it reaches consumers; this may help response contract validation but cannot by itself deliver safe error abstraction.
B:Non-deterministic language variation makes string snapshots brittle, while behavior and schema assertions capture meaningful correctness; this implements model-response test invariants rather than the demanded safe error abstraction.
C:A backend boundary centralizes secrets, rate limits, authorization, and prompt versions rather than shipping privileged credentials to browsers; it follows server-side credential boundary constraints but leaves safe error abstraction unspecified.
Question 136
A developer is debugging a streaming implementation and observes duplicated UI tokens after reconnecting. What state should the client manage?
- Track emitted content and reconnect semantics to prevent replaying the same deltas.
- Persist prompts as versioned artifacts linked to tests and releases.
- Require domain invariants such as sum reconciliation and nonnegative quantities.
- Run authentication, permission denial, and representative storage responses in a controlled environment.
Explanation
Correct Answer
A:Stream resumption and client rendering require explicit ordering and deduplication assumptions; reconnecting is not automatically exactly once.
Incorrect Answers
B:Traceable revisions allow comparing model behavior and restoring a known-good prompt independently of code edits; testing streaming UI deduplication would still fail after improving multi-criterion integration.
C:A schema can guarantee a field is numeric without guaranteeing that extracted values are financially consistent; a remedy for semantic business validation is not a substitute for streaming UI deduplication.
D:Tool behavior depends on external credentials and data contracts, which pure prompt tests cannot cover; changing external service integration coverage does not establish streaming UI deduplication in this application.
Question 137
A JSON-based extraction service needs to preserve numerical totals from uploaded invoices. What should validation check beyond type correctness?
- Enforce domain invariants such as sum reconciliation and nonnegative quantities.
- Validate status and content type before attempting JSON decoding.
- Put in place defensive parsing with explicit schema-error paths and fallback behavior.
- Process and validate fields, then use parameterized database queries.
Explanation
Correct Answer
A:A schema can guarantee a field is numeric without guaranteeing that extracted values are financially consistent.
Incorrect Answers
B:Assumed JSON parsing can obscure the real transport failure; protocol metadata must be validated first; the effect concerns defensive HTTP content parsing; the success condition is semantic business validation.
C:Generation and network success do not remove the need to handle malformed or semantically invalid data safely; because robust typed output parsing is its concern, semantic business validation remains outside its effect here.
D:The output is untrusted data even if generated by Claude; parameter binding prevents injection through constructed SQL syntax; this implements safe persistence of generated data rather than the demanded semantic business validation.
Question 138
A feature branch adds a new tool that reads cloud storage. What integration test most closely matches the real failure risk?
- Resubmit transient failures with backoff, jitter, and an overall attempt limit.
- Apply a bounded worker queue with backpressure and rate-limit awareness.
- Exercise authentication, permission denial, and representative storage responses in a controlled environment.
- Partition environment credentials and grant each only required access.
- Log status, correlation ID, latency, and safe error classification without secrets.
Explanation
Correct Answer
C:Tool behavior depends on external credentials and data contracts, which pure prompt tests cannot cover. Exercise denied access and missing-object cases, not just a successful read using a privileged developer account.
Incorrect Answers
A:Temporary service errors often recover; spreading and bounding retries reduces synchronized bursts and runaway latency; the effect concerns transient service retry strategy; the success condition is external service integration coverage.
B:Concurrency improves throughput only until it overwhelms quotas or dependencies; queueing provides controlled resource use; a remedy for scalable request queueing is not a substitute for external service integration coverage.
D:Environment isolation limits accidental production effects from tests and makes revocation less disruptive; it improves environment-scoped credentials only, leaving external service integration coverage unproven.
E:Structured metadata supports incident triage and vendor support while avoiding accidental logging of sensitive prompts or keys; for external service integration coverage, this instead manages safe API error telemetry; the requested decision remains unresolved.
Question 139
A staging deployment accidentally reaches a production-only Claude integration because its CI job can read production secrets. Which pipeline boundary is missing?
- Restrict secret injection by protected deployment environment and authorized CI identity.
- Change the prompt to say that staging requests should not touch production.
- Add a new model temperature default to every staging request.
- Publish the production API key in a shared staging configuration file for easier debugging.
Explanation
Correct Answer
A:A staging job should receive only credentials and network access intended for staging. Protected environments and workload-specific secret bindings stop the pipeline from borrowing production authority even if configuration is misrouted.
Incorrect Answers
B:Natural-language instructions cannot prevent a process already holding production credentials from using them. The pipeline must enforce the boundary before application code or model calls run.
C:Sampling configuration affects generated responses, not which credentials the CI runner can access. The environment mistake remains possible until secret and deployment permissions are separated.
D:Copying the sensitive key into a lower-trust environment enlarges the blast radius and makes accidental production access more likely. Access must be narrowed rather than duplicated.
Question 140
A fetch tool blocks private network addresses in the original URL but follows redirects unchecked. Attackers supply a public URL that redirects to an internal metadata endpoint. What fix is required?
- Validate only the first host name because subsequent redirects are issued by the HTTP library.
- Revalidate every redirected destination and its resolved network address before each outbound request.
- Increase the tool timeout to allow more redirect hops.
- Ask Claude to ignore instructions inside the fetched page after the request has completed.
Explanation
Correct Answer
B:A safe-looking initial URL can redirect or resolve to a forbidden address. Apply network egress policy at every hop, including redirect targets, so the tool cannot traverse into private metadata or internal services.
Incorrect Answers
A:Redirect handling does not inherit security approval from the original destination. An attacker can use a trusted-looking public endpoint to redirect the fetch into restricted address space.
C:A longer timeout may make the exploit more reliable without restricting destinations. The required control is validation and egress filtering on each hop, not additional execution time.
D:Prompt-injection guidance does not stop the network connection itself. The SSRF threat occurs during URL resolution and HTTP transport, before the page text reaches the model.