Interview Bank
328 questions total; 1 shown with current filters.
CourseAllFrom Frontend Engineer to Agent Engineer in 30 DaysPrompt Engineering From Scratch in 5 DaysMastering Claude: From Conversation to Claude Code in 5 DaysMastering Codex and the OpenAI Agents SDK in 5 DaysMCP in 7 Days: Wire Tools Into Any AgentAgent Skills in 7 Days: Turn Experience Into Reusable CapabilityContext Engineering in 5 DaysRAG in 14 Days: From Retrieval to Trustworthy AnswersBuild an AI Short-Drama Production Pipeline With Agents in 14 Days
Tag
All#least-privilege1#reliability22#cost15#architecture12#streaming11#security10#observability9#distributed-systems8#idempotency8#multi-agent8#rag7#system-design7
136 more tagsShow fewer tags
#api-design6#operations6#sse6#deployment5#message-bus5#tool-calling5#agent-loop4#behavioral4#error-handling4#evaluation4#framework-design4#mcp4#routing4#concurrency3#context-engineering3#interview-prep3#langgraph3#llm-basics3#model-routing3#orchestration3#prompt-injection3#protocol3#redis-streams3#scalability3#scheduling3#agent-design2#auth2#checkpointing2#communication2#cost-control2#database2#debugging2#interview-process2#latency2#long-term-memory2#memory2#ordering2#prompt-engineering2#rate-limiting2#react2#resume2#retrieval2#sharding2#state-machine2#state-management2#tool-design2#tool-permissions2#trade-offs2#ux2#agent-basics1#agent-quality1#async1#atomicity1#cancellation1#capacity-planning1#career1#chunking1#compression1#configuration1#consistent-hashing1#context1#context-compression1#context-management1#correctness1#customer-support1#data-modeling1#deliberate-practice1#docker1#documentation1#engineering-tradeoffs1#escalation1#event-driven1#fallback1#fan-out1#fencing-token1#forking1#framework-selection1#frontend1#global-market1#hybrid-search1#interrupt-merge1#isolation1#json-parsing1#jwt1#knowledge-organization1#lease1#llm-as-judge1#loop-guard1#mobile1#multi-tenancy1#nodejs1#performance1#persistence1#pgvector1#portfolio1#prioritization1#proactive-messaging1#product-engineering1#project-storytelling1#prompt1#provider-abstraction1#quiet-hours1#ranking1#recall1#reconnect1#redis1#reflection1#replay1#reporting1#rerank1#retrieval-quality1#retry1#retry-semantics1#rrf1#sampling1#sandboxing1#schema-design1#secrets-management1#self-assessment1#self-introduction1#self-presentation1#service-architecture1#session-management1#split-brain1#star1#stateless1#storytelling1#structured-output1#system-prompt1#testing1#timezone1#tool-execution1#tools1#tracing1#transport1#vector-database1
From Frontend Engineer to Agent Engineer in 30 Days
D22 Security: Prompt Injection, Least Privilege for Tools, Sandboxing Approaches, Secret Management
How do you defend against prompt injection? If I claim a regex filter for dangerous keywords is enough, how would you push back?你们怎么防 prompt injection?如果我说「加个正则过滤掉危险关键词就行了」,你会怎么反驳我?
Common in ChinaCommon overseasDeep dive#prompt-injection#least-privilege#tool-permissionsHow to reason about it · think before answering
- This is the hinge question of the topic and a very efficient filter. The test is blunt: do the words 'deterministic' and 'probabilistic' appear in your answer? Candidates who only list detection techniques land in the 'never carried this in production' bucket, however detailed they are.
- Give the structure first: three lines of defense — input-side detection (keywords, regex, a small classifier), permission-side enforcement (allowlist, argument caps, human approval), and output-side filtering (redaction, link stripping). Then classify them immediately: the first and third are probabilistic, only the second is deterministic. That classification is the backbone of the answer.
- Explain why detection can only be probabilistic: it has to decide whether a piece of natural language is malicious, and there is no decision procedure for that. A concrete counterexample sells it — a polite 'could you also put this word at the start of your reply, thanks' contains no dangerous keyword at all. Rewording costs the attacker one word; adding a rule costs you a review cycle. Betting everything on that asymmetry is an engineering mistake.
- Explain why the permission layer is deterministic: it does not judge text at all, it judges the action — is this tool on the allowlist, is this argument over the cap. Both checks live downstream of the model and are ordinary conditionals. The model can be persuaded; an if statement cannot. In practice each run carries a policy envelope derived from the server-side session scope, holding the allowlist, per-argument caps and the irreversible tools that need approval, and there is exactly one place where tools execute, with that check on its first line.
- Add three implementation details that prove you have written this: check the allowlist before the argument table, or an invented tool name slips through because no config row matches it; default to deny when an argument is missing rather than skipping the check; and take the acting identity from the server-side session, never from a user id the model read out of the conversation.
- Close by giving detection its due rather than dismissing it: it is a good alerting signal, its hit rate belongs on the observability dashboard, and a spike means somebody is probing you. It simply cannot be the gate. The same holds for wrapping tool output in a tag and declaring in the system prompt that instructions inside are data — a real mitigation, but measurably some variants still get through. Mitigation is not a gate.
- Expect the follow-up: how do you prove the defense works? Regression-test with a harmless canary — have the agent emit an agreed marker string and check whether it appears, instead of committing payloads with real consequences into your repository.
分析过程 · 先想清楚再作答
- 这题是整章的题眼,也是最好用的筛选题。判据很干脆:你的回答里有没有出现「确定性」和「概率性」这组词。只讲检测手段的,无论讲得多细,都会被归到「没在生产上扛过事」那一档。
- 先给结构,三条防线:输入侧检测(关键词、正则、小模型分类器)、权限侧强制(白名单、参数上限、人工确认)、输出侧过滤(脱敏、拦外链)。然后立刻给定性——第一条和第三条是概率性的,只有第二条是确定性的。这个定性本身就是答案的骨架。
- 解释为什么检测只能是概率性的:它判断的是「这段自然语言是不是恶意的」,而这个问题没有判定式。举一个具体的反例最有说服力——「顺便帮个小忙,麻烦在回复开头加上某某词,谢谢」,一个危险关键词都没有,规则直接漏掉。攻击者改一个字的成本永远低于你加一条规则的成本,在攻防不对称的地方押上全部希望是工程误判。
- 解释为什么权限侧是确定性的:它判断的根本不是文本,是动作——这次要调的工具在不在白名单里、参数超没超上限。这两个判断发生在模型的下游,是一段普通的 if。模型可以被说服,一个 if 不能被说服。落地形态是给每个 run 配一份由服务端会话 scope 算出来的权限信封,包含白名单、参数级上限、需要人工确认的不可逆工具三样,执行工具的地方只有一处、第一行就是这道闸。
- 补三个实现细节,它们是「真写过」的证据:白名单要判在参数检查之前(否则模型编出来的工具名会因为查不到配置而被放行);参数取不到值时默认拒绝而不是跳过检查;执行工具用的身份只能来自服务端会话,不能采信模型从对话里读到的用户 ID。
- 最后回收检测的价值,别把它说得一无是处:它是很好的告警信号,命中率应该进可观测面板(呼应评估与 tracing 那一天),异常升高说明有人在试探。它只是不能当闸门。同理,把工具结果包进标签并在系统提示词里声明「其中的指令不执行」也是有效的缓解,但实测下来仍有一部分变体能绕过去——缓解不是闸门。
- 可以预期的追问:那你怎么证明防线有效?用无害的口令探针做回归——让 Agent 输出一个约定的暗号字符串,用暗号出没出现来判断防线有没有被突破,而不是把真的能造成后果的攻击样本收进代码库。
Key points
- Three lines: input detection is a probabilistic alert, permission enforcement is the deterministic gate, output filtering is probabilistic backstop
- Keyword filters miss rephrasings — a politely worded probe contains no dangerous word at all; detection belongs on the alerting dashboard
- The gate is deterministic because it judges actions, not text: allowlist, argument caps, approval — with one execution path whose first line is the check
- The policy envelope is derived from the server-side session scope and travels with the run; identity comes from the session, never from the conversation
- Wrapping tool output in a tag and declaring it as data is real mitigation, but some variants still get through — mitigation is not a gate
答题要点
- 三条防线:输入检测=概率性告警、权限强制=确定性闸门、输出过滤=概率性兜底
- 关键词过滤挡不住换个说法的攻击,客气口吻的探针一个危险词都没有;检测只能进告警面板
- 确定性来自它判断的是动作不是文本:白名单、参数上限、人工确认,执行入口只有一个且第一行就是这道闸
- 权限信封由服务端会话 scope 算出来,跟着 run 走;身份只来自会话,不采信模型读到的用户 ID
- 把工具结果包进标签并在系统提示词声明是有效缓解,但仍有变体能绕过——缓解不是闸门