Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Parse JSON Configs for Insecure Defaults
00:00
5 left

Parse JSON Configs for Insecure Defaults

HardPython

Problem

PayPal Checkout configuration is represented as nested JSON objects and arrays. Given a configuration and a set of security rules, find every configured path whose value matches an insecure default.

Each rule uses a dotted path, such as checkout.security.tls_enabled, and maps to a list of insecure JSON values. A path segment containing * matches exactly one object key or array index, allowing a rule such as merchants.*.logging.debug to apply to every merchant. Return findings sorted lexicographically by their concrete dotted path.

Formal Specification

Implement detect_insecure_defaults(config, rules).

  • config is a JSON-compatible Python value composed of dictionaries, lists, strings, numbers, booleans, and None.
  • rules is a dictionary mapping dotted rule paths to lists of insecure JSON values.
  • The result is a list of dictionaries with keys path and value.
  • Report a finding when a rule matches a concrete path and its value equals one of that rule's insecure values.
  • Traverse nested objects and arrays. Array indices are path segments such as 0.

Constraints

  • 1 <= total JSON nodes <= 10^4
  • 1 <= len(rules) <= 10^3
  • Maximum nesting depth is 100
  • Rule paths are non-empty and use '.' as the separator
  • Each wildcard matches exactly one path segment

Function Signature

def detect_insecure_defaults(config, rules):
Interviewer

Your question is Parse JSON Configs for Insecure Defaults. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePython 3
Sign up free to run your codeLog inLn 2
Run your code to see test output here.