Katkat

Explain AWS access control and frontend typing

BoeingSoftware Engineer · Technical Screen

Last updated

This question tests fundamental knowledge of cloud security primitives in AWS and modern frontend development patterns, specifically focusing on secure data access and robust TypeScript architecture.

Part 1: Cloud Security

Your application runs on AWS and needs to allow users to upload files directly to an S3 bucket from their browser without exposing secret access keys or making the bucket public. Explain how you would implement this using AWS services. What specific IAM configuration would you provide to the application server to enable this?

Part 2: TypeScript & React

Consider the following React component and TypeScript interface:

interface UserProfile {
  id: string;
  email: string;
  isAdmin: boolean;
}

function UserCard({ user }: { user: UserProfile }) {
  return {user.email};
}
  1. Explain the difference between structural typing (as used in TypeScript) and nominal typing (as used in languages like Java). How does this affect how you pass objects into UserCard?
  2. You are using useEffect to fetch user data. What are the common pitfalls regarding memory leaks and state updates when a component unmounts before an API request completes? Provide a pattern to solve this.

Hints

Hint 1

For the S3 problem, look into the concept of 'Pre-signed URLs' and how temporary security tokens are generated.

Hint 2

Remember that TypeScript checks if an object has the required properties regardless of its declared type name, whereas nominal languages require an explicit inheritance or implementation relationship.

Hint 3

For React, focus on the 'cleanup' function in useEffect to abort API requests or track the component's mounted status using a boolean flag.

Follow-up questions

  • How would you enforce stricter object validation at runtime if you cannot trust the shape of the data coming from an API?
  • If an S3 upload needs to happen across multiple geographical regions, what AWS features would you consider to optimize latency and reliability?
  • How does the concept of 'Least Privilege' apply specifically to the IAM policy you designed for the S3 bucket access?