Repository challenges
Enforce tool permissions
Security · Intermediate · AI engineering · 35 minutes
Engineering ticket
Implement authorize(calls, allowed). Each call is a dictionary with a string tool name and arbitrary args. Return allowed tool names, in call order, including duplicates. Names must exactly match an allowed string. Missing, non-string, or unknown names are denied. Never execute the calls or evaluate their args.
Review rubric
- Correctness on documented inputs
- Tests and edge cases
- Clear explanation of trade-offs
Reading the ticket and starter files is public. Sign in to save edits, run tests and submit evidence. Code-review quality requires human review.
Starter repository
README.md
# InferenceAI engineering lab Read the ticket, inspect the files, reproduce the issue and implement the contract. Run visible tests while working. Submit checks protected cases. Explain your changes and limitations.
policy.py
def authorize(calls, allowed):
return [call.get("tool") for call in calls]
tests/test_policy.py
import unittest
from policy import *
class ContractTest(unittest.TestCase):
def test_example(self):
self.assertEqual(authorize([{"tool":"read"},{"tool":"shell"}], ["read"]), ["read"])