Skip to content

Harden URL trust checks and TLS discovery - #216

Merged
sodejm merged 5 commits into
mainfrom
copilot/fix-code-scanning-alerts
Oct 6, 2026
Merged

sodejm merged 5 commits into
mainfrom
copilot/fix-code-scanning-alerts

Conversation

Copilot AI commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Code scanning flagged unsafe URL-authority checks, ARM template detection, and deprecated TLS negotiation. References now require HTTPS and an exact trusted hostname, ARM detection parses the declared schema, and live probes require TLS 1.2 or newer.

Review of the failing checks also found an inherited repository-wide Ruff baseline failure and a YAML description warning. This change repairs that baseline, regenerates synchronized skill adapters and portable evidence, and documents narrowly justified lint exceptions. Public string enum behavior is preserved.

Security and failure-handling corrections reject XML entities before parsing, propagate approval-storage failures rather than silently proceeding, retain cleanup residual failures, and report malformed or timezone-naive certificate expiry as uncertainty. Regression tests cover these behaviors and malicious hostname lookalikes.

Validation: full make check, Ruff, YAML lint, and whitespace checks run in the isolated review checkout. Hosted CI must pass on the final head before merge.

Alert review: the remaining apparent credential/hash findings use synthetic fixtures, content-integrity hashes, or redacted structured scanner output. The Foundry string assertion and SAN list-membership assertion do not implement URL trust decisions. Certificate probing deliberately inspects untrusted certificates and does not transmit application credentials. These observations do not establish a broader security assessment.

Workflow corrections update checkout to v7 and quote the issue-number argument; push and PR lint both pass. CodeQL alerts 1 and 3 were reviewed and dismissed as false positives with source-specific evidence: a public Azure permission identifier and a temporary synthetic redaction-test credential. All other security analysis remains enabled.

@sodejm
sodejm marked this pull request as ready for review October 6, 2026 01:26
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T01:52:13.492452Z 295bd83 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Co-authored-by: sodejm <723679+sodejm@users.noreply.github.com>
Copilot AI requested a review from sodejm as a code owner October 6, 2026 01:31
Copilot AI changed the title [WIP] Fix code scanning alerts flagged in the repository Harden URL trust checks and TLS discovery Oct 6, 2026
@sodejm
sodejm merged commit ad1c9bb into main Oct 6, 2026
18 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 295bd83d07

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

results["iac_and_cloud"].append("Oracle Cloud")
except Exception:
pass
except (ValueError, TypeError):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Validate package.json shape before dereferencing it

When a repository contains syntactically valid JSON with a non-object top level (for example, []), json.loads succeeds but data.get(...) raises AttributeError, which the narrowed handler does not catch. This aborts the entire repository security scan instead of merely omitting dependency evidence; validate that data is a mapping before accessing dependencies.

Useful? React with 👍 / 👎.

pass
except (ValueError, TypeError):
# Malformed manifests provide no dependable dependency evidence.
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Continue scanning malformed manifests for secrets

When package.json contains invalid JSON, this continue skips all remaining per-file processing, including the credential-pattern scan below. A malformed manifest containing a plaintext secret therefore produces no secrets_findings; the parse failure should suppress only dependency extraction and still allow the generic content checks to run.

Useful? React with 👍 / 👎.

confidence = ConfidenceLevel.UNCERTAIN.value
except Exception:
pass
except (TypeError, ValueError):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat non-string certificate expiry as uncertainty

When imported or synthetic TLS evidence supplies a truthy non-string valid_until value, such as an integer, the preceding .replace(...) raises AttributeError, which this narrowed handler misses. Fingerprinting then aborts rather than recording malformed expiry as uncertainty, so validate the field type or catch this failure alongside the existing parse errors.

AGENTS.md reference: AGENTS.md:L94-L98

Useful? React with 👍 / 👎.

Comment thread scripts/agent/doctor.py
Comment on lines +1 to 3
# Repository path setup precedes standalone entry point imports.
# ruff: noqa: E402
#!/usr/bin/env python3

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the executable shebang as the first line

When this mode-100755 script is invoked directly on Unix, the kernel no longer recognizes it as Python because the shebang is preceded by two comments; the shell consequently attempts to interpret the Python source and exits with syntax errors. Keep #!/usr/bin/env python3 on line 1 and place the Ruff directive after it.

Useful? React with 👍 / 👎.


def _is_arm_template(content):
try:
document = json.loads(content)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Contain deeply nested JSON classification failures

When any scanned .json file contains sufficiently deep nesting, still well below the 1 MB file limit, json.loads raises RecursionError, which this handler does not catch and therefore aborts the entire repository scan. Treat parser depth exhaustion as non-ARM input or apply a bounded-depth parser so an untrusted repository file cannot deny the scanner and its CI secret-scan fallback.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants