microsoft / microsoft/cask

Author simplified regex for Cask keys, for readability and scenarios that already depend on post-processing

Open
#57 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6
Forks
6
Avg merge
8d 10h
Merged PRs (30d)
4

Description

The current regex is fairly comprehensive in terms of flagging valid Cask keys only. Recent changes to component ordering allows the regex to ensure conformance between specified secret and optional data sizes and the actual length of the key.

This accuracy and comprehensiveness comes at the expensive of key length and readability. This complex regex also does not handle certain invalid year/month/day combinations (described in #56).

We should author and, minimally, document a simplified regex that does not concern itself with invalid length corner cases, inconsistent data sizer, and invalid expressed timestamps related to differences in the # of days for a specific month.

The text above assumes that performance of our complex regex exceeds the costs of running a simpler regex and performing a subsequent post-processing to verify the key is valid. If benchmarking demonstrates that our complex regex is not performant, we should invert the plan (i.e., utilize the simple regex in code and document the more complex form, which could be useful in situations where detection is enabled solely by pattern matching, i.e., with no API support).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the current comprehensive Cask-key regex, its validation tests, and the post-processing path; review the invalid date cases described in #56. Benchmark the existing and simplified approaches, then document the chosen regex and ensure validation still covers size consistency, key length, and invalid calendar dates.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
security
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.