Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • Getting Started with AI for VLSI Engineers5
  • Just Enough AI: Models and Context15
  • Prompting13
  • Trust and Verification14
  • Using AI for Engineering Work17
    • RTL and Testbench Assistance
    • Debugging with AI
    • Scripts and Automation
    • Data, Privacy and IP
      • What Never to Paste
      • Policy and Approved Tools
      • Sanitise Before Sharing
      • Local Tools, Hosted Tools, and Security Review
  • Engineering Walkthroughs7
  • Practical Foundations for AI Workflows4
  • Engineering Data5
  • Retrieval-Augmented Generation6
  • Agents and Tool Use18
  • Agent Design8
  • MCP and Skills6
  • Multi-Agent Design6
  • Practical Capstone6
  • Tokens, Cost and Latency12
  • Agentic Workflows for Chip Teams18
  • Interview and Judgment10
  • AI Skills: Full Course Index
  • Working with AI Glossary
  • Working with AI Cheatsheet
Loading lesson

‹Data, Privacy and IP
  1. Topics
  2. AI Skills for VLSI Engineers
  3. Using AI for Engineering Work
  4. Data, Privacy and IP
  5. Sanitise Before Sharing

Everyday Engineering Assistance · Beginner to Intermediate

Sanitise Before Sharing

An illustrative regex redactor with fixed fixture checks, not a proof of safe sharing.

On this page

    What redaction covers

    Redaction replaces sensitive values with markers before anything is shared. Structure stays so the question remains answerable.

    Use unmistakable markers and remove sensitive values from the shared artifact. Replacement alone does not prove irreversibility: surrounding context, copies, encodings, and missed formats may retain information. Redaction does not change the sharing rules automatically.

    Class

    Marker

    Sample count

    Credential assignments

    [REDACTED]

    2

    Bearer tokens

    Bearer [REDACTED]

    2

    Email addresses

    [REDACTED-EMAIL]

    2

    Internal hostnames

    [REDACTED-HOST]

    2

    A small redactor

    The illustrative program below checks eight planted synthetic items plus one clean line. Its expected summary describes these fixtures only; no execution is claimed here. Regex patterns can miss multiline or encoded values, other field names, paths, IP addresses, and design information. Do not use this snippet as a production disclosure gate.

    example.py
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    import re
    import sys
    
    CRED = re.compile(r"(?i)\b(password|passwd|api[_-]?key|secret)\s*[:=]\s*(\"[^\"]*\"|'[^']*'|\S+)")
    BEARER = re.compile(r"Bearer\s+[A-Za-z0-9._~-]+")
    HOST = re.compile(r"\b[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.(internal|corp)(?![A-Za-z0-9-])")
    EMAIL = re.compile(r"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}")
    
    SAMPLES = [
        'password = \"s3cr3t-demo-001\"',
        "api_key: 'demo-key-002'",
        "Authorization: Bearer alpha-003",
        "Authorization: Bearer beta-004",
        "contact alice@example-team.test",
        "cc bob@example-team.test",
        "ssh build-07.internal",
        "nfs sim-03.corp",
    ]
    
    SECRETS = [
        "s3cr3t-demo-001",
        "demo-key-002",
        "alpha-003",
        "beta-004",
        "alice@example-team.test",
        "bob@example-team.test",
        "build-07.internal",
        "sim-03.corp",
    ]
    
    def redact(line):
        total = 0
        line, n = CRED.subn(r"\1=[REDACTED]", line)
        total += n
        line, n = BEARER.subn("Bearer [REDACTED]", line)
        total += n
        line, n = HOST.subn("[REDACTED-HOST]", line)
        total += n
        line, n = EMAIL.subn("[REDACTED-EMAIL]", line)
        total += n
        return line, total
    
    def main():
        total = 0
        for i, s in enumerate(SAMPLES):
            out, n = redact(s)
            total += n
            if n != 1:
                print("FAIL: case " + str(i) + " redaction count is " + str(n))
                return 1
            if "[REDACTED" not in out:
                print("FAIL: case " + str(i) + " marker absent")
                return 1
            if SECRETS[i] in out:
                print("FAIL: case " + str(i) + " secret still present")
                return 1
        if total != 8:
            print("FAIL: total count is " + str(total))
            return 1
        clean, n = redact("build passed with 0 warnings")
        if n != 0 or clean != "build passed with 0 warnings":
            print("FAIL: clean line changed")
            return 1
        print("PASS: fixture checks only; masked 8 planted items and left 1 clean line unchanged; sharing permission not established")
        return 0
    
    sys.exit(main())

    Expected fixture counts

    Each class contributes two planted items. The arithmetic below describes expected matches in these fixed fixtures, not measured detection coverage on real logs or proof that an export is permitted.

    plaintext
    1
    2
    3
    4
    5
    6
    7
    8
    planted items = 2 + 2 + 2 + 2 = 8
    credential share = 2 / 8 = 25%
    bearer share = 2 / 8 = 25%
    email share = 2 / 8 = 25%
    host share = 2 / 8 = 25%
    sum = 25 + 25 + 25 + 25 = 100%
    expected fixture matches = 8 / 8 = 100%, plus 1 clean line with 0 replacements
    real-log recall and disclosure risk are not measured by these fixtures

    Common mistakes

    Common pitfall

    Unmatched content can pass through silently. Add representative fixtures and inspect the remaining content, but do not treat passing fixtures or manual review as permission to share. Confirm the approved data flow independently.

    Interview

    Likely probes: what the fixture checks cover and what they miss.

    • The code checks eight planted items across four classes plus one clean line; no run is reported here.

    • Order matters: this snippet processes hosts before emails, which can fragment an email containing a matching internal host. These fixtures do not exercise that interaction.

    • A new format with no matching pattern is a silent pass-through.

    Check yourself The redactor reports 8 replacements on the sample. A new log format reports 7 on eight known sensitive items. What can you conclude?

    The count does not establish successful redaction. Inspect every known item and the remaining content: matches can miss, overlap, or affect clean text. Extend the fixtures and patterns as appropriate, then separately confirm sharing permission.

    Check yourself Why does the program check that the clean line is unchanged?

    It catches false replacements on that one fixture. It does not prove that other clean text is preserved or that all sensitive content is removed.

    Related topics

    • What never to paste

    • Debugging with AI

    Previous

    63 / 173

    Next: Local Tools, Hosted Tools, and Security Review

    Up next

    Up nextLocal Tools, Hosted Tools, and Security Review

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • What Never to Paste