Courseiva
AI SecurityhardMultiple ChoiceObjective-mapped

AI0-001 AI Security Practice Question

A developer is integrating an LLM API into a customer-facing application. They want to prevent unauthorized third parties from using the API key. Which of the following is the BEST approach?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Use environment variables to store the API key and implement least-privilege access controls on the server side

Using environment variables (or secrets management) and enforcing least-privilege API access, combined with key rotation, is the best practice. Hardcoding is insecure, rate limiting doesn't prevent key theft, and client-side embedding exposes the key.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Embed the API key in the client-side JavaScript and rely on CORS policies

    Why it's wrong here

    Client-side embedding exposes the key to anyone; CORS is not a security mechanism for keys.

  • Store the API key in the application's source code and use version control to track changes

    Why it's wrong here

    Hardcoding keys in source code is insecure; they can be exposed in version control.

  • Apply rate limiting to the API endpoint to prevent excessive usage

    Why it's wrong here

    Rate limiting limits usage but does not prevent key theft.

  • Use environment variables to store the API key and implement least-privilege access controls on the server side

    Why this is correct

    Environment variables keep keys out of code, and least-privilege limits exposure.

About these practice questions

This AI0-001 question is part of Courseiva's 754-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AI0-001 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AI0-001 exam.