glh123456/OmniGIRL huggingface dataset:
Repository: tailwindlabs/tailwindcss (TypeScript)

Issue:
Arbitrary `content-['hello']` utilities not recognized when using a prefix like `tw-`
<!-- Please provide all of the information requested below. We're a small team and without all of this information it's not possible for us to help and your bug report will be closed. -->

**What version of Tailwind CSS are you using?**

v3.1.2

**What browser are you using?**

Chrome

**Reproduction URL**

https://play.tailwindcss.com/cjDwL0ojUE



Hints:
Thanks for reporting! Looks like this only happens when using a prefix, will get it figured out 👍

Patch:
diff --git a/src/lib/defaultExtractor.js b/src/lib/defaultExtractor.js
--- a/src/lib/defaultExtractor.js
+++ b/src/lib/defaultExtractor.js
@@ -37,7 +37,7 @@ function* buildRegExps(context) {
         regex.any([
           regex.pattern([
             // Arbitrary values
-            /-\[[^\s:]+\]/,
+            /-(?:\w+-)*\[[^\s:]+\]/,
 
             // Not immediately followed by an `{[(`
             /(?![{([]])/,
@@ -48,7 +48,7 @@ function* buildRegExps(context) {
 
           regex.pattern([
             // Arbitrary values
-            /-\[[^\s]+\]/,
+            /-(?:\w+-)*\[[^\s]+\]/,
 
             // Not immediately followed by an `{[(`
             /(?![{([]])/,


Test patch:
diff --git a/tests/default-extractor.test.js b/tests/default-extractor.test.js
--- a/tests/default-extractor.test.js
+++ b/tests/default-extractor.test.js
@@ -468,3 +468,11 @@ test('classes in slim templates', async () => {
   expect(extractions).toContain('italic')
   expect(extractions).toContain('text-gray-500')
 })
+
+test('multi-word + arbitrary values + quotes', async () => {
+  const extractions = defaultExtractor(`
+    grid-cols-['repeat(2)']
+  `)
+
+  expect(extractions).toContain(`grid-cols-['repeat(2)']`)
+})
Repository: tailwindlabs/tailwindcss (TypeScript)

Issue:
theme() with css variable colors doesn't work in .css files
<!-- Please provide all of the information requested below. We're a small team and without all of this information it's not possible for us to help and your bug report will be closed. -->

**What version of Tailwind CSS are you using?**

v3.1.3

**What build tool (or framework if it abstracts the build tool) are you using?**

postcss 8.4.14

**What version of Node.js are you using?**

v16.13.1

**What browser are you using?**

Chrome

**What operating system are you using?**

macOS

**Reproduction URL**

https://play.tailwindcss.com/eoS0xJO1cm

**Describe your issue**

If you use css variable for colors, then `theme` doesn't work in `.css` files:

```
module.exports = {
  theme: {
    colors: {
      blue: 'rgb(var(--blue) / <alpha-value>)',
    },
  },
  plugins: [],
}
```

```
@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  --blue: 0 0 255;
}

.custom-class {
  color: theme("colors.blue");
}
```

Generated css:
```
.custom-class {
    color: rgb(var(--blue) / <alpha-value>);
}
```


Hints:

Patch:
diff --git a/src/lib/evaluateTailwindFunctions.js b/src/lib/evaluateTailwindFunctions.js
--- a/src/lib/evaluateTailwindFunctions.js
+++ b/src/lib/evaluateTailwindFunctions.js
@@ -183,9 +183,15 @@ export default function ({ tailwindConfig: config }) {
         throw node.error(error)
       }
 
-      if (alpha !== undefined) {
-        value = parseColorFormat(value)
-        value = withAlphaValue(value, alpha, value)
+      let maybeColor = parseColorFormat(value)
+      let isColorFunction = maybeColor !== undefined && typeof maybeColor === 'function'
+
+      if (alpha !== undefined || isColorFunction) {
+        if (alpha === undefined) {
+          alpha = 1.0
+        }
+
+        value = withAlphaValue(maybeColor, alpha, maybeColor)
       }
 
       return value


Test patch:
diff --git a/tests/evaluateTailwindFunctions.test.js b/tests/evaluateTailwindFunctions.test.js
--- a/tests/evaluateTailwindFunctions.test.js
+++ b/tests/evaluateTailwindFunctions.test.js
@@ -1025,6 +1025,36 @@ test('Theme function can extract alpha values for colors (8)', () => {
   })
 })
 
+test('Theme functions replace the alpha value placeholder even with no alpha provided', () => {
+  let input = css`
+    .foo {
+      background: theme(colors.blue.400);
+      color: theme(colors.blue.500);
+    }
+  `
+
+  let output = css`
+    .foo {
+      background: rgb(0 0 255 / 1);
+      color: rgb(var(--foo) / 1);
+    }
+  `
+
+  return runFull(input, {
+    theme: {
+      colors: {
+        blue: {
+          400: 'rgb(0 0 255 / <alpha-value>)',
+          500: 'rgb(var(--foo) / <alpha-value>)',
+        },
+      },
+    },
+  }).then((result) => {
+    expect(result.css).toMatchCss(output)
+    expect(result.warnings().length).toBe(0)
+  })
+})
+
 test('Theme functions can reference values with slashes in brackets', () => {
   let input = css`
     .foo1 {
Repository: tailwindlabs/tailwindcss (TypeScript)

Issue:
Not possible to set ring color with `future.respectDefaultRingColorOpacity` enabled
<!-- Please provide all of the information requested below. We're a small team and without all of this information it's not possible for us to help and your bug report will be closed. -->

**What version of Tailwind CSS are you using?**

v3.1.7

**What build tool (or framework if it abstracts the build tool) are you using?**

n/a

**What version of Node.js are you using?**

n/a

**What browser are you using?**

Chrome

**What operating system are you using?**

macOS

**Reproduction URL**

https://play.tailwindcss.com/N1ko1lZjzn?file=config

**Describe your issue**

When `future.respectDefaultRingColorOpacity` is set to `true` in Tailwind config, I can't set ring colors like `ring-gray-500` anymore. The respective class is not created by the Tailwind compiler.

Related: https://github.com/tailwindlabs/tailwindcss/issues/9016#issuecomment-1210378693


Hints:

Patch:
diff --git a/src/util/getAllConfigs.js b/src/util/getAllConfigs.js
--- a/src/util/getAllConfigs.js
+++ b/src/util/getAllConfigs.js
@@ -11,9 +11,10 @@ export default function getAllConfigs(config) {
     // Add experimental configs here...
     respectDefaultRingColorOpacity: {
       theme: {
-        ringColor: {
+        ringColor: ({ theme }) => ({
           DEFAULT: '#3b82f67f',
-        },
+          ...theme('colors'),
+        }),
       },
     },
   }


Test patch:
diff --git a/tests/basic-usage.test.js b/tests/basic-usage.test.js
--- a/tests/basic-usage.test.js
+++ b/tests/basic-usage.test.js
@@ -661,3 +661,31 @@ it('A bare ring-opacity utility is supported when using respectDefaultRingColorO
     `)
   })
 })
+
+it('Ring color utilities are generated when using respectDefaultRingColorOpacity', () => {
+  let config = {
+    future: { respectDefaultRingColorOpacity: true },
+    content: [{ raw: html`<div class="ring ring-blue-500"></div>` }],
+    corePlugins: { preflight: false },
+  }
+
+  let input = css`
+    @tailwind utilities;
+  `
+
+  return run(input, config).then((result) => {
+    expect(result.css).toMatchFormattedCss(css`
+      .ring {
+        --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width)
+          var(--tw-ring-offset-color);
+        --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width))
+          var(--tw-ring-color);
+        box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
+      }
+      .ring-blue-500 {
+        --tw-ring-opacity: 1;
+        --tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity));
+      }
+    `)
+  })
+})
Repository: pyca/cryptography (Python)

Issue:
PrecertPoison ExtensionOID  has no name
In cryptography 2.6.1, the PrecertPoison extension has no name defined:

```
>>> import cryptography
>>> cryptography.__version__
'2.6.1'
>>> from cryptography.x509.oid import ExtensionOID
>>> ExtensionOID.KEY_USAGE
<ObjectIdentifier(oid=2.5.29.15, name=keyUsage)>
>>> ExtensionOID.PRECERT_POISON
<ObjectIdentifier(oid=1.3.6.1.4.1.11129.2.4.3, name=Unknown OID)>
```


Hints:
We should add that to `x509.oid._OID_NAMES`. Are you aware of a camelCase style name? I don't see one in the typical OID registries. Hooray non-canonical friendly names...
> Are you aware of a camelCase style name?

If you mean if I'm aware of a standard that mandates these names: I'm not aware of any.

btw, maybe a good idea: write a test that loops over all `ExtensionOID` members and see if it's in `OID_NAMES`.

Patch:
diff --git a/src/cryptography/x509/oid.py b/src/cryptography/x509/oid.py
--- a/src/cryptography/x509/oid.py
+++ b/src/cryptography/x509/oid.py
@@ -196,6 +196,7 @@ class CertificatePoliciesOID(object):
     ExtensionOID.PRECERT_SIGNED_CERTIFICATE_TIMESTAMPS: (
         "signedCertificateTimestampList"
     ),
+    ExtensionOID.PRECERT_POISON: "ctPoison",
     CRLEntryExtensionOID.CRL_REASON: "cRLReason",
     CRLEntryExtensionOID.INVALIDITY_DATE: "invalidityDate",
     CRLEntryExtensionOID.CERTIFICATE_ISSUER: "certificateIssuer",


Test patch:
diff --git a/tests/x509/test_x509_ext.py b/tests/x509/test_x509_ext.py
--- a/tests/x509/test_x509_ext.py
+++ b/tests/x509/test_x509_ext.py
@@ -23,7 +23,7 @@
 from cryptography.x509.general_name import _lazy_import_idna
 from cryptography.x509.oid import (
     AuthorityInformationAccessOID, ExtendedKeyUsageOID, ExtensionOID,
-    NameOID, ObjectIdentifier
+    NameOID, ObjectIdentifier, _OID_NAMES
 )
 
 from .test_x509 import _load_cert
@@ -5215,3 +5215,10 @@ def test_hash(self):
         nonce3 = x509.OCSPNonce(b"1" * 5)
         assert hash(nonce1) == hash(nonce2)
         assert hash(nonce1) != hash(nonce3)
+
+
+def test_all_extension_oid_members_have_names_defined():
+    for oid in dir(ExtensionOID):
+        if oid[:2] == '__':
+            continue
+        assert getattr(ExtensionOID, oid) in _OID_NAMES
Repository: pyca/cryptography (Python)

Issue:
Implement env var for OpenSSL 1.0.1 support
As part of #4923 we need to add `CRYPTOGRAPHY_ALLOW_OPENSSL_101` and update CI to test using that.


Hints:

Patch:
diff --git a/src/cryptography/hazmat/bindings/openssl/binding.py b/src/cryptography/hazmat/bindings/openssl/binding.py
--- a/src/cryptography/hazmat/bindings/openssl/binding.py
+++ b/src/cryptography/hazmat/bindings/openssl/binding.py
@@ -5,6 +5,7 @@
 from __future__ import absolute_import, division, print_function
 
 import collections
+import os
 import threading
 import types
 import warnings
@@ -156,12 +157,19 @@ def _verify_openssl_version(lib):
         lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_102 and
         not lib.CRYPTOGRAPHY_IS_LIBRESSL
     ):
-        warnings.warn(
-            "OpenSSL version 1.0.1 is no longer supported by the OpenSSL "
-            "project, please upgrade. The next version of cryptography will "
-            "drop support for it.",
-            utils.CryptographyDeprecationWarning
-        )
+        if os.environ.get("CRYPTOGRAPHY_ALLOW_OPENSSL_101"):
+            warnings.warn(
+                "OpenSSL version 1.0.1 is no longer supported by the OpenSSL "
+                "project, please upgrade. The next version of cryptography "
+                "will completely remove support for it.",
+                utils.CryptographyDeprecationWarning
+            )
+        else:
+            raise RuntimeError(
+                "You are linking against OpenSSL 1.0.1, which is no longer "
+                "supported by the OpenSSL project. You need to upgrade to a "
+                "newer version of OpenSSL."
+            )
 
 
 def _verify_package_version(version):


Test patch:
diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py
--- a/tests/hazmat/bindings/test_openssl.py
+++ b/tests/hazmat/bindings/test_openssl.py
@@ -4,11 +4,14 @@
 
 from __future__ import absolute_import, division, print_function
 
+import pretend
+
 import pytest
 
 from cryptography.exceptions import InternalError
 from cryptography.hazmat.bindings.openssl.binding import (
-    Binding, _consume_errors, _openssl_assert, _verify_package_version
+    Binding, _consume_errors, _openssl_assert, _verify_openssl_version,
+    _verify_package_version
 )
 
 
@@ -122,3 +125,12 @@ def test_check_startup_errors_are_allowed(self):
     def test_version_mismatch(self):
         with pytest.raises(ImportError):
             _verify_package_version("nottherightversion")
+
+    def test_verify_openssl_version(self, monkeypatch):
+        monkeypatch.delenv("CRYPTOGRAPHY_ALLOW_OPENSSL_101", raising=False)
+        lib = pretend.stub(
+            CRYPTOGRAPHY_OPENSSL_LESS_THAN_102=True,
+            CRYPTOGRAPHY_IS_LIBRESSL=False
+        )
+        with pytest.raises(RuntimeError):
+            _verify_openssl_version(lib)
Repository: pyca/cryptography (Python)

Issue:
Doc mistake in example.
Example for extentions [here](https://cryptography.io/en/latest/x509/reference/#cryptography.x509.Certificate.extensions) contains errors:

` <Extension(oid=<ObjectIdentifier(oid=2.5.29.15, name=keyUsage)>, critical=True, value=<KeyUsage(digital_signature=False, content_commitment=False, key_encipherment=False, data_encipherment=False, key_agreement=False, key_cert_sign=True, crl_sign=True, encipher_only=None, decipher_only=None)>`

Last two parameters should also be False, as per documentation. Otherwise certificate creation fails. 


Hints:
This is perhaps a bit confusing but is not a bug in the docs. The `__repr__` shown there says None because in this case `encipher_only` and `decipher_only` have no meaning when `key_agreement` is not `True`. We represent this in the repr by saying `None`, but `None` is not allowed in the `__init__` of the class itself.

Since this is confusing and also causes a bug to manifest if you attempt to use this structure in certificate creation we should probably revisit this (and likely enforce boolean as well).
If the example is failing to build, then this example is wrong in my book, so please correct for the benefit of those who will try to use it in future.

Patch:
diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py
--- a/src/cryptography/x509/extensions.py
+++ b/src/cryptography/x509/extensions.py
@@ -1054,8 +1054,11 @@ def __repr__(self):
             encipher_only = self.encipher_only
             decipher_only = self.decipher_only
         except ValueError:
-            encipher_only = None
-            decipher_only = None
+            # Users found None confusing because even though encipher/decipher
+            # have no meaning unless key_agreement is true, to construct an
+            # instance of the class you still need to pass False.
+            encipher_only = False
+            decipher_only = False
 
         return ("<KeyUsage(digital_signature={0.digital_signature}, "
                 "content_commitment={0.content_commitment}, "


Test patch:
diff --git a/tests/x509/test_x509_ext.py b/tests/x509/test_x509_ext.py
--- a/tests/x509/test_x509_ext.py
+++ b/tests/x509/test_x509_ext.py
@@ -896,8 +896,8 @@ def test_repr_key_agreement_false(self):
         assert repr(ku) == (
             "<KeyUsage(digital_signature=True, content_commitment=True, key_en"
             "cipherment=False, data_encipherment=False, key_agreement=False, k"
-            "ey_cert_sign=True, crl_sign=False, encipher_only=None, decipher_o"
-            "nly=None)>"
+            "ey_cert_sign=True, crl_sign=False, encipher_only=False, decipher_"
+            "only=False)>"
         )
 
     def test_repr_key_agreement_true(self):
Repository: pyca/cryptography (Python)

Issue:
Make OpenSSL 1.0.2 error (+ env var fallback)



Hints:

Patch:
diff --git a/src/cryptography/hazmat/bindings/openssl/binding.py b/src/cryptography/hazmat/bindings/openssl/binding.py
--- a/src/cryptography/hazmat/bindings/openssl/binding.py
+++ b/src/cryptography/hazmat/bindings/openssl/binding.py
@@ -5,6 +5,7 @@
 from __future__ import absolute_import, division, print_function
 
 import collections
+import os
 import threading
 import types
 import warnings
@@ -170,12 +171,19 @@ def _verify_openssl_version(lib):
         lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_110
         and not lib.CRYPTOGRAPHY_IS_LIBRESSL
     ):
-        warnings.warn(
-            "OpenSSL version 1.0.2 is no longer supported by the OpenSSL "
-            "project, please upgrade. The next version of cryptography will "
-            "drop support for it.",
-            utils.CryptographyDeprecationWarning,
-        )
+        if os.environ.get("CRYPTOGRAPHY_ALLOW_OPENSSL_102"):
+            warnings.warn(
+                "OpenSSL version 1.0.2 is no longer supported by the OpenSSL "
+                "project, please upgrade. The next version of cryptography "
+                "will completely remove support for it.",
+                utils.CryptographyDeprecationWarning,
+            )
+        else:
+            raise RuntimeError(
+                "You are linking against OpenSSL 1.0.2, which is no longer "
+                "supported by the OpenSSL project. You need to upgrade to a "
+                "newer version of OpenSSL."
+            )
 
 
 def _verify_package_version(version):


Test patch:
diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py
--- a/tests/hazmat/bindings/test_openssl.py
+++ b/tests/hazmat/bindings/test_openssl.py
@@ -4,6 +4,8 @@
 
 from __future__ import absolute_import, division, print_function
 
+import pretend
+
 import pytest
 
 from cryptography.exceptions import InternalError
@@ -11,6 +13,7 @@
     Binding,
     _consume_errors,
     _openssl_assert,
+    _verify_openssl_version,
     _verify_package_version,
 )
 
@@ -125,3 +128,12 @@ def test_check_startup_errors_are_allowed(self):
     def test_version_mismatch(self):
         with pytest.raises(ImportError):
             _verify_package_version("nottherightversion")
+
+    def test_verify_openssl_version(self, monkeypatch):
+        monkeypatch.delenv("CRYPTOGRAPHY_ALLOW_OPENSSL_102", raising=False)
+        lib = pretend.stub(
+            CRYPTOGRAPHY_OPENSSL_LESS_THAN_110=True,
+            CRYPTOGRAPHY_IS_LIBRESSL=False,
+        )
+        with pytest.raises(RuntimeError):
+            _verify_openssl_version(lib)
Repository: pyca/cryptography (Python)

Issue:
x509 AuthorityKeyIdentifier and SubjectKeyIdentifier have inconsistent APIs
[x509.AuthorityKeyIdentifier](
https://github.com/pyca/cryptography/blob/96801ff92e861c8ee333c14afda691d1025e5e8f/src/cryptography/x509/extensions.py#L172) and [x509.SubjectKeyIdentifier](
https://github.com/pyca/cryptography/blob/96801ff92e861c8ee333c14afda691d1025e5e8f/src/cryptography/x509/extensions.py#L275) have different APIs to access and compare the key identifiers.

For example, to compare key identifiers one might use `ski.digest == aki.key_identifier`. On one end, the `__hash__` of `AuthorityKeyIdentifier` includes extra stuff like the serial number while the `__hash__` (same as `digest()` of `SubjectKeyIdentifier` is the key identifier). I am not sure if we want to make `AuthorityKeyIdentifier` and `SubjectKeyIdentifier` directly comparable (using `__eq__`) but I think a consistent API would be nicer.

I use these extensions to reconstruct a certificate path.


Hints:

Patch:
diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py
--- a/src/cryptography/x509/extensions.py
+++ b/src/cryptography/x509/extensions.py
@@ -288,6 +288,10 @@ def from_public_key(
     def digest(self) -> bytes:
         return self._digest
 
+    @property
+    def key_identifier(self) -> bytes:
+        return self._digest
+
     def __repr__(self):
         return "<SubjectKeyIdentifier(digest={0!r})>".format(self.digest)
 


Test patch:
diff --git a/tests/x509/test_x509_ext.py b/tests/x509/test_x509_ext.py
--- a/tests/x509/test_x509_ext.py
+++ b/tests/x509/test_x509_ext.py
@@ -994,6 +994,7 @@ def test_properties(self):
         value = binascii.unhexlify(b"092384932230498bc980aa8098456f6ff7ff3ac9")
         ski = x509.SubjectKeyIdentifier(value)
         assert ski.digest == value
+        assert ski.key_identifier == value
 
     def test_repr(self):
         ski = x509.SubjectKeyIdentifier(
Repository: pyca/cryptography (Python)

Issue:
_ModuleWithDeprecations should inherit from types.ModuleType
Steps for reproducing bug:
```python
import inspect
import cryptography.utils
inspect.getsourcefile(cryptography.utils)
```
This will produce the following error:
> TypeError: module, class, method, function, traceback, frame, or code object was expected, got _ModuleWithDeprecations

The fix looks straightforward in cryptography.utils:
```python
class _ModuleWithDeprecations(types.ModuleType):
    def __init__(self, module):
        super().__init__(module.__name__)
        self.__dict__["_module"] = module
```
Used versions:
* ``Python`` 3.8.5
* ``cryptography`` 3.4.7
* ``cffi`` 1.14.0
* ``pip`` 20.2.2
* ``setuptools`` 49.2.1

* ``cryptography`` was installed by conda



Hints:

Patch:
diff --git a/src/cryptography/utils.py b/src/cryptography/utils.py
--- a/src/cryptography/utils.py
+++ b/src/cryptography/utils.py
@@ -7,6 +7,7 @@
 import enum
 import inspect
 import sys
+import types
 import typing
 import warnings
 
@@ -113,8 +114,9 @@ def __init__(self, value, message, warning_class):
         self.warning_class = warning_class
 
 
-class _ModuleWithDeprecations(object):
+class _ModuleWithDeprecations(types.ModuleType):
     def __init__(self, module):
+        super().__init__(module.__name__)
         self.__dict__["_module"] = module
 
     def __getattr__(self, attr):


Test patch:
diff --git a/tests/test_utils.py b/tests/test_utils.py
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -4,6 +4,7 @@
 
 
 import binascii
+import inspect
 import os
 import textwrap
 
@@ -12,6 +13,7 @@
 import pytest
 
 import cryptography
+import cryptography.utils
 from cryptography.exceptions import UnsupportedAlgorithm, _Reasons
 
 import cryptography_vectors
@@ -4444,3 +4446,13 @@ def test_raises_unsupported_algorithm():
             "An error.", _Reasons.BACKEND_MISSING_INTERFACE
         )
     assert exc_info.type is UnsupportedAlgorithm
+
+
+def test_inspect_deprecated_module():
+    # Check if inspection is supported by _ModuleWithDeprecations.
+    assert isinstance(
+        cryptography.utils, cryptography.utils._ModuleWithDeprecations
+    )
+    source_file = inspect.getsourcefile(cryptography.utils)
+    assert isinstance(source_file, str)
+    assert source_file.endswith("utils.py")